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
Araadan
Wanderer


Joined: 07 Jun 2009
Posts: 65

PostPosted: Wed Sep 29, 2010 4:59 am   

Oddities (CPU , Display) When Using Debugger
 
@Zugg
I activate script debuger when cmud eat my processor(cpu 90%, ram 650/700KB), but screen is empty until i dont push any key. Debuger and cmud appears normal but my cpu... ;)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Sep 29, 2010 5:02 pm   
 
Couple of things...

First off, it sounds like your describing a different issue altogether, so you should really be starting a new post. ( I went ahead and did this)
Second we need more information. When you started your debugger session were you online, offline?
Third, the Debugger is a reflection of the raw information CMUD receives and the results of it's various processing of that information.
Fourth, ensure that all messages are selected for displaying in the Debugger window (this is the default by the way).

If you have accounted for the above, then we will need to receive more information specific to your scenario.

For example: What version of CMUD are you running? What OS? Do you use any programs like WindowBlinds or RocketDock? Is the CPU still maxed with the debugger window closed? Does this problem occur in a blank session? What do you mean by the screen is empty? The debugger window? The main session window? You say it is empty until you don't push a key? What key are you pushing? What do you see when you stop pushing it?

Any and all information you can provide will help to narrow down and recreate this problem will be useful. Without more information, there's not much that can do to address it.
_________________
Asati di tempari!
Reply with quote
Araadan
Wanderer


Joined: 07 Jun 2009
Posts: 65

PostPosted: Sun Oct 03, 2010 3:04 pm   
 
Problem 1 : my horrible english :P
Problem 2 : cmud loops and hang off(CPU/RAM 99%) or crash(screen).



ad. 2. cmud current version - 3.29b(problem occur as of 3.23 version), windows xp pro sp3
cmud crashes when i loops it(not infinite loop!)
My script:
1 function return walkcost from X point to Y point.
2 function return @min_walkcost from loops @walkcost with stringlist
3 function return sorted list vnum from loops @min_walkcost

If in question walk is long(ex. .2s2w16s) and vnums list 10(or more), cmud hang off.

I use #LOCAL, #LOOP, #IF, #RETURN, #DELNITEM, #SWITCH.

PS. @Tech your topic title is wrong.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Oct 03, 2010 11:15 pm   
 
Thats the same identical type of error that I get and my CPU is pegged at 100% as well locking up CMUD. I'm also on Windows XP Pro sp3. Although the only looping I am doing in my settings is a recursive function to choose a random word that isn't the same as the last word chosen. I just wanted to point out that that's the same thing that happens with CMUD hanging and once in awhile that error pops up.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Oct 04, 2010 3:34 am   
 
Oldguy2, you said, "and once in awhile that error pops up." Is it the exact same as what Araadan posted, or just the same type.

Anyhow, the type of error display is consistent with a stack overflow. However the write address of 0x0E7F0FDC isn't. I also just checked a more detailed set of process information on CMudPro 3.30 and the execution address of 0x029924F8 didn't match up with any external module. Making this something will move about with each version, and even small compiling changes like a debug mode. While the speciific addresses don't relate perfectly for debugging they may still be helpful.

Please post updated details on this with the current version and anything you can figure about the causes for it.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Mon Oct 04, 2010 7:47 am   
 
Well I know that the address is not the same. I meant the same access violation program terminated error. I will try to get a screenshot next time.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Oct 04, 2010 4:29 pm   
 
"Access violation" is a very generic Windows error message. Only if the numbers in the error message match will it be the same error. Getting the error dialog without the "Send bug" buttons means that it was caused by an infinite loop in your script somewhere.
Reply with quote
Araadan
Wanderer


Joined: 07 Jun 2009
Posts: 65

PostPosted: Tue Oct 05, 2010 7:32 am   
 
Yesterday I update my cmud to 3,30b and problem still exist.
I try generate bug report.
Reply with quote
Araadan
Wanderer


Joined: 07 Jun 2009
Posts: 65

PostPosted: Tue Oct 05, 2010 8:52 am   
 


unfortunately, cmud menu(help->send) is block when it execute infinite loop. ;]



Uploaded with ImageShack.us

Code:
<func name="replacedir" id="1313">
  <value>#LOCAL ret
$ret = %1
#LOOP %numitems($ret) {
#IF (%item($ret,%i)=="k") {$ret = %replaceitem("sw",%i,$ret);#CONTINUE}
#IF (%item($ret,%i)=="l") {$ret = %replaceitem("se",%i,$ret);#CONTINUE}
#IF (%item($ret,%i)=="j") {$ret = %replaceitem("ne",%i,$ret);#CONTINUE}
#IF (%item($ret,%i)=="h") {$ret = %replaceitem("nw",%i,$ret);#CONTINUE}
}
#return $ret</value>
</func>

In this case, %1=rr|s|s|e|e|s|s|s|s|e|e|e|e|e|e|e|e|n|e|e|s|e|e|s|e|e|e|n|n|n|e|e|e|e|e|e|s|e|e|e|e|e|e|e|j|n|n|h|n|n|n|n|w|h|h|n|j|n|j|j|e|n|j|h|j|n|h|h|n|e|h|e|n|j|h

crash cmud ;)
#say @replacedir(rr|s|s|e|e|s|s|s|s|e|e|e|e|e|e|e|e|n|e|e|s|e|e|s|e|e|e|n|n|n|e|e|e|e|e|e|s|e|e|e|e|e|e|e|j|n|n|h|n|n|n|n|w|h|h|n|j|n|j|j|e|n|j|h|j|n|h|h|n|e|h|e|n|j|h)
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Oct 05, 2010 3:53 pm   
 
