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
Menliros
Beginner


Joined: 30 May 2010
Posts: 18

PostPosted: Sun May 30, 2010 10:34 am   

[3.16]Access violation at address 00404DCA in module 'cMUD.exe'. Read of
 
Getting this crash at random intervals. Mostly when I'm running a fairly complex script. I'm not able to find the cause, and judging from the Script Debugger it seems to crash on random triggers. I am using a package with common triggers and aliasses i use with all chars I play and a package specific for that class. What I am noticing is that when it crashes, CMUD has made copies of variables defined in the "common" package in my class specific package. Any clue to what's causing it?

*EDIT it happens in 3.17 as well, also still noticing the variable copies being made. If i try to delete them CMUD hangs, *

Dump below:

Code:

date/time         : 2010-05-30, 11:51:05, 469ms
registered owner  : Microsoft / Microsoft
operating system  : Windows 7 x64 build 7600
system language   : English
system up time    : 1 hour 51 minutes
program up time   : 5 minutes 48 seconds
processors        : 4x Intel(R) Core(TM)2 Quad CPU @ 2.40GHz
physical memory   : 2546/4095 MB (free/total)
free disk space   : (C:) 986.14 GB
display mode      : 1920x1080, 32 bit
process id        : $364
allocated memory  : 87.34 MB
executable        : cMUD.exe
exec. date/time   : 2010-03-29 22:35
version           : 3.16.1.2
compiled with     : BCB 2006/07
madExcept version : 3.0k
callstack crc     : $58300b49, $dc137ba3, $dc137ba3
exception number  : 1
exception class   : EAccessViolation
exception message : Access violation at address 00404DCA in module 'cMUD.exe'. Read of address 00000014.

Main ($1314):
00404dca +0006 cMUD.exe     System       6390   +0 TObject.Free
00cd2c6f +1657 cMUD.exe     MAIN         8896 +404 TMUDForm.HandleTrigger
00405606 +005a cMUD.exe     System       6390   +0 @HandleFinally
77818b2d +00f4 ntdll.dll                           RtlUnwind
777d010a +000a ntdll.dll                           KiUserExceptionDispatcher
00861b50 +0024 cMUD.exe     StDict        556   +3 TStDictionary.dyFindNode
00861a22 +0032 cMUD.exe     StDict        514   +5 TStDictionary.Delete
00a2509f +0027 cMUD.exe     SymbolTable   182   +2 TzSymbolTable.Remove
00d83d50 +0054 cMUD.exe     PrefDat      5351   +9 PkgData.RemoveHeap
00d8999e +001a cMUD.exe     PrefDat      7795   +2 PrefRec.GetClassNum
00d93335 +0005 cMUD.exe     PrefDat     11308   +1 PrefRec.GetClassRec
00d8c750 +002c cMUD.exe     PrefDat      8950   +2 PrefRec.IsEnabled
00d8c76d +0049 cMUD.exe     PrefDat      8950   +2 PrefRec.IsEnabled
00d933fc +0020 cMUD.exe     PrefDat     11349   +3 PrefRec.InScope
00cd2151 +0b39 cMUD.exe     MAIN         8681 +189 TMUDForm.HandleTrigger
00cd10e7 +000f cMUD.exe     MAIN         8316   +1 TMUDForm.UserOutNewLine
00a22593 +0067 cMUD.exe     term         9710   +6 TTerm.DoTriggerLine
00a20ec2 +020e cMUD.exe     term         9268  +34 HandleNewLine
00a21721 +06e1 cMUD.exe     term         9396 +104 TTerm.PutText
00a21d03 +0053 cMUD.exe     term         9503   +2 TTerm.Add
00cbb30a +00b6 cMUD.exe     MAIN         1824   +8 TMUDForm.OutputStr
00cbb62e +011a cMUD.exe     MAIN         1912  +29 TMUDForm.NextMUDLine
00cbbafe +0022 cMUD.exe     MAIN         1993   +4 TMUDForm.DoNextLine
004bc093 +02bb cMUD.exe     Controls               TControl.WndProc
004c0097 +04fb cMUD.exe     Controls               TWinControl.WndProc
004a25f7 +0553 cMUD.exe     Forms                  TCustomForm.WndProc
004bf7c0 +002c cMUD.exe     Controls               TWinControl.MainWndProc
0047d424 +0014 cMUD.exe     Classes                StdWndProc
756f810d +000a USER32.dll                          DispatchMessageA
004aa76c +00fc cMUD.exe     Forms                  TApplication.ProcessMessage
004aa7a6 +000a cMUD.exe     Forms                  TApplication.HandleMessage
004aaa9b +00b3 cMUD.exe     Forms                  TApplication.Run
00e36adc +0088 cMUD.exe     CMUD          372  +20 initialization
75863675 +0010 kernel32.dll                        BaseThreadInitThunk
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Mon May 31, 2010 12:22 am   
 
