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
ReedN
Wizard


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

PostPosted: Mon Mar 09, 2009 5:46 pm   

(Fixed) [3.04] Finally found reproducable code to freeze/lockup Cmud
 
Summary:

At long last I think I've found it. This has been most wanted #1 on my personal list for well over a year. Intermittent lockups that happen at random times and for no reason which I can detect.

While I was debugging a procedure to reproduce ansi capture strangeness I stumbled upon a simple sequence which will lockup Cmud every single time.

Procedure:
Code:

1) Start Cmud and create a new session named 'Test'.  Open 'Test' Off-line.
2) Save the xml code below to a file.
3) Open the Settings Editor and import the xml from the file you saved.

You'll now see a capture window called 'cap_win' appear when the import is finished.

4) At the command line for the main 'Test' window, type 'runme'.

CPU usage will spike and Cmud will be totally locked up.


Code:
Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<window name="Test" width="1091" height="853">
  <uid>{E4EB427A-81A9-4ACA-AEBA-4A578849F83F}</uid>
  <packages>English Keypad|English Directions|Clickable URLs|Test</packages>
  <class name="Test">
    <trigger priority="80" case="true" repeat="true" regex="true">
      <pattern>\b(@var1)\b</pattern>
      <value>#if (%ismember( %1, @var3)) {#cw blue,firebrick} {#cw blue,gray}</value>
    </trigger>
    <var name="var1" type="StringList" usedef="true"/>
    <var name="var2" type="StringList">Four|Five|Six</var>
    <var name="var3" type="StringList">One|Four</var>
    <trigger priority="80" case="true" repeat="true" regex="true">
      <pattern>\b(@var2)\b</pattern>
      <value>#if (%ismember( %1, @var3)) {#cw green,firebrick} {#cw green,gray}</value>
    </trigger>
    <trigger priority="130" case="true" regex="true">
      <pattern>^Line with [A-Z][a-z]+ and [A-Z][a-z]+</pattern>
      <value>#gag
#cap cap_win</value>
    </trigger>
    <alias name="runme">
      <value>#show Line with One and None
#show Line with Two and None
#show Line with Three and None
#show Line with Four and None
#show Line with Five and None
#show Line with Six and None
#show Line with One and One
#show Line with One and Two
#show Line with One and Three
#show Line with One and Four
#show Line with One and Five
#show Line with One and Six</value>
    </alias>
  </class>
</window>
<window name="cap_win" dockalign="Top" host="none">
  <uid>{FAD4BD2E-AD4F-41B2-8332-C7315CCD5E09}</uid>
  <dockuid>{E4EB427A-81A9-4ACA-AEBA-4A578849F83F}</dockuid>
</window>
</cmud>


Last edited by ReedN on Sat Apr 18, 2009 7:16 pm; edited 1 time in total
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Mar 09, 2009 6:53 pm   
 
The problem is with your \b(@var1)\b trigger. Your @var1 variable is empty. So this gives a regular expression of \b\b, which I believe causes an infinite loop in the regex tester. Nothing I can do about that one.
Reply with quote
ReedN
Wizard


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

PostPosted: Mon Mar 09, 2009 7:13 pm   
 
Hmm. The variable @var1 one was "One|Two|Three". I'm not sure how it lost its value, but I agree with your assessment in your post. I'll have to play around with it some more to see how the variable lost its value seemingly by itself.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Mar 09, 2009 7:18 pm   
 
Looks like "UseDef=true" is clearing the value of @var1 and preventing any changes to it from being saved.
Reply with quote
ReedN
Wizard


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

PostPosted: Mon Mar 09, 2009 7:26 pm   
 
Yep, that would do it. I was playing around with buttons earlier when I was reading another post about defaults and I must have inadvertently set it to use default without realizing it. How embarrassing.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Mar 09, 2009 9:39 pm   
 
A pattern of "\b\b" shouldn't cause a lockup. I will do some testing with it and see if I can find a way to improve the PCRE.dll to handle this. If I can't figure it out I will report it to the PCRE author.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
ReedN
Wizard


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

PostPosted: Mon Mar 09, 2009 10:42 pm   
 
Vijilante: Very interesting, I'm interested in the results of your testing. Until Zugg pointed out I had a null variable, I was so sure I had finally nailed my lockup bug. The lockup response was so similar in so many ways, ie the way Cmud froze and the way the CPU utilization ramped up... Alas, but then again if PCRE.dll shouldn't lockup on this then perhaps it may be related in some way.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Mon Mar 09, 2009 10:54 pm   
 
