 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Nov 18, 2007 4:22 am
[2.12] 100% usage lock |
Also this debugger log show a bug in the debugger with repesct to variable changes. I get this lock with debugger window closed as well as open. Interestingly the lock resolves itself after quite a few minutes of doing nothing that shows up in the log.
| Code: |
10:53:56.640p | ---
10:53:56.640p | c AchaeaMa |[5] AchaeaMain Comline : start : #SHOW @addbalance(STUN)@PQueueFlags;usebalance STUN ;#SHO...
10:53:56.650p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|NS|cs|CC|cf|CY|CT|ca|ce|CRE|CK|CO|CI|CN"
10:53:56.650p | k AchaeaMa | [5] Var "UsingBalance" changed from "" to "STUN"
10:53:56.650p | k AchaeaMa | [5] Var "PQueueFlags" changed from "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.650p | a AchaeaMa |1e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN
10:53:56.720p | l AchaeaMa | Alias "UseBalance" compiled (Normal) : #IF (%1="compile") {#RETURN 1} #IF (%1="") {#RETURN 1} #D...
10:53:56.720p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.720p | k AchaeaMa | [5] Var "UsingBalance" changed from "" to "STUN"
10:53:56.720p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.730p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.730p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.730p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.730p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.730p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.730p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.730p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.740p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.740p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.740p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.740p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.740p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.740p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.740p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:53:56.750p | k AchaeaMa | [5] Var "PQueueFlags" changed from "" to "e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|STUN"
10:59:02.279p | a AchaeaMa |e|b|l|r|x|s0|m|pb|ab|sb|hb|T|V|nw|A|S|NS|cs|CC|cf|CY|CT|ca|ce|CRE|CK|CO|CI|CN
10:59:02.289p | d AchaeaMa |[5] AchaeaMain Comline : stopped |
The alias that is having this lockup is a very big #SWITCH, and the STUN code that I used forces most of the flags in the variable to be reset. The part of the command line that was cut off is #SHOWing the variable PQueueFlags, and you can that result appears 5 minutes after the last variable change. After the last #ADDITEM that occured there are 2 more flag checks that are similar to the other 20 it did. Neither of which are passed in this test and then the it should be jumping to the end of the #SWITCH.
I am rather confused as to the cause of this since the AddBalance function is also a similarly huge #SWITCH and that one has no problems with moving along. Basically it seems that nothing is happening for those 5 minutes. I will split off the aliases, functions, and variables into another package; and if it does the same in that package then it will be emailed shortly. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Nov 18, 2007 4:34 am |
Ok seperate package still shows the problem. To have it occur use this procedure
1. Launch CMud
2. Close Sessions window (ESC)
3. Open Package Editor (CTRL-G)
4. Select File|Open from the PE menu
5. Navigate to and open the CpuLockUp212.pkg
6. Enter at the command line
After you get bored with that lock up you can make it worse by proceeding with the following steps.
7. Press ESC to get control of the command line back (still pegging the CPU)
8. Enter
If you did these you will find CMud is now almost completely locked, and the CPU is still pegged. I found the only thing that still responds is right-click on the task bar icon. You can then select close there and be satisfied that CMud obeys. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Nov 21, 2007 8:48 pm |
Bah. OK, this was a real pain. Vijilante, that's one of the most complex scripts I have seen in a long time. It took me about 3 hours just to step through it to find out what was causing the hang.
The hang is caused by one of your calls to %regex in your @issubset function. When it hangs, the pattern is:
| Code: |
| (?:(?:-p-|-e-|-x-)(?:(?!-p-|-e-|-x-)-.*?-)*){3} |
and the source string is
| Code: |
| -e--b--l--r--x--s0--m--pb--ab--sb--hb--T--V--nw--A--S--cs--CC--cf--CY--CT--ca--ce--CRE--CK--CO--CI--CN- |
When CMUD calls the PCRE (Perl regular expression engine), the call to Match(pattern,source) never returns. So the infinite loop that is using 100% CPU is in the PCRE routines somewhere (which I do not have the source code to).
Now, I'm no expert on regular expressions, so maybe someone can look at your pattern and tell you why it's bad.
But, this isn't a bug in CMUD. CMUD was doing exactly what it should...it was waiting for your user-defined function to return a result. I don't have any control over the PCRE code, so there isn't anything I can do about this one. There isn't even any way I can trap it...it's not raising any sort of exception...it's just stuck in a loop somewhere in the regex matching routines.
(8) Using #STOP is going to hang badly because #STOP waits for the thread to terminate. Since the thread is stuck in an infinite loop in the PCRE routines, it never terminates. So now #STOP is hanging waiting for the thread to terminate. Again, nothing I can do about this. There isn't any good way to force a thread to terminate when it's hung like this. (well, there are really ugly ways to force a thread to abort, but it takes more permissions than a typical Vista user will have, so I'm not doing that). |
|
|
|
 |
Rorso Wizard
Joined: 14 Oct 2000 Posts: 1368
|
Posted: Wed Nov 21, 2007 10:10 pm |
| Zugg wrote: |
Bah. OK, this was a real pain. Vijilante, that's one of the most complex scripts I have seen in a long time. It took me about 3 hours just to step through it to find out what was causing the hang.
The hang is caused by one of your calls to %regex in your @issubset function. |
Actually it doesn't appear to hang. It just process the input very slowly. Eventually it does return.
The test script I used is:
#show %regex("-e--b--l--r--x--s0--m--pb--ab--sb--hb--T--V--nw--A--S--cs--CC--cf--CY--CT--ca--ce--CRE--","(?:(?:-p-|-e-|-x-)(?:(?!-p-|-e-|-x-)-.*?-)*){3}")
Edit: Does the regexp package compress the state machine? |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Wed Nov 21, 2007 11:11 pm |
I am sorry you wasted 3 hours of good programming time to find it is a problem in the regex. I went to that form of regex after a fair amount of testing to determine that it was consitently faster than the reverse logic form I was using. Which is more or less supported by at least 20 other usages of that regex that don't fail. I guess I will have to tweak around with the regex a lot more.
It is very good to have a better understanding how #STOP works and doesn't. Thank you for explaining that. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
|
|
|