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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Sat Jun 28, 2008 4:52 pm   

[2.29] Access Violation
 
I'm getting this access violation and I'm not sure why. It occurs when I run the code below, but it won't happen every time. If I've newly opened Cmud it won't occur, but if it is called after I've been running a while it will give this error.

Code:
date/time         : 2008-06-29, 00:46:43, 484ms
operating system  : Windows XP Service Pack 2 build 2600
system language   : English
system up time    : 5 days 6 hours
program up time   : 1 day 8 hours
processors        : 2x Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
physical memory   : 901/2006 MB (free/total)
free disk space   : (C:) 47.93 GB
display mode      : 1440x900, 32 bit
process id        : $15e4
allocated memory  : 104.59 MB
executable        : cMUDPro.exe
exec. date/time   : 2008-06-26 05:27
version           : 2.29.0.0
compiled with     : BCB 2006/07
madExcept version : 3.0h
callstack crc     : $71ba36d1, $6ac7c269, $6ac7c269
exception number  : 1
exception class   : EAccessViolation
exception message : Access violation at address 00E69439 in module 'cMUDPro.exe'. Read of address 000000F1.

Main ($1438):
00e69439 +0015 cMUDPro.exe  PrefDat   9149   +1 PrefRec.GetName
00e5fd00 +02c4 cMUDPro.exe  PrefDat   5121  +37 FindInClass
00e5ff28 +009c cMUDPro.exe  PrefDat   5175  +14 PkgData.FindHash
00e61ae5 +0075 cMUDPro.exe  PrefDat   5901   +5 PkgData.FindAction
00e61b94 +0078 cMUDPro.exe  PrefDat   5918   +6 PkgData.DefineTrigger
00ddd6fb +01d3 cMUDPro.exe  MAIN     15718  +21 TMUDForm.MakeAction
00df1374 +00a0 cMUDPro.exe  MAIN     19482  +12 TMUDForm.ExecCommand
00e78f45 +00a9 cMUDPro.exe  CodeExec   923   +9 ExecMUDCommand
00e7ee58 +0454 cMUDPro.exe  CodeExec  2563  +45 DoDefault
00e7ff03 +0f2f cMUDPro.exe  CodeExec  2833 +254 HandleCom
00e81494 +060c cMUDPro.exe  CodeExec  3245 +108 TCodeExec.InternalExecute
00e77f8b +005f cMUDPro.exe  CodeExec   468   +8 TCodeExec.Execute
00e7a575 +02d5 cMUDPro.exe  CodeExec  1279  +51 ExecAlias
00e7ad20 +0144 cMUDPro.exe  CodeExec  1402  +15 PushPref
00e7b349 +02a1 cMUDPro.exe  CodeExec  1506  +45 HandleVar
00e7bc1a +06ba cMUDPro.exe  CodeExec  1620  +88 HandleVarRef
00e813c4 +053c cMUDPro.exe  CodeExec  3224  +87 TCodeExec.InternalExecute
00e78052 +0072 cMUDPro.exe  CodeExec   492   +9 TCodeExec.Execute
00e7f33f +036b cMUDPro.exe  CodeExec  2610  +31 HandleCom
00e81494 +060c cMUDPro.exe  CodeExec  3245 +108 TCodeExec.InternalExecute
00e78052 +0072 cMUDPro.exe  CodeExec   492   +9 TCodeExec.Execute
00e7f372 +039e cMUDPro.exe  CodeExec  2611  +32 HandleCom
00e81494 +060c cMUDPro.exe  CodeExec  3245 +108 TCodeExec.InternalExecute
00e77f8b +005f cMUDPro.exe  CodeExec   468   +8 TCodeExec.Execute
00e6eb96 +00c2 cMUDPro.exe  PrefDat  11193   +9 TCacheNode.Execute
00e6ae46 +02a2 cMUDPro.exe  PrefDat   9628  +48 PrefRec.InternalExecute
00e6b092 +0022 cMUDPro.exe  PrefDat   9684   +2 PrefRec.Execute
00dbc12d +0151 cMUDPro.exe  MAIN      6292  +14 TMUDForm.ExecThread
00dbc3e6 +0016 cMUDPro.exe  MAIN      6339   +1 TMUDForm.ExecThread
00dc3c6b +0397 cMUDPro.exe  MAIN      8665  +51 TMUDForm.RaiseEvent
00dc3ed7 +00c3 cMUDPro.exe  MAIN      8704  +10 TMUDForm.RaiseEvent
00df1374 +00a0 cMUDPro.exe  MAIN     19482  +12 TMUDForm.ExecCommand
00e78f45 +00a9 cMUDPro.exe  CodeExec   923   +9 ExecMUDCommand
00e7ee58 +0454 cMUDPro.exe  CodeExec  2563  +45 DoDefault
00e7ff03 +0f2f cMUDPro.exe  CodeExec  2833 +254 HandleCom
00e81494 +060c cMUDPro.exe  CodeExec  3245 +108 TCodeExec.InternalExecute
00e77f8b +005f cMUDPro.exe  CodeExec   468   +8 TCodeExec.Execute
00e6eb96 +00c2 cMUDPro.exe  PrefDat  11193   +9 TCacheNode.Execute
00e6ae46 +02a2 cMUDPro.exe  PrefDat   9628  +48 PrefRec.InternalExecute
00e6b092 +0022 cMUDPro.exe  PrefDat   9684   +2 PrefRec.Execute
00dbc12d +0151 cMUDPro.exe  MAIN      6292  +14 TMUDForm.ExecThread
00dc51c3 +050b cMUDPro.exe  MAIN      9142  +99 TMUDForm.ExecTrig
00dc2a12 +128a cMUDPro.exe  MAIN      8323 +333 TMUDForm.HandleTrigger
00dc1273 +000f cMUDPro.exe  MAIN      7816   +1 TMUDForm.UserOutNewLine
00a5c9e9 +0039 cMUDPro.exe  term      9075   +3 TTerm.DoTriggerLine
00a5ca60 +004c cMUDPro.exe  term      9086   +4 TTerm.TriggerNewLine
00a5bbbc +06c0 cMUDPro.exe  term      8765 +100 TTerm.PutText
00a5c19f +0053 cMUDPro.exe  term      8875   +2 TTerm.Add
00dab021 +00b1 cMUDPro.exe  MAIN      1609   +8 TMUDForm.OutputStr
00dab2f6 +00d6 cMUDPro.exe  MAIN      1690  +25 TMUDForm.NextMUDLine
00dab7a9 +0019 cMUDPro.exe  MAIN      1767   +4 TMUDForm.DoNextLine
004bb0cf +02bb cMUDPro.exe  Controls  5146  +83 TControl.WndProc
004bf0d3 +04fb cMUDPro.exe  Controls  7304 +111 TWinControl.WndProc
004a1633 +0553 cMUDPro.exe  Forms     3512 +136 TCustomForm.WndProc
004be7fc +002c cMUDPro.exe  Controls  7073   +3 TWinControl.MainWndProc
0047c440 +0014 cMUDPro.exe  Classes  11583   +8 StdWndProc
7e4196b2 +000a USER32.dll                       DispatchMessageA
004a97a8 +00fc cMUDPro.exe  Forms     8105  +23 TApplication.ProcessMessage
004a97e2 +000a cMUDPro.exe  Forms     8124   +1 TApplication.HandleMessage
004a9ad7 +00b3 cMUDPro.exe  Forms     8223  +20 TApplication.Run
00f0011c +0088 cMUDPro.exe  cMUDPro    353  +20 initialization
7c91312f +0069 ntdll.dll                        RtlUnicodeStringToAnsiString
7c812bb4 +00b6 kernel32.dll                     GetVersionExA


