Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Sep 29, 2007 12:33 pm   

[2.04] Trigger error/crash: argument still on stack
 
Right after installing of 2.04 I ran into 1 crash (reported, from 3rd attempt only! 2 times it gives up while show me "Finalizing..." message) and, after CMUD restart, 1 informational error message.
No changes to settings since 2.03 was made, and everything work fine in 2.03

Here is the trigger (it looks strange since I ran with it in "can't save your changes" bug in 2.03 and have forget about it later, cause after all it do its work):
Code:

PATTERN:
Total exp for kill is (%d).

SCRIPT:
#IF (@GroupMode = 1)
{
  CurrEXP = @CurrEXP + %1;
  TodayEXP = @TodayEXP + %1;
}
{#IF (@GroupMode = 3)
  {
    CurrEXP = @CurrEXP + %1;
    TodayEXP = @TodayEXP + %1;
    GroupEXP = @GroupEXP + %1;
  }
}
#RAISE onExpChange;


After this tigger fires, I've receive the following trigger informational message on Main screen:
ERROR: Arguments still on stack: 0; 7

Sorry, I write this by memory, since after this error half of my triggers gonna mad and won't fire, #CAPTURE failed to capture anything, status window hide status setting (exactly, setting itself) with values that supposed to be updated in onExpChange event handler... So I ran to safe place and close CMUD. Only then I realize that I forgot to save message text. I'n not sure only for one thing "Arguments still on stack: 0; 7" or "Arguments still on stack: 7; 0" it was? Really sorry for that.

After this point I realize that previous crash have happened right before the "Total exp for kill is XXX" must been show on screen. Again, it crashes on first time, but just give me en error message on second, although became unplayable due to messed up memory.

Ok, after this error I go to Editor and found that I still use that strange script in this trigger and edit it. Now it looks like:
Code:

PATTERN:
^Total exp for kill is (%d).

SCRIPT:
CurrEXP = @CurrEXP + %1;
TodayEXP = @TodayEXP + %1;
#IF (@GroupMode = 3)
{
  GroupEXP = @GroupEXP + %1;
}
#RAISE onExpChange;


Whe I went to kill smth and received "Total exp for kill is XXX." line, CMUD crashes. It show me an error report, but still receive text output from MUD. It freeze text scrolling for a second when crash occures, buf after that freeze and before continuing show MUD output, it type error message to Main window. Here is it what I've see:

Code:

Total exp for kill is 3233.
ERROR: argument still on stack: 371137-362887 *Sec:
*Pri:
371137-362887 *Sec:


*Sec:, *Pri: - these are string literals in my status bar element settings

I restart CMUD and try "score" command - it have triggers on its output. Crash again. Restart CMUD. Try "score": all OK. Strange...

To summarize, I have 2 types of crash reports with triggers in 2.04, 1 for main thread and 1 for working thread:

Code:

operating system  : Windows XP Service Pack 2 build 2600

system up time    : 1 hour 30 minutes
program up time   : 18 minutes 5 seconds
processors        : 2x Intel(R) Pentium(R) D CPU 3.40GHz
physical memory   : 1481/2046 MB (free/total)
free disk space   : **** 68,70 GB
display mode      : 1680x1050, 32 bit
process id        : $7fc
allocated memory  : 46,97 MB
executable        : cMUD.exe
exec. date/time   : 2007-09-29 00:38
version           : 2.4.0.0
madExcept version : 3.0b
callstack crc     : $934ab665, $c2b8e52d, $c2b8e52d
count             : 2      -------------> this was when I've receive "ERROR: argument still on stack: 371137-362887 *Sec:..." error message on main screen
exception number  : 5      ------------->
exception class   : EAccessViolation
exception message : Access violation at address 00778EA6 in module 'cMUD.exe'. Read of address 0000000C.

