tmp triggers crash

Posted by Cloud on Sun 29 Dec 2002 05:19 PM — 14 posts, 46,426 views.

Czech Republic #0
I am not sure if this bug is in MC or in microsoft javascript, but I'll give it a try.

When I use following script MC crashes almost instantly. I am using Win2000 Pro where it just says MC has caused errors. I have also tried it under 98 where it gives error message:
MUSHCLIENT caused an invalid page fault in
module MUSHCLIENT.EXE at 015f:0042bff5.
Registers:
EAX=00000400 CS=015f EIP=0042bff5 EFLGS=00010246
EBX=00000000 SS=0167 ESP=007ef638 EBP=01582bdc
ECX=01582bdb DS=0167 ESI=01582bdc FS=4fdf
EDX=01582bdc ES=0167 EDI=00000000 GS=0000
Bytes at CS:EIP:
8b 4f 0c 89 5c 24 18 8b f1 89 5c 24 20 0b f0 c1
Stack dump:
01582be7 01582bdc 016730f0 00000000 ffffffff ffffffff 00000000 ffffffff 00000000 01582bdb 00000001 01672dd4 ffffffff 007ef6f0 0000002d 0000001e

The simplified part of the script that causes the crashes is:

/*<alias name="test1" script="test1" match="test1" enabled="y"/> */
function test1(thename, theoutput, wildcard) {
world.DeleteTemporaryTriggers();
}

/*<trigger custom_colour="2" enabled="y" match="In your dreams, or what?" name="test2" script="test2" sequence="100"/>*/
function test2(thename, theoutput, wildcard) {
world.addTrigger("test_trg","asdf","",1+1024+16384,1,0,"",""); // 32,8 doesn't matter, crashes anyways
}

When I enter "look;test1;look" (while sleeping to match the trigger) few times, it crashes. I tried in clean .mcl file on two different muds (circle and rom types), always the same. When in more complex situation the crash is not always immediate, but any line of input from mud causes number of error dialogues "Error executing regular expression". I suppose that it's one error for each regexp trigger. I hope it is connected with the above error, but I can't duplicate it without posting the entire script which wouldn't work on other computers or muds because it contains interfacing with my sql database and other non-portable parts.

I am using version 3.32.

Cloud
Australia Forum Administrator #1
I can't see offhand why it would crash, but in your full script you are not deleting temporary triggers from inside a temporary trigger are you? That would probably crash.
Czech Republic #2
ad full script: I haven't thought of that, but anyways I am not doint that. I just need to cleanup old spam of triggers at certain point and the cleanup itself is triggered by prompt, which is permanent.

The script I posted here crashes as is without any modifications (after you put the now-commented alias and trigger in their proper place in .mcl file). It took me several hours of commenting various lines and blocks of original code to find the cause and reduce it to this size, I just hope the errors have same cause.

Cloud
Australia #3
I've set up the triggers/aliases/functions listed here and I can confirm this behaviour. It happens when you repeatedly type test1;look in quick succession. If you do it slowly, say, once a second, everything works fine.

The first time it happened it crashed, the second time it came up with the 'Error executing regular expression' msgbox, then the third it crashed again.

If I spam in just look on its own very quickly nothing happens, so it is obviously an issue with the temporary trigger deletion.. it doesn't seem likely, but could it have something to do with deleting the temporary triggers extremely soon before or after the trigger/script fires?

Dave

-- Followup:

I just tested doing a world.AddTrigger() followed by a world.DeleteTemporaryTriggers() in the same function and I can cause this crash without the alias itself by causing the trigger to fire in quick succession.

Also, each AddTrigger is returning eOK, incase you were wondering.
Amended on Wed 01 Jan 2003 03:46 AM by Dave
Australia Forum Administrator #4
In AddTrigger are you adding temporary or normal triggers?
Australia #5
1 (eEnabled) + 1024 (eReplace) + 16384 (eTemporary)
Poland #6

I have similiar problem with crash Mushclient.

Ovvi
Australia Forum Administrator #7
If you delete temporary triggers from inside a temporary trigger I am not surprised it crashes. Deleting the trigger frees up the memory used by the script, and the script is currently executing. I would go about it a different way.
Australia #8
It's not being deleted in a temporary trigger. A temporary trigger is being created/deleted in a script executed by a permanent trigger.
Australia Forum Administrator #9
Hmm, I see. I don't have my development environment with me right now so I can't reproduce it, or if I could I can't see why it is happening. Could be a bug in temporary trigger deletion. :)
Czech Republic #10
It seems that you have your development environment with you as you released few new versions :) Still there is no information about this error.

In later versions (3.38) the error has changed a bit:
(using the same script as in my first note) now spamming few look;test1;look will just occasionaly show message box about error matching regular expression. The crash can be caused by 'look', then sometimes later /world.DeleteTemporaryTriggers() and then entering triggers configuration dialog - and this time it doesn't depend on time difference of the two actions (tried waiting about 10 seconds before deleting).

The reason I am reviving again this old thread is that in current version the same error message box about regular expressions, followed by a crash, started poping in script that worked fine in 3.32. I suspect that DeleteTemporaryAliases() is causing it this time, but I can't be sure because the error doesn't appear every time I run the function - most of the time it works fine.

Since the original error has not been fixed yet, it is probable that it has similar cause.

I hope that my description will help in finding and killing that damned bug - at least it includes a way how to reproduce the error.

Cloud
Australia Forum Administrator #11
I have found and fixed a bug in DeleteTemporaryTriggers and DeleteTemporaryAliases. Fixed in 3.39.

The problem was that MUSHclient internally maintains two lists for triggers and aliases - by name, and by sequence number.

When you did DeleteTemporaryTriggers in earlier versions it only deleted them from one list - accessing them from the other would very likely cause a crash or a message about bad regular expression.
#12
I had the same error problem, but under circumstances that I don't see the connection with. I had a trigger that was

'*** <charname> joins in, looking for some adventure.'

which played a sound.

Upon reading a note on that MUD's note system, I got the "Error executing regular expression message" and a section of the note was basically chopped out, and than after the output was done, the section was placed afterwards and I got the message again.

I'm just posting more because I figured I did something that I wasn't really supposed to, but I don't know for sure what. I've disabled the trigger and I am no longer having problems.
Australia Forum Administrator #13
One potential problem here is that the asterisk is a wildcard, and you have three in a row, which doesn't make a huge amount of sense.

You probably should have it as a regular expression, and escape out the wildcard, eg.

^\*\*\* <charname> joins in, looking for some adventure\.$