Code:
#local $temp_name
#T- elixlist_input
#T+ elixlist_work
#forall @elixir_temp_list {
  #call %regex( %i, "\w+_\d+_\d+_(\a+\d+)", $temp_name)
  put $temp_name in @container
  #gagspace
  }
#var elixir_temp_list %sort( @elixir_temp_list)
#forall @elixir_temp_list {
  #call %regex( %i, "\w+_\d+_\d+_(\a+\d+)", $temp_name)
  get $temp_name from @container
  #gagspace
  }
#var elixir_temp_list %null
#alarm +2 {
  #T- elixlist_prompt
  #T- elixlist_work
  #send ""
  }
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Jul 01, 2008 5:09 pm   
 
I was not able to reproduce this. What are you doing when the error occurs? The stack-dump above looks like it crashes when trying to create a new trigger, and none of the code you posted has anything in it to create a new trigger, so I think the problem is occuring in some other script.
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Tue Jul 01, 2008 11:50 pm   
 
This is part of code that reads in a list of vials and then sorts them by putting them in my pack and then taking them out in a specified order so that they are now sorted in my inventory.

When I tested this I thought I had narrowed down the point of failure to this section. You said from the crash report it looks like it is happening when it tries to create a new trigger, and isn't that what the #alarm statement is doing (creating a one time trigger that executes 2 seconds from the present time)?
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Tue Jul 01, 2008 11:58 pm   
 
Here's the rest of the code. I don't see anything else in here that would create a trigger other than the #alarm from the previous post:

Code:

<class name="Elixirs" id="2269">
  <trigger name="elixlist_input" priority="21940" case="true" regex="true" enabled="false" id="2270">
    <pattern>^(Vial\d+)\s+(%%dbkeys(@elixirMap))\s+(\d+)\s+(\S+)</pattern>
    <value>#addkey elixir_sips %db( @elixirMap, %2) (%db( @elixir_sips, %db( @elixirMap, %2)) + %3)