Main ($adc):
00778ea6 +076 cMUD.exe     Lister       400  +22 pList.Store
00d4573e +03e cMUD.exe     CodeExec    3162   +6 TCodeExec.PushBuffer
00d457a5 +029 cMUD.exe     CodeExec    3176   +2 TCodeExec.PushBuffer
00d3cb37 +01f cMUD.exe     CodeExec     446   +2 TCodeExec.Expression
00d34122 +086 cMUD.exe     PrefDat    10548  +10 TCacheNode.GetCaption
00d30bd3 +0bb cMUD.exe     PrefDat     9089  +15 PrefRec.InternalGetCaption
00d30ccd +00d cMUD.exe     PrefDat     9128   +1 PrefRec.GetCaption
00c9f5d0 +0ac cMUD.exe     MAIN       10012  +18 TMUDForm.CompileStatus
00c9f74d +079 cMUD.exe     MAIN       10038   +5 TMUDForm.UpdateStatBar
00c9c84e +022 cMUD.exe     MAIN        8793   +1 TMUDForm.StatMes
00c9c9fa +122 cMUD.exe     MAIN        8842  +37 TMUDForm.MUDSockInfo
009b5ab0 +018 cMUD.exe     zsock        675   +2 TClientSocket.DoInfo
009b55d3 +00f cMUD.exe     zsock        515   +1 TClientSocket.Send
00c88e7a +072 cMUD.exe     MAIN        2600   +5 TMUDForm.SendRaw
00c8bfd7 +3db cMUD.exe     MAIN        3544  +58 TMUDForm.SendStr
00c8c2ff +237 cMUD.exe     MAIN        3589  +27 TMUDForm.RecordSendStr
00c48c3e +00e cMUD.exe     CodeThread   988   +0 TRunCodeThread.DoRecordSendStr
0047d901 +101 cMUD.exe     Classes     9339  +22 CheckSynchronize
0052e6f3 +6df cMUD.exe     Forms       6671 +144 TApplication.WndProc
0047fef8 +014 cMUD.exe     Classes    10966   +8 StdWndProc
77d3bcc7 +00a USER32.dll                         DispatchMessageA
0052ee48 +0ac cMUD.exe     Forms       6873  +13 TApplication.ProcessMessage
0052ee8f +00f cMUD.exe     Forms       6892   +1 TApplication.HandleMessage
0052f12a +0a6 cMUD.exe     Forms       6976  +16 TApplication.Run
00db65c0 +088 cMUD.exe     CMUD         343  +18 initialization
7c91312f +069 ntdll.dll                          RtlUnicodeStringToAnsiString
7c812907 +0b6 kernel32.dll                       GetVersionExA

and
Code:

exception class   : EAccessViolation
exception message : Access violation at address 00D45197 in module 'cMUD.exe'. Read of address 00000004.

thread $9bc:
00d45197 +017 cMUD.exe CodeExec    2897   +4 TCodeExec.PopBuffer
00d3cddb +0b7 cMUD.exe CodeExec     523  +15 TCodeExec.ParseExp
00d3bbed +05d cMUD.exe Syntaxer     445   +6 TSyntaxClass.ParseExp
00a2a44e +01a cMUD.exe Exp           28   +2 ParseExp
00ca5924 +5ac cMUD.exe MAIN       12033  +38 TMUDForm.ExecFunction
00d3d53d +059 cMUD.exe CodeExec     780   +4 ExecMUDFunction
00d417d8 +5b0 cMUD.exe CodeExec    1895  +84 HandleFunc
00d41921 +035 cMUD.exe CodeExec    1937   +5 HandleFuncRef
00d44df3 +543 cMUD.exe CodeExec    2824  +83 TCodeExec.InternalExecute
00d3c8ef +09b cMUD.exe CodeExec     390  +14 TCodeExec.Execute
00d3eb19 +17d cMUD.exe CodeExec    1106  +24 ExecAlias
00d3f224 +138 cMUD.exe CodeExec    1219  +15 PushPref
00d3f86b +2c3 cMUD.exe CodeExec    1323  +45 HandleVar
00d40073 +5db cMUD.exe CodeExec    1433  +84 HandleVarRef
00d44d45 +495 cMUD.exe CodeExec    2806  +65 TCodeExec.InternalExecute
00d3c8ef +09b cMUD.exe CodeExec     390  +14 TCodeExec.Execute
00d33f45 +055 cMUD.exe PrefDat    10492   +6 TCacheNode.Execute
00d30a2b +227 cMUD.exe PrefDat     9053  +40 PrefRec.InternalExecute
00d30c3e +022 cMUD.exe PrefDat     9102   +2 PrefRec.Execute
00c94269 +055 cMUD.exe MAIN        5807   +6 TMUDForm.ExecThread
00c94485 +011 cMUD.exe MAIN        5850   +1 TMUDForm.ExecThread
00c99174 +128 cMUD.exe MAIN        7471  +21 TMUDForm.RaiseEvent
00c99252 +072 cMUD.exe MAIN        7496  +10 TMUDForm.RaiseEvent
00cc26e7 +07f cMUD.exe MAIN       17697  +11 TMUDForm.ExecCommand
00d3d593 +047 cMUD.exe CodeExec     788   +4 ExecMUDCommand
00d42a17 +37f cMUD.exe CodeExec    2225  +38 DoDefault
00d4377b +c63 cMUD.exe CodeExec    2425 +190 HandleCom
00d44e17 +567 cMUD.exe CodeExec    2827  +86 TCodeExec.InternalExecute
00d3c8ef +09b cMUD.exe CodeExec     390  +14 TCodeExec.Execute
00c49a38 +0e4 cMUD.exe CodeThread  1330  +16 TRunCodeThread.Run
00902e13 +0d7 cMUD.exe IdThread     348  +35 TIdThread.Execute
0047d9da +036 cMUD.exe Classes     9372   +7 ThreadProc
00405acc +028 cMUD.exe System                ThreadWrapper

