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

Re: [Libevent-users] Deadlock driving me nuts



Sorry about the late reply.

I'm not very good with gdb. Actually I'm just a beginner with gdb.

To generate the above trace I first waited for a deadlock to occur. I then killed the process using "kill -6 <pid>" to force the process to dump core. I then opened the core file using gdb and ran the command "thread apply all where"

I'll try to figure out how it's done, if not I'll just add some log messages to evmap.c to log the values of base & ev on each loop and just use event_set_log_callback to log this to a file :S

Thanks

Sherif

On Sat, Apr 9, 2011 at 2:58 PM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
On Sat, Apr 9, 2011 at 4:16 AM, Sherif Fanous <sherif.fanous@xxxxxxxxx> wrote:
> As a matter of fact, the thread in question is usually stuck in
> event_active_nolock.
> The funny thing is that it shows that it's stuck in line 2212 in event.c
> which is the opening brace of the function.
> How would I walk through ctx->events?

So, having a look at the TAILQ_FOREACH definition, it's going to unpack to:

   for (ev = TAILQ_FIRST(&ctx->events);
       ev != TALQ_END(&ctx->events);
       ev = TAILQ_NEXT(ev, ev_io_next) {

and that's going to turn into:

   for (ev = ctx->events.tqh_first;
       ev != NULL;
       ev = ev->ev_io_next.tqe_next) {

So, given those stack traces, I assume you're using gdb.  Start with
ctx->events.tqh_first, then look at the ev_io_next.tqe_next field of
that, then the ev_io_next.tqe_next field of that, etc, until you get a
repeat or a NULL or something that looks crazy.

hth,
--
Nick