#T+ elixlist_prompt
#if (@elixir_task == "sort") {
  #gagspace
  $temp_months = 500
  #if (%4 <> "---") {$temp_months = %4 + 100}
  $temp_sips = %3 + 200
  $temp_name = %db( @elixirMap, %2)
  $temp_concat = %concat( $temp_name, "_", $temp_sips, "_", $temp_months, "_", %1)
  #additem elixir_temp_list $temp_concat
  }</value>
  </trigger>
  <event event="Prompt" priority="45930" name="elixlist_prompt" enabled="false" id="2271">
    <value>#if (%null( @elixir_task)) {
  #T- elixlist_input
  #T- elixlist_prompt
  } {
  #gagspace
  #if (@elixir_task == "sort") {
    #var elixir_task %null
    process_vials
    }
  }</value>
  </event>
  <trigger name="elixlist_work" priority="21960" case="true" regex="true" enabled="false" id="2272">
    <pattern>^(?:You put|You take)</pattern>
    <value>#gagspace</value>
  </trigger>
  <alias name="sips" autoappend="true" id="2273">
    <value><![CDATA[#say
#say "Elixir         Num"
#say "------------------"
#loopdb @elixir_sips {#say %format( "&-12s  &4.0n", %key, %val)}
#loopdb @elixirMap {#if (%val <> "empty" and %db( @elixir_sips, %val) < 40) {i_alert Low on (%db( @elixir_sips, %val)) : %val}}]]></value>
  </alias>
  <var name="elixir_sips" type="Record" id="2274">mana=169|venom=183|speed=126|health=793|levitation=137|mending=199|frost=185|empty=0|epidermal=229|mass=223|immunity=142|restoration=150|caloric=224</var>
  <trigger type="Command Input" priority="22040" case="true" regex="true" id="2275">
    <pattern>^elixlist2</pattern>
    <value>#var elixir_sips %null
#T+ elixlist_input</value>
  </trigger>
  <alias name="process_vials" autoappend="true" id="2276">
    <value>#local $temp_name
#T- elixlist_input
#T+ elixlist_work
#forall @elixir_temp_list {
  #call %regex( %i, "\w+_\d+_\d+_(\a+\d+)", $temp_name)
  put $temp_name in @container
  #gagspace
  }
#var elixir_temp_list %sort( @elixir_temp_list)
#forall @elixir_temp_list {
  #call %regex( %i, "\w+_\d+_\d+_(\a+\d+)", $temp_name)
  get $temp_name from @container
  #gagspace
  }
#var elixir_temp_list %null
#alarm +2 {
  #T- elixlist_prompt
  #T- elixlist_work
  #send ""
  }</value>
  </alias>
  <alias name="sort_vials" autoappend="true" id="2277">
    <value>#T+ elixlist_input
#var elixir_task sort
~elixlist2
</value>
  </alias>
  <var name="elixirMap" id="2278">an epidermal salve=epidermal|an elixir of mana=mana|a salve of mass=mass|a salve of restoration=restoration|empty=empty|an elixir of venom=venom|a caloric salve=caloric|an elixir of speed=speed|an elixir of immunity=immunity|an elixir of frost=frost|an elixir of health=health|an elixir of levitation=levitation|a salve of mending=mending</var>
  <var name="elixir_temp_list" usedef="true" id="2280"/>
  <var name="elixir_task" usedef="true" id="2281"/>
</class>
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Jul 02, 2008 1:06 am   
 
Yes, the #alarm command creates a new trigger, so it might be that. I missed that in your original post, but will give that a try.
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Wed Jul 02, 2008 4:05 pm   
 
I was getting the error again, so noting you said it was a trigger creation I changed the #alarm statement to make it a permanent alarm trigger that is enabled with #T+ and auto-disables itself. That fixed it so I don't get the AV anymore. However I still don't have an answer as to exactly how that #alarm was causing it. In fact I have alarms in many different places and it never causes issues. Add to my confusion that I never see the AV after just starting CMud, I have to have been playing for a while and then use that code to get it. Very odd.
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Thu Jul 03, 2008 11:08 pm   
 
I saw you fixed this in the release notes, amazing. I didn't think I had given nearly enough information for this to be reproduced repeatably...
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jul 03, 2008 11:34 pm   
 
Well, I *think* it is fixed. What I fixed is a line that might cause an access violation in some cases. But the problem was that it normally shouldn't happen. To trigger the access violation, a cached pointer had to be nil, which means that there is a corrupted setting somewhere. However, it *might* be caused by an alarm (or temp trigger) that removes itself (setting it's pointer to nil) while another script is running. So I went ahead and added a check for the nil pointer to fix the access violation.

(In other words, I never actually "reproduced" the crash, I just used your crash dump info to find the line in the code that I needed to look at)

What I'm saying is that by "fixing" this access violation, I might have just moved the potential problem later into your script. So you might get a new access violation somewhere else now. But give it a try and let me know.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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