Confirmed! Good procedure! I have no idea what is causing it. First I thought it was caused by changing $ret within the loop that is based upon the %numitems($ret), but messing around with that didn't change anything, so maybe the problem is with #continue. In any case, since I have a way to reproduce it, I should be able to get it fixed when I get back. Maybe somebody else can play with this to come up with a workaround.

Thanks very much for helping with this.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Wed Oct 13, 2010 7:37 pm   
 
Well you don't need all that just to replace a few items. You only need to use replace.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="ReplaceDir" copy="yes">
    <value>$dirList = %replace($dirList,"k","sw")
$dirList = %replace($dirList,"l","se")
$dirList = %replace($dirList,"j","ne")
$dirList = %replace($dirList,"h","nw")
#return %list($dirList)</value>
    <arglist>$dirList</arglist>
  </func>
</cmud>


Code:
#print @replacedir(rr|s|s|e|e|s|s|s|s|e|e|e|e|e|e|e|e|n|e|e|s|e|e|s|e|e|e|n|n|n|e|e|e|e|e|e|s|e|e|e|e|e|e|e|j|n|n|h|n|n|n|n|w|h|h|n|j|n|j|j|e|n|j|h|j|n|h|h|n|e|h|e|n|j|h)


becomes

Code:
rr|s|s|e|e|s|s|s|s|e|e|e|e|e|e|e|e|n|e|e|s|e|e|s|e|e|e|n|n|n|e|e|e|e|e|e|s|e|e|e|e|e|e|e|ne|n|n|nw|n|n|n|n|w|nw|nw|n|ne|n|ne|ne|e|n|ne|nw|ne|n|nw|nw|n|e|nw|e|n|ne|nw
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Oct 13, 2010 8:20 pm   
 
One caveat to oldguy's suggestion is that it won't work if there are non-direction commands within the stringlist which contain h,j,k, or l.
In your example, you use "rr" in one command, so I assume that there may be other non-direction commands embedded as well.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu Oct 14, 2010 2:19 am   
 
Yes it will work. It does exactly what he was trying to do. The RR is irrelevant to what he was doing.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Oct 14, 2010 12:22 pm   
 
My point, oldguy, is that if instead of 'rr' he had a command like 'look' in his stringlist, your replace function would change that to 'seoosw'.
Reply with quote
Araadan
Wanderer


Joined: 07 Jun 2009
Posts: 65

PostPosted: Thu Oct 14, 2010 3:00 pm   
 
@oldguy2
custom portals?:>
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu Oct 14, 2010 7:28 pm   
 
Ah I see what you mean now. You could post something better. I was just trying to help out. Razz

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <func name="ReplaceDir" copy="yes">
    <value>#forall $dirList {
  #if (%i == "k") {$dirList = %replace($dirList,%i,"sw")}
  #if (%i == "l") {$dirList = %replace($dirList,%i,"se")}
  #if (%i == "j") {$dirList = %replace($dirList,%i,"ne")}
  #if (%i == "h") {$dirList = %replace($dirList,%i,"nw")}
  }
#return %list($dirList)</value>
    <arglist>$dirList</arglist>
  </func>
</cmud>
Reply with quote
Araadan
Wanderer


Joined: 07 Jun 2009
Posts: 65

PostPosted: Thu Oct 14, 2010 8:36 pm   
 
@oldgyu2
check this:
rr|e|e|d|k|l|portal_l_k_j_h|w|s|d


walkcost - roomcost, roomportal, custom portals/exits:
$vnum = %roomlink($vnum,%item($sciezka,%i))
or
$vnum = %item(%roomportal($vnum,%item($sciezka,%i)),2)


$walkc = $walkc +%roomcost($vnum)

need replaceitem ;]
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Oct 14, 2010 8:51 pm   
 
OK, I found the bug with %replaceitem. This bug can potentially cause an infinite loop with other list/table routines too. It really depended a lot on the actual data in the list/table and could cause the internal cached key table to get confused in some situations, resulting in either the infinite loop or potentially incorrect results.

I'm hoping this is the cause of all of the lockup problems, but we won't know until I can release the update, which probably won't be till next week. Depends upon how fast some other bug fixes go.

Btw, regarding optimizing your script, don't forget the new %ref function that allows you to modify a list "in place". Instead of doing:
Code:
$dirList = %replace($dirList, %i, "sw")

you can do this:
Code:
#call %replace(%ref($dirList), %i, "sw")

This is like using the name of a list instead of @list but works with local variables where there is no way to name it without the $ character. I think CMUD does already optimize your original code when it detects that you are assigning to the same variable that was modified, so it might not actually make things any faster, but it's better practice to be aware of when you can use "by reference" to help speed things up in the future.

Also, it would speed up your script to only access %item($ret,%i) once and put that into another local variable, then use the local variable in your #IF testing.
Reply with quote
Araadan
Wanderer


Joined: 07 Jun 2009
Posts: 65

PostPosted: Wed Oct 20, 2010 3:56 pm   
 
Excellent work @Zugg. Cmud uptime 4days 15 hours. :>
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Oct 20, 2010 5:19 pm   
 
Woot! Great to hear, thanks for letting me know.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Tue Nov 30, 2010 7:43 pm   
 
I can't seem to get your example to work Zugg.

You stated to use the following to optimize:

Code:
#call %replace(%ref($dirList), %i, "sw")


I tried the following:

Code:
$list = {A|B|C|D|E|F|G}
#call %replace(%ref($list), "A", "one")
#call %replace(%ref($list), "B", "two")
#call %replace(%ref($list), "C", "three")
#print $list


It printed A|B|C|D|E|F|G.

The following DOES work:

Code:
$list = {A|B|C|D|E|F|G}
$list = %replace(%ref($list), "A", "one")
$list = %replace(%ref($list), "B", "two")
$list = %replace(%ref($list), "C", "three")
#print $list
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