[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Infinite loop in libevent-1.4.14b-stable



On Thu, Mar 1, 2012 at 6:27 PM, Daniel Janzon <janzon@xxxxxxxxx> wrote:
> What I don't understand is why it is removed from
> base->activequeues[ev->ev_pri] in event_del() / event_queue_remove().
> I would have imagined it should have been removed from base->timeheap.
> So maybe the bug is that EVLIST_TIMEOUT is not set in event_del?

That sounds like an accurate diagnosis: if EVLIST_TIMEOUT is not set
on the event's ev_flags field, the event shouldn't be in the timeout
heap in the first place.

What's happening here is that the loop examines the top item of the
heap, checks whether its timeout has expired, and if so removes it
from all 'pending event' lists with the event_del and then activates
it.  But if the event doesn't have EVLIST_TIMEOUT set on it, we won't
look for it on the heap, so the next time through the loop, we'll find
the very same event.

Suggestions follow in next email.
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.