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

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



Hi Guys,

Sorry to bother you with a problem in an old release, but I'd
appreciate any hints on this one. I've got a pretty large piece of
software based on libevent-1.4.14b-stable, which usually is really
solid. But in one load test I got stuck in the while loop in
event.c:timeout_process():

936     while ((ev = min_heap_top(&base->timeheap))) {
937         if (evutil_timercmp(&ev->ev_timeout, &now, >))
938             break;
939
940         /* delete this event from the I/O queues */
941         event_del(ev);
942
943         event_debug(("timeout_process: call %p",
944              ev->ev_callback));
945         event_active(ev, EV_TIMEOUT, 1);
946     }

The if condition is never true, and on row 940
ev->base->event_count_active is 489, on row 942 it is 488 and then
after event_active it is 489 again. The argument to event_del and
event_active is always the same, so it's the same event object being
passed around all the time.

The ev->ev_flags is always EVLIST_INIT (0x80) and sometimes
EVLIST_ACTIVE (0x08). It is active when entering event_del(), but not
active when entering event_active. However, on line 992 in
event_queue_insert() called from event_active(), it is set to ACTIVE
again.

The clock on the computer is current time in Sweden, while
ev->ev_timeout {tv_sec = 50463, tv_usec = 458967}.

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?

Did anyone ever encounter this situation? I'd appreciate any help I can get.

All the best,
Daniel Janzon
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.