Main ($334):
7c90eb94 +00 ntdll.dll     KiFastSystemCallRet
7c90e637 +0a ntdll.dll     NtSetInformationProcess
7c80aac3 +2c kernel32.dll  SetErrorMode
7c91312f +69 ntdll.dll     RtlUnicodeStringToAnsiString
7c812907 +b6 kernel32.dll  GetVersionExA


No need to say that 2.04 is unplayable at all. And there is not a problem with one script, it is a problem with how CMUD execute scripts.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sat Sep 29, 2007 1:57 pm   
 
Restart CMUD after every crash.

First test if you can replicate the crash with:
#SHOW Total exp for kill is 12345.

Then try taking everything out of the "^Total exp for kill is (%d)." script, retest, re-add the script 1 line at a time until it crashes - this crash could be tracked down more I think.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sat Sep 29, 2007 3:36 pm   
 
I can't replicate this crash in a blank session (with various values of @GroupMode), although obviously I don't have the same EVENT trigger.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Sep 29, 2007 8:56 pm   
 
Seb wrote:
Restart CMUD after every crash.

Thanks for advice, but when I act other way? Wink I click on Continue application only when CMUD Help window crashes with "RecordIndex out of range" message, it is not critical for CMUD itself.

Seb wrote:

First test if you can replicate the crash with:
#SHOW Total exp for kill is 12345.

I receive very interesting results. I sent the line you suggested 3 times with no effect. Then I slightly edit it, replaced #SHOW with #SAY. And I've got "Out of memory" crash.

Seb wrote:

Then try taking everything out of the "^Total exp for kill is (%d)." script, retest, re-add the script 1 line at a time until it crashes - this crash could be tracked down more I think. I can't replicate this crash in a blank session (with various values of @GroupMode), although obviously I don't have the same EVENT trigger.


Event handler for OnExpChange event currently only calls RecalcExp alias, which refresh all exp-left-to-next-level variables (this cause status bar to update its content). Alias text:
Code:

NextPri = @GetNextPriExp(%eval(@LevelPri)) - @CurrEXP;
NextSec = @GetNextSecExp(%eval(@LevelSec)) - @CurrEXP;
NextTer = @GetNextTerExp(%eval(@LevelTer)) - @CurrEXP;
NextQua = @GetNextQuaExp(%eval(@LevelQua)) - @CurrEXP;
NextAva = @GetNextAvaExp(%eval(@LevelAva)) - @CurrEXP;


GetNext***Exp are functions with the following code:
Code:

%case(%eval($iCurrentLevel + 1), 40000, 80000, 160000, 320000, 450000, 700000, 1000000, 1400000, 2800000, 3600000, 5500000, 8000000, 10000000, 12000000, 16000000, 18000000, 20000000, 22000000, 24000000, 28000000, 32000000, 40000000, 60000000, 80000000, 100000000, 120000000, 148000000, 180000000, 210000000, 280000000, 320000000, 360000000, 390000000, 450000000, 508000000, 605000000, 650000000, 700000000, 850000000, 900000000, 0);

They simple evaluate how many exp. points to next level required and takes character level as a parameter. All these functions I created with copy-paste method, they differs only in number values inside their bodies.

First of all, I remove #RAISE command from trigger body - #SHOW/#SAY test passed ok.
Then, I get back #RAISE and remove all but first line of RecalcExp alias - ok
Then, I add 2 more lines to RecalcExp alias - ok.
Next, I restore original RecalcExp alias and remove only the last line - on the first #SHOW try CMUD hangs. I was forced to remove CMUD task.
Run CMUD, try it again - now it crash with "Out of memory".