I'm interested in the results as well: \b\b is the pattern my regex generating function may produce under certain conditions. Can "\bcharacters\b\b" pattern be cause of such a lockup as well?
Reply with quote
ReedN
Wizard


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

PostPosted: Tue Mar 24, 2009 2:22 pm   
 
Vijilante wrote:
A pattern of "\b\b" shouldn't cause a lockup. I will do some testing with it and see if I can find a way to improve the PCRE.dll to handle this. If I can't figure it out I will report it to the PCRE author.

Were you able to find an answer for why it was causing a lockup Vijilante?

Since I switched the trigger to a form that can't accidentally have "\b\b", I haven't had a single lockup. It's not conclusive proof that this was causing it, but 15 days without a lockup is pointing very strongly to this being a factor.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Mar 24, 2009 7:29 pm   
 
Thanks for reminding me. I checked it in a seperate app as well as CMud3.05 and didn't get a lockup.
At the command line
Code:
#SHOW %subregex("The quick brown fox jumped over the lazy dog.","\b\b","x")


A trigger to test it specifically
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="10" regex="true" copy="yes">
    <pattern>\b\b</pattern>
    <value>#PRINT Matched</value>
  </trigger>
</cmud>


And a trigger with variable
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="bad" type="StringList" copy="yes"/>
  <trigger priority="20" copy="yes">
    <pattern>%q({@bad})%q</pattern>
    <value>#PRINT Matched2</value>
  </trigger>
</cmud>

I couldn't get any to lock up using "#SHOW a b" at the command line. Since your experience would indicate it was the cause of your lockups I would suggest trying to devlop a procedure that can replicate it.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
ReedN
Wizard


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

PostPosted: Wed Mar 25, 2009 12:19 am   
 
Vijilante wrote:

I couldn't get any to lock up using "#SHOW a b" at the command line. Since your experience would indicate it was the cause of your lockups I would suggest trying to devlop a procedure that can replicate it.


Zugg wrote:
The problem is with your \b(@var1)\b trigger. Your @var1 variable is empty. So this gives a regular expression of \b\b, which I believe causes an infinite loop in the regex tester. Nothing I can do about that one.


The code to lock up Cmud is already there (right at the start of this post). Zugg says that having an empty list and \b\b will cause a lockup in the regex tester. Vijilante says the problem isn't in the regex engine because it works fine in another app. If Vijilante indeed accurately replicated this in another application then it seems like the bug is likely centered in Cmud.

Zugg: Could you take another look at this?
Reply with quote
ReedN
Wizard


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

PostPosted: Wed Mar 25, 2009 12:47 am   
 
I just re-verified my original procedure still works on the latest version 3.05.

Vijilante: Did you follow my procedure exactly?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Mar 26, 2009 9:53 am   
 
Found it.

Procedure
1. Launch CMud
2. Close Sessions Window (ESC)
3. Open Package Editor (CTRL-G)
4. Paste into the tree panel of the PE
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="bad" type="StringList" copy="yes"/>
  <trigger priority="20" copy="yes">
    <pattern>%q({@bad})%q</pattern>
    <value>#PRINT Matched2</value>
  </trigger>
</cmud>

5. Enter at the command line
Code:
#SHOW a b

6. Set the repeat flag for the trigger and save
7. Enter at the command line
Code:
#SHOW a b


It is the combination of a pattern that returns a 0 width match and the repeat flag. My suggestion for fixing it easily would be to use the repeated match function that %subregex employs. It was specifically designed with 0 width matches in mind.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
ReedN
Wizard


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

PostPosted: Thu Mar 26, 2009 2:06 pm   
 
Vijilante: Thanks for helping debug this. Is this a bug in the regex engine or in Cmud?
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Mar 26, 2009 5:01 pm   
 
I think it's actually a CMUD bug. The #CW command in your original test is actually doing a "repeat" of the trigger pattern, and it might not be checking for an infinite loop with a zero-width match. I've added this to the bug list to see if it's something I can fix within the internal trigger "repeat" flag code.

Vijilante: Thanks for verifying that it's not hanging in the actual PCRE code.
Reply with quote
ReedN
Wizard


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

PostPosted: Sat Apr 18, 2009 4:19 pm   
 
Confirmed fixed 3.06 (Fixed hang when using a zero-width pattern in a trigger marked with the Repeat option, or with the #CW and #SUB commands (which internally repeat))
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