Without the exact script or a step-by-step procedure to reproduce the problem, there isn't much I can do with this. The crash dump indicates one or more variables have gotten corrupted. Which means you'll get errors when trying to delete them and probably multiple copies if CMUD can't access them. I suggest doing an Export All of your script to an XML file and then create a new blank session and import the XML into the new session. Especially if you have been playing with lots of beta versions that might have had bugs that caused problems in your package files.
Reply with quote
Menliros
Beginner


Joined: 30 May 2010
Posts: 18

PostPosted: Mon May 31, 2010 6:27 pm   
 
I can mail the script, let me know where to. It's a bit large to post. I did the export thing, didn't help. The error is hard to reproduce. The variables getting corrupted are fairly random. It does seem to increase a lot when I have multiple sessions open that use the same package.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Tue Jun 01, 2010 4:49 pm   
 
It sounds too complex for me to easily reproduce here as well, especially if you are sharing it among multiple sessions.

Remember that CMUD scripting is a programming language, and like any other programming language, you can write bad code that causes problems in your scripts. You'll need to use normal debugging techniques, such as disabling certain triggers, or adding #DEBUG commands to write text to the script debugger window to try and determine which part of your script is causing the problem.

I can only treat something as a bug and try to fix it if I get a clean procedure for reproducing the problem.
Reply with quote
Menliros
Beginner


Joined: 30 May 2010
Posts: 18

PostPosted: Thu Jun 03, 2010 10:59 am   
 
I have narrowed it down to a specific piece of my script. Also reproduced it in a single session. I've also traced the access violation to a previous error.

Code:

date/time         : 2010-06-03, 09:35:16, 964ms
registered owner  : Microsoft / Microsoft
operating system  : Windows 7 x64 build 7600
system language   : English
system up time    : 3 days
program up time   : 9 minutes 13 seconds
processors        : 4x Intel(R) Core(TM)2 Quad CPU @ 2.40GHz
physical memory   : 1392/4095 MB (free/total)
free disk space   : (C:) 986.17 GB
display mode      : 1920x1080, 32 bit
process id        : $c38
allocated memory  : 144.29 MB
command line      : "C:\Program Files (x86)\CMUD\cMUD.exe" "IllusionistNexul"
executable        : cMUD.exe
exec. date/time   : 2010-05-07 23:33
version           : 3.17.0.0
compiled with     : BCB 2006/07
madExcept version : 3.0k
callstack crc     : $f437f64c, $c3d596fa, $c3d596fa
exception number  : 1
exception class   : EStContainerError
exception message : Attempt to add duplicate node to TStTree.

Main ($7d4):
00649b62 +01a cMUD.exe     StBase       1190   +3 RaiseContainerError
00861e49 +045 cMUD.exe     StDict        417   +7 TStDictionary.Add
00a25b0a +04e cMUD.exe     SymbolTable   106   +4 TzSymbolTable.Add
00d85832 +0ba cMUD.exe     PrefDat      5332  +12 PkgData.AddHeap
00d8b53c +03c cMUD.exe     PrefDat      7799   +4 PrefRec.GetClassNum
00d94e7b +01b cMUD.exe     PrefDat     11309   +4 PrefRec.GetClassRec
00d8e2cc +02c cMUD.exe     PrefDat      8952   +2 PrefRec.IsEnabled
00d8e2e9 +049 cMUD.exe     PrefDat      8952   +2 PrefRec.IsEnabled
00d94f2c +020 cMUD.exe     PrefDat     11347   +3 PrefRec.InScope
00cd3a19 +b39 cMUD.exe     MAIN         8715 +189 TMUDForm.HandleTrigger
00cd29af +00f cMUD.exe     MAIN         8350   +1 TMUDForm.UserOutNewLine
00a231eb +067 cMUD.exe     term         9748   +6 TTerm.DoTriggerLine
00a21b1a +20e cMUD.exe     term         9306  +34 HandleNewLine
00a22379 +6e1 cMUD.exe     term         9434 +104 TTerm.PutText
00a2295b +053 cMUD.exe     term         9541   +2 TTerm.Add
00cbc99e +0b6 cMUD.exe     MAIN         1828   +8 TMUDForm.OutputStr
00cc04df +0d3 cMUD.exe     MAIN         2695  +11 SendBuf
00cc1d12 +d3a cMUD.exe     MAIN         3131 +246 TMUDForm.ProcessMUDBuffer
00cbca7f +02f cMUD.exe     MAIN         1849   +1 TMUDForm.ParseOut
00cbcb80 +048 cMUD.exe     MAIN         1872   +4 TMUDForm.EchoStr
00cc22a1 +139 cMUD.exe     MAIN         3246  +22 TMUDForm.EchoPas
00cc20b2 +04a cMUD.exe     MAIN         3202   +4 TMUDForm.EchoInfo
00d10874 +070 cMUD.exe     MAIN        24059   +1 TMUDForm.wmTick
0040518e +002 cMUD.exe     System       6390   +0 @ClassDestroy
00579285 +025 cMUD.exe     cxClasses              TcxObjectLinkController.Destroy
00404dcc +008 cMUD.exe     System       6390   +0 TObject.Free
0045ad60 +008 cMUD.exe     SysUtils               FreeAndNil
0057938c +014 cMUD.exe     cxClasses              ReleaseObjectLinkControllerRefCount
005793c4 +010 cMUD.exe     cxClasses              cxRemoveObjectLink
005abeaf +1c7 cMUD.exe     cxControls             TcxControl.WndProc
0058611e +186 cMUD.exe     cxContainer            TcxContainer.WndProc
004bbd20 +024 cMUD.exe     Controls               TControl.Perform
004ba8fa +006 cMUD.exe     Controls               TControl.GetTextBuf
004ba99a +026 cMUD.exe     Controls               TControl.GetText
004bf7c0 +02c cMUD.exe     Controls               TWinControl.MainWndProc
0047d424 +014 cMUD.exe     Classes                StdWndProc
75f9810d +00a USER32.dll                          DispatchMessageA
004aa76c +0fc cMUD.exe     Forms                  TApplication.ProcessMessage
004aa7a6 +00a cMUD.exe     Forms                  TApplication.HandleMessage
004aaa9b +0b3 cMUD.exe     Forms                  TApplication.Run
00e38bb8 +088 cMUD.exe     CMUD          373  +20 initialization
76593675 +010 kernel32.dll                        BaseThreadInitThunk