What's the problem with
Code:

NextQua = @GetNextQuaExp(%eval(@LevelQua)) - @CurrEXP;

statement? I just check: @LevelQua = 4, @CurrExp = 1801314
The functions, as I mentioned above, just clones of each other, but first of them executes normally and 4th of them crashes CMUD.

Heh, restart CMUD, restore all scripts back and run #SHOW/#SHOW/#SHOW/#SAY test - not a crash but rather error message on screen (yes, with all blank lines inserted by CMUD):
Code:

Total exp for kill is 12345.
ERROR: argument still on stack: *Pri:
ERROR: argument still on stack: 7-1050694 *Sec: -1849882 *Ter: -1418349 *Qua: -1388349
































*Pri:


And here is status bar (and status window) element which use these variables:
Code:

*Pri: @NextPri *Sec: @NextSec *Ter: @NextTer *Qua: @NextQua


Last edited by Arde on Sun Sep 30, 2007 12:35 am; edited 2 times in total
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Sep 29, 2007 9:53 pm   
 
Well, things get more interesting.

I've mention in my first post that "score" command has triggers on it's output ("score" just activate a class, which parses mud output and deactivate self on prompt) and also crashes CMUD. I just check the syntax of that trigger. It has the same #RAISE onExpChange statement.

Code:

PATTERN:
^You have (%d) unused experience points.

SCRIPT:
CurrExp = %1;
#RAISE onExpChange;


When I sent "score" command and CMUD start receive mud output, I see the following (some lines from mud output skipped):

Arde - rerolls:15, 3x18:0, 2x18:0, 1x18:1 (level: 20)
Your levels: Wa: 20 Cl: 13 Ne: 7 Ba: 4
You are 17 years and 14 months old.
You have seen a fair amount of this area.
You have 370(373) hit, 122(122) mana and 71(88) movement points.
Your armor class is 0.5 (-0.5 awake).
You have 43905 gold coins.
You have twenty-six drachma.
You have 1177654 unused experience points.
ERROR: Operator CONCAT requires two arguments
ERROR: Operator LE requires two arguments

You have been playing for 2 days and 21 hours.
You are sleeping.
You are affected by the following spells:
Detect Evil
Detect Good
Detect Magic
Detect Invisible
Armor
Bless

Note the error messages from trigger I posted above. More strangely, on my second "score" command there was no error messages at all.

Looks like the problem with events?

I've deactivate the trigger on "Total exp for kill is 12345", now I did the same with "You have 12345 unused experience points." for a while.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sat Sep 29, 2007 10:46 pm   
 
You could also try the following:
#RAISE onExpChange
and:
RecalcExp
from the commandline - obviously, there wouldn't actually be any exp change, so it's not quite the same, but might still be of interest to see if either or both of these commands also cause a crash.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sat Sep 29, 2007 10:59 pm   
 
Done it.

