![](templates/Classic/images/spacer.gif) |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Fri Apr 09, 2010 6:31 am
[3.16b] #Thread issue, crash and freeze |
I have an alias that takes a while to complete. So, seeing as I didn't want it to freeze cmud while it ran, I decided to put it in a #thread. The result were a continuation of errors until cmud froze.
Edit: SEE BELOW POSTS
Crash report
Code: |
date/time : 2010-04-09, 03:52:05, 0ms
computer name : STONEWAL-B09690
user name : Administrator <admin>
registered owner : Stonewall-64x1
operating system : Windows XP x64 Service Pack 2 build 3790
system language : English
system up time : 7 days 14 hours
program up time : 1 minute 34 seconds
processors : 2x AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
physical memory : 280/2047 MB (free/total)
free disk space : (C:) 32.37 GB
display mode : 1600x900, 32 bit
process id : $7ec
allocated memory : 43.29 MB
executable : cMUD.exe
exec. date/time : 2010-03-29 13:35
version : 3.16.1.2
compiled with : BCB 2006/07
madExcept version : 3.0k
callstack crc : $dd4db46f, $fc92da03, $fc92da03
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 00C85F30 in module 'cMUD.exe'. Read of address 00000040.
Main ($1454):
00c85f30 +d34 cMUD.exe PARENT 4742 +267 TParentForm.UpdateButtons
00c8315c +064 cMUD.exe PARENT 3603 +5 TParentForm.DoRefreshSetting
00c83232 +0b2 cMUD.exe PARENT 3619 +7 TParentForm.wmRefreshSetting
004bc093 +2bb cMUD.exe Controls TControl.WndProc
004c0097 +4fb cMUD.exe Controls TWinControl.WndProc
004a25f7 +553 cMUD.exe Forms TCustomForm.WndProc
00c2dbf8 +020 cMUD.exe DXSounds 2128 +9 TCustomDXSound.FormWndProc
00c2c0e8 +00c cMUD.exe DXClass 635 +1 TControlSubClass.WndProc
004bf7c0 +02c cMUD.exe Controls TWinControl.MainWndProc
0047d424 +014 cMUD.exe Classes StdWndProc
7d952e1c +016 USER32.dll CallWindowProcA
00707a9f +0a7 cMUD.exe aqDockingUtils 1728 +7 CallDefWndProc
00707b8d +0dd cMUD.exe aqDockingUtils 1776 +41 TaqWindowEventFilter.WndProc
0047d424 +014 cMUD.exe Classes StdWndProc
7d94ab81 +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
00e36adc +088 cMUD.exe CMUD 372 +20 initialization |
|
|
Last edited by GeneralStonewall on Sat Apr 10, 2010 1:33 am; edited 3 times in total |
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Apr 09, 2010 3:06 pm |
Most of the code looks pretty thread-safe. However, in your main Elixsort Thread, you are referring to a couple of global variables:
@vials_decay
@vials_empty_decay
When you change the values via ADDKEY and DELKEY this can cause buttons to get refreshed. Your crash dump shows the crash during the UpdateButton routine,
so it looks like you have something else in your scripts (like buttons) interfering with this.
I tried your script and wasn't able to get the crash to happen here. Although they also didn't take very long to run when I just typed "elixsort" to test it. |
|
|
![](templates/Classic/images/spacer.gif) |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Sat Apr 10, 2010 12:12 am |
Alright, so, I think I've narrowed it down a bit. It's only happening when I have undocked/floating windows and my buttons are in a separate package.
I also have an alarm that fires every 0.1 seconds that '#update's three of those buttons. These things together seem to be causing the issue.
I'll recreate it in a fresh session and send it on over to you.
Edit: It doesn't seem to happen 100% of the time either. I'll see if I can make a new alias that's a bit simpler, to reproduce.
Here, add this to the elix_sort package and run it. It seems to cause the error almost every time:
Quote: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="test" copy="yes">
<value>#thread {
#99 {#99 {
#addkey test_db %i %j
#delkey test_db %i
}}
#echo done
}</value>
</alias>
</cmud>
|
It also causes duplicate variables to be created in every folder/window of the package. |
|
|
![](templates/Classic/images/spacer.gif) |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Sat Apr 10, 2010 1:03 am |
I've simplified it a little more: Import each of these into fresh settings, the first into the root/main/first package and the 2nd into an additional package called 'threadtest2', and then use the 'test' alias.
Main package (ThreadTest):
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<window name="ThreadTest">
<uid>{2ED32B1E-318D-4E02-A0E3-397C09434565}</uid>
<packages>English Keypad|English Directions|threadtest2|Clickable URLs|ThreadTest</packages>
<alias name="test">
<value>#thread {
#99 {#99 {
#addkey test_db %i %j
#delkey test_db %i
}}
#echo done
}</value>
</alias>
<var name="test_db" type="Record"/>
</window>
<alias name="test">
<value>#thread {
#99 {#99 {
#addkey test_db %i %j
#delkey test_db %i
}}
#echo done
}</value>
</alias>
<var name="test_db" type="Record"/>
<window name="window1" commandline="false" statusbar="false">
<uid>{3908B8E4-351A-4806-BB31-B3C7A5646967}</uid>
<packages>English Keypad|English Directions|Clickable URLs|ThreadTest</packages>
</window>
<window name="window2" commandline="false" statusbar="false">
<uid>{0BBF683B-2B21-43DB-BF1D-85F1CC08E5F0}</uid>
<packages>English Keypad|English Directions|Clickable URLs|ThreadTest</packages>
</window>
</cmud> |
Second Package (threadtest2):
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger type="Alarm" priority="88660">
<pattern>*0.1</pattern>
<value>#update Roar1
#update Roar2
#update Roar3</value>
</trigger>
<button type="Separator" autosize="false" width="60" height="15" autopos="false" left="60" top="501" priority="7">
<caption>%item(@roaring, 1)</caption>
</button>
<button type="Separator" autosize="false" width="60" height="15" autopos="false" left="60" top="521" priority="396">
<caption>%item(@roaring, 2)</caption>
</button>
<button type="Separator" autosize="false" width="60" height="15" autopos="false" left="60" top="541" priority="392">
<caption>%item(@roaring, 3)</caption>
</button>
<button name="boneshaking" type="Separator" autosize="false" width="80" height="5" autopos="false" left="20" top="584" color="red" border="black" priority="134299"/>
<button type="Separator" autosize="false" width="80" height="15" autopos="false" left="20" top="571" priority="134517">
<caption>Boneshaking: @boneshaking</caption>
</button>
<button type="Separator" autosize="false" width="40" height="15" autopos="false" left="20" top="501" priority="463">
<caption>Roar 1:</caption>
</button>
<button type="Separator" autosize="false" width="40" height="15" autopos="false" left="20" top="521" priority="405">
<caption>Roar 2:</caption>
</button>
<button type="Separator" autosize="false" width="40" height="15" autopos="false" left="20" top="541" priority="402">
<caption>Roar 3:</caption>
</button>
<button type="Separator" autosize="false" width="200" height="15" autopos="false" top="481" priority="499">
<caption>Roar Status</caption>
</button>
<button name="Roar1" type="Separator" autosize="false" width="27" height="15" autopos="false" left="160" top="501" priority="424">
<caption>%format( "&4.1f", %if(%alarm( roar_1) != -1, %eval(%alarm( roar_1)/1000.0), 0))</caption>
</button>
<button name="Roar2" type="Separator" autosize="false" width="27" height="15" autopos="false" left="160" top="521" priority="88696">
<caption>%format( "&4.1f", %if(%alarm( roar_2) != -1, %eval(%alarm( roar_2)/1000.0), 0))</caption>
</button>
<button name="Roar3" type="Separator" autosize="false" width="27" height="15" autopos="false" left="160" top="541" priority="88706">
<caption>%format( "&4.1f", %if(%alarm( roar_3) != -1, %eval(%alarm( roar_3)/1000.0), 0))</caption>
</button>
<button name="snarling" type="Separator" autosize="false" width="60" height="5" autopos="false" left="120" top="584" color="red" border="black" priority="134297"/>
<button type="Separator" autosize="false" width="60" height="15" autopos="false" left="120" top="571" priority="134521">
<caption>Snarling: @snarling</caption>
</button>
<button name="Time1" type="Separator" autosize="false" width="40" height="15" autopos="false" left="120" top="501" priority="430">
<caption>Time:</caption>
</button>
<button name="Time2" type="Separator" autosize="false" width="40" height="15" autopos="false" left="120" top="521" priority="416">
<caption>Time:</caption>
</button>
<button name="Time3" type="Separator" autosize="false" width="40" height="15" autopos="false" left="120" top="541" priority="411">
<caption>Time:</caption>
</button>
</cmud> |
|
|
|
![](templates/Classic/images/spacer.gif) |
Zugg MASTER
![](images/avatars/164475849040f41c23b22fe.gif)
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Apr 12, 2010 4:44 pm |
Well, I got a different error after typing "test" a bunch of times and then switching back and forth between the application window and my web browser, so maybe it is related. But I didn't get the same crash in the Button update routine.
It might also be a difference between XP and Windows 7 (which is what I'm using), so I'll also try to test this on XP and see what I can find.
However, in general you also have a threading issue in your script. Your #THREAD is modifying the @test_db variable. This action should be protected within a #SECTION command. Otherwise if you have multiple copies of your thread script running, they can interfere with each other. So your thread command should be:
Code: |
<alias name="test">
<value>#thread {
#99 {#99 {
#SECTION MySection {
#addkey test_db %i %j
#delkey test_db %i
}}}
#echo done
}</value>
</alias>
<var name="test_db" type="Record"/>
</window>
<alias name="test">
<value>#thread {
#99 {#99 {
#SECTION MySection {
#addkey test_db %i %j
#delkey test_db %i
}}}
#echo done
}</value>
</alias> |
|
|
|
![](templates/Classic/images/spacer.gif) |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Mon Apr 12, 2010 8:16 pm |
That's odd. I'm able to reproduce this almost every time now in a fresh session by importing the posted xml. Also, the error happens when only running the script once, so there are not multiple instances of it running. I'll give it a go on my Vista machine later today.
If someone else could try it out as well, I'd appreciate it. |
|
|
![](templates/Classic/images/spacer.gif) |
|
|
|
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
|
|