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

Re: [Libevent-users] Assertion in event_base_free



On Sun, Dec 06, 2009 at 01:36:27AM +0000, Matthew Wild wrote:
> Hi all,
> 
> I'm getting the following assertion fail when my application shuts down:
> 
>    event.c:241: event_base_free: Assertion
> `((&base->timetree)->rbh_root == ((void *)0))' failed.
> 
> Now from what I can gather in the source, it is trying to make sure
> there are no timers still active?

What version are you using?  This issue was fixed in November of 2007, 
and should be resolved in every version of Libevent 1.4.x.

> If this is the case, is there a way to easily close all timers?

Upgrade.  In 1.4.x and later, calling event_base_free() will call
event_del() on every pending event.

> Otherwise, what do people usually do to shut down a libevent
> application cleanly? Must I track all timers and close manually?

If you can't upgrade to 1.4.x, your easiest choice is not to call
event_base_free() at all on shutdown.  (Yes, it's ugly, but it won't
actually hurt anything.)  The only other approach, if for some reason
you can't require a version newer than 1.3e, is indeed to call
event_del() on every pending event yourself.

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