Both commands (#RAISE onExpChange and RecalcExp) executes normally. But then I've got an idea: since I raise this event when value of CurrEXP changes, I should try to modify this variable manually.
I did that and try #RAISE onExpChange - CMUD crashes with access violation exception.
Restart CMUD, try RecalcExp. OK. But then I remembered that I not change CurrEXP value since restart. Modify it, try execute RecalcExp. It show error message on the main screen:
ERROR: Operator XOR requires two arguments
ERROR: Operator CONCAT requires two arguments


So, I have an error or crash if CurrExp' value changed. If it not changed, then there will be no errors.

Call stack for #RAISE crash:
Code:

count             : 2
exception number  : 1
exception class   : EAccessViolation
exception message : Access violation at address 00D4645A in module 'cMUD.exe'. Write of address 00000010.

Main ($728):
00d4645a +01e cMUD.exe     CodeGen          246   +2 TCodeGen.AddCode
00d47a12 +00a cMUD.exe     CodeGen          838   +2 TCodeGen.PushStr
00d5ee27 +00f cMUD.exe     CmudY          11795   +0 TCmudYImp.PushStr
00d5d88d +461 cMUD.exe     CmudY          11358 +116 TCmudYImp.yyparse
00d52cde +092 cMUD.exe     CmudY            321  +10 TCmudYImp.Execute
00d3b993 +0af cMUD.exe     Syntaxer         358  +20 TSyntaxClass.InternalCompile
00d3ba55 +011 cMUD.exe     Syntaxer         382   +1 TSyntaxClass.CompilePat
00d33cdb +19b cMUD.exe     PrefDat        10429  +19 TCacheNode.Compile
00d340dd +041 cMUD.exe     PrefDat        10541   +3 TCacheNode.GetCaption
00d30bd3 +0bb cMUD.exe     PrefDat         9089  +15 PrefRec.InternalGetCaption
00d2ff7c +010 cMUD.exe     PrefDat         8853   +1 TrigNode.GetExpandPat
00c97edf +a73 cMUD.exe     MAIN            7081 +179 TMUDForm.HandleTrigger
00c96f68 +00c cMUD.exe     MAIN            6733   +1 TMUDForm.UserOutNewLine
00a1bd25 +039 cMUD.exe     term            8395   +3 TTerm.DoTriggerLine
00a1a876 +20a cMUD.exe     term            7980  +33 HandleNewLine
00a1b01c +6a4 cMUD.exe     term            8099 +100 TTerm.PutText
00a1b591 +049 cMUD.exe     term            8203   +2 TTerm.Add
00c843b5 +0b1 cMUD.exe     MAIN            1381   +8 TMUDForm.OutputStr
00c876e6 +066 cMUD.exe     MAIN            2141   +4 SendBuf
00c8841c +b8c cMUD.exe     MAIN            2397 +222 TMUDForm.ProcessMUDBuffer
00c8448d +02d cMUD.exe     MAIN            1402   +1 TMUDForm.ParseOut
00c8458c +048 cMUD.exe     MAIN            1425   +4 TMUDForm.EchoStr
00c88d49 +109 cMUD.exe     MAIN            2576  +20 TMUDForm.EchoPas
00c88c11 +049 cMUD.exe     MAIN            2550   +4 TMUDForm.EchoInfo
00d3c6bb +017 cMUD.exe     CodeExec         337   +4 TCodeExec.EchoInfo
00d3c73b +057 cMUD.exe     CodeExec         352   +3 TCodeExec.DoError
00d3e09d +0c9 cMUD.exe     CodeExec         980   +8 EvalTwo
00d4509a +7ea cMUD.exe     CodeExec        2881 +140 TCodeExec.InternalExecute
00d3cba6 +08e cMUD.exe     CodeExec         456  +12 TCodeExec.Expression
00d34122 +086 cMUD.exe     PrefDat        10548  +10 TCacheNode.GetCaption
00d30bd3 +0bb cMUD.exe     PrefDat         9089  +15 PrefRec.InternalGetCaption
00d30ccd +00d cMUD.exe     PrefDat         9128   +1 PrefRec.GetCaption
00d208c3 +02f cMUD.exe     PrefDat         2315   +4 StatusRec.Invalidate
00c60564 +0fc cMUD.exe     PARENT         11337  +26 TParentForm.WMInvalidatePref
00505f93 +1df cMUD.exe     Controls        4645  +53 TControl.WndProc
00509cc2 +18e cMUD.exe     Controls        6342  +33 TWinControl.WndProc
00526da0 +478 cMUD.exe     Forms           3098 +103 TCustomForm.WndProc
00bfb880 +020 cMUD.exe     DXSounds        2013   +9 TCustomDXSound.FormWndProc
00bf8fdc +00c cMUD.exe     DXClass          572   +1 TControlSubClass.WndProc
00509894 +034 cMUD.exe     Controls        6237   +3 TWinControl.MainWndProc
0047fef8 +014 cMUD.exe     Classes        10966   +8 StdWndProc
77d3e361 +016 USER32.dll                             CallWindowProcA
006d57c3 +0a7 cMUD.exe     aqDockingUtils  1728   +7 CallDefWndProc
006d58b1 +0dd cMUD.exe     aqDockingUtils  1776  +41 TaqWindowEventFilter.WndProc
0047fef8 +014 cMUD.exe     Classes        10966   +8 StdWndProc
77d3bcc7 +00a USER32.dll                             DispatchMessageA
...............................more.................................
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sat Sep 29, 2007 11:03 pm   
 
So, if you change the value of CurrEXP manually and then call RecalcExp, you get those two error lines printed to the screen, but not the Access violation?
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Sun Sep 30, 2007 12:13 am   
 
No, the result of calling RecalcExp is not determined. I can get error lines, and on next CMUD restart can get Access violation. Either either. I think when I call #RAISE, it just can't send error message on screen and just crash CMUD, while RecalcExp can sometimes send an error string.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net