Re: [CODE][BUG] Missed Pulses.

From: Luis Pedro Passos Carvalho (lpcarvalho@SONAE.PT)
Date: 03/13/98


From: Matt Vail <ruins@GIBLETS.COM>

[snip]

>        My second problem, if it is a problem at all, is constant messages
>from the event handler.  It seems that in extract_char, it calls
>clean_events, to clear all events that involve that character.  And inside
>clean_events it checks to see if events are running at that time.  If so,
>it logs the message "Trying to remove events inside the handler.
>Attempting to continue."  In my syslog, I get alot of these in spurts.  I
>will get about 10 of these right in a row, at the same second.  Is that
>warning something that should not go unheeded or should I just comment it
>out?  If it is hazardous, what kind of problems could it cause and what
>could I do to fix it?


You could have a big problem there. I don't know what events you have
implemented, but in
one of them you are extracting chars or objects. The problem with this is
that you have a function, run_events wich is going through your list of
pending events. The function clean_events is run from within
run_events, but is does not know where in the list run_events is currently
in, therefore is has no way
of determining if deleting an event will make run_events go berserk. Thus
the warning.

Hmmm... let's see if i can make myself clearer.

run_events goes through the list of events one at a time, running the
function pointed by it if necessary.
Inside that function you extract a char or an object. In the extraction code
clean_events is called to
remove the events of that char/object. Now let us assume that you delete the
current event. The one being
executed.You then return to the event, and from there to run_event. When
going to the next event in the list, you no longer have any information on
the next event because the current one has already been deleted.
You can get garbage and cause segmentation fault or you can keep on going
with no problem at all. Nothing
is waranteed.

In order to fix it you could always avoid calling extract_char and
extract_object inside an event either
explicitly or implicitly (mob dying due to damage). That's the easy fix.

The other one is making clean_events/run_events be aware of each other in
order to be resistant to that
kind of ocurrence. I'll look into it this afternoon.

Happy mudding,

Luis Carvalho


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST