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

Re: [Libevent-users] Signals and priority queues



Hmmm...Well, your program works fine for me too, and I haven't succeeded in making it crash, so I suspect it is a bug in my code (which is what I expected). I configured with libevent debug enabled, but saw no output from libevent (the code still crashes as before). Is there anything else I need to set to get diagnostic output from libevent?

Haven't had any luck with valgrind catching something, but will try some other methods.

Thanks
Ralph

On Jan 4, 2012, at 10:28 AM, Nick Mathewson wrote:

> On Tue, Jan 3, 2012 at 6:45 PM, Ralph Castain <rhc@xxxxxxxxxxxx> wrote:
>> Hi folks
>> 
>> I'm trying to use libevent 2.0.13 with priorities, and am having a problem when signal events are defined. Basically, this is what I do:
>> 
>> 1. create an event base
>> 
>> 2. call event_base_priority_init(base, 8)
>> 
>> 3. event_assign(&event, base, SIGTERM, EV_SIGNAL|EV_PERSIST, cbfunc, &event)
>> 
>> 4. event_priority_set(&event, 1)
>> 
>> 5. event_add(&event, NULL)
>> 
>> This is accepted just fine. However, when I subsequently call event_base_free(base), libevent crashes:
>> 
>> 729                     struct event *next = TAILQ_NEXT(ev, ev_next);
>> (gdb) where
>> #0  0x0000000100157be2 in event_base_free (base=0x1003046f0) at event.c:729
>> 
>> 
>> Any ideas on what might be happening?
> 
> Not really.  I just tried to do  what you said you were doing above,
> and I can't reproduce the same problem with 2.0.16-stable.  I tried it
> again with Libevent 2.0.13-stable, and got the same result: worked
> fine.  I'm attaching my test code so you can see if you get different
> results.
> 
>> My program works fine (all other events cause no problem) so long as I remove these signal events. Do signal events not work with priority queues, at least in 2.0.13?
> 
> (First, a terminology aside: "priority queue" isn't what implements
> priorities in libevent.  A priority queue is just a kind of abstract
> data structure that we use to implement timeouts for events.)
> 
> But yeah, signals are supposed to work with event priorities, and in
> my (attached) test, it seems they do.  Something else might be going
> on here.
> 
> To try to debug this more, here are some ideas:
>  * Try to see if your code works when you turn on Libevent's debugging mode.
>  * See if valgrind (or a similar tool) finds any memory corruption issues
>  * Try to tweak my (attached) test so that it reproduces the crash
> you're seeing.
> 
> hoping this helps,
> -- 
> Nick
> <le-test.c>

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