When this happens my it somehow creates one or more corrupt variables in a random class. I have to restart CMUD, find all the variables, delete them, and restart CMUD again to fix it. If I miss one it will eventually trigger the access violation.

I've traced everything to this part of my script:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger type="Alarm" priority="5590">
    <pattern>-00:10</pattern>
    <value>#SAY Tick!
#IF (@hasspells()=0 AND @memoutdir!="None" AND @memmingout=0 AND @fighting=1)
 {
 #SAY Memming Out!
  retr @memoutdir
  #VAR attempttomem 1
 } {
#IF (@fighting=1 AND @iscasting=0) {
#SAY Fire!
castspell
 } { #IF ( @iscasting=0 AND @amspellingup=1 AND @position=std ) { #WAIT 500 {castspell} }} }</value>
  </trigger>
</cmud>


A number of the used variables are set in a trigger on the prompt. This trigger can fire without a problem for a 100 times, but eventually it will set of the exception. I'm wondering if things go wrong because i'm trying to read a variable that is being changed at the same time by the prompt trigger.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Jun 03, 2010 2:12 pm   
 
That's what it looks like to me.

Quote:
76593675 +010 kernel32.dll BaseThreadInitThunk


Quote:
#IF ( @iscasting=0 AND @amspellingup=1 AND @position=std ) { #WAIT 500 {castspell} }}


Try putting that castspell into an event that you raise after the wait something like this.

#WAIT 500 {#Raise {castspell}}

Sometimes that helps.

If that doesn't do it then try putting sections around the variables that you are changing in your prompt.

So instead of just #var health %2 make a function for changing/reading the health variable.

the value would be something like

#section HealthVar {
#if (%1=="") {#Return {@health}} {#var health %1}
#Return {}
}

Then anywhere that you are setting your health use #call @healthVar(1249) for example.
And anywhere that you are checking your health you would just put @healthVar()

You would need to make something similar for all of the variables that you are setting in your prompt, and replace them anywhere in your scripts that they are being set or read with the function.

Obviously, if the first solution works it is the easier one. Hope one of them helps!
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Thu Jun 03, 2010 4:22 pm   
 
I think Arminas is correct. When using #WAIT, you are spawning a new background thread that will now run simultaneously with the rest of your scripts. So it really depends upon what your "castspell" alias does. The "castspell" alias needs to be written with the understanding that multiple copies of that alias might be running simultaneously.

You might try converting the #WAIT to a one-shot alarm, like this:
Code:
#IF ( @iscasting=0 AND @amspellingup=1 AND @position=std ) { #ALARM +0.5 {castspell} }}
Reply with quote
Menliros
Beginner


Joined: 30 May 2010
Posts: 18

PostPosted: Fri Jun 04, 2010 5:51 pm   
 
Removing the #WAIT solved the problem. Thanks for the help.
Reply with quote
chris123zugg
Wanderer


Joined: 23 Aug 2013
Posts: 79

PostPosted: Wed Sep 11, 2013 4:37 pm   
 
So in essence ANY #WA can cause this type of error? I've been seeing this error report crop up ALOT and previously had no idea why. Is there some way avoid the error without removing ALL of my #wa triggers 1 by 1?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Sep 11, 2013 10:56 pm   
 
The error is specifically that you made a background thread, not that you used #WAIT. #WAIT creates a background thread, but so does #RAISEEVENT (or maybe just #EVENT), other variations of the #WAIT command, and any use of the #THREAD-related commands. CMud also creates background threads on its own.

You could, of course, click the gun and computer icons to the right of the commandline so that each icon has a red X across it. This turns off everything, preventing the error from happening via your scripting but it could still happen via the internally-created threads you don't have control over.
_________________
EDIT: I didn't like my old signature
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