[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] infinite loop in evmap_io_active
- To: libevent-users@xxxxxxxx
- Subject: [Libevent-users] infinite loop in evmap_io_active
- From: Mike Cui <cuicui@xxxxxxxxx>
- Date: Mon, 11 Apr 2011 03:34:10 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Mon, 11 Apr 2011 06:34:15 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=6L1KHTjf8KwcuFSb57vaTGg/eXCHEqOdXPgeuaXWufU=; b=NTAV2gBW/iDWulL6KG2PCsm9ZEqb8M8nYkBp7wsSpUcoBBbTrObryNL4o3CwmZzszU 7azeqCa0x1PmKdPhxeoVMAzW0P8WcXoUocqFujQa0EVrCRS+NtjzpO4kpQ5O604M5b/7 bA1pfJuD7IDDJaRSkodE9b07S0S8WXt5G58Wo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=hxgtTQDuYwAr0quxH2pusnZ1mwHrQSN8YBL6sX/1UglnfychddXl0oqe2/ZpVx9HVj L5tr9Sum7j/UilE3Iv3GD+wsr10NUqFjLfzMeLyjES+rfYO7bvs7nQRP7WVWatTvDPT1 fCtn1UkUAznKzn5mJmdPtEva2XvgaO0iIMPwo=
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
I'm also seeing an infinite loop in evmap_io_active:
TAILQ_FOREACH(ev, &ctx->events, ev_io_next) {
if (ev->ev_events & events)
event_active_nolock(ev, ev->ev_events & events, 1);
}
It looks like the ev_io_next pointer points back to itself :(
Here is a disassembly of that loop:
0x280ab670 <evmap_io_active+64>: mov 0x20(%esi),%esi
0x280ab673 <evmap_io_active+67>: test %esi,%esi
0x280ab675 <evmap_io_active+69>: je 0x280ab69d <evmap_io_active+109>
0x280ab677 <evmap_io_active+71>: mov 0x30(%esi),%eax
0x280ab67a <evmap_io_active+74>: and %edi,%eax
0x280ab67c <evmap_io_active+76>: cwtl
0x280ab67d <evmap_io_active+77>: test %eax,%eax
0x280ab67f <evmap_io_active+79>: je 0x280ab670 <evmap_io_active+64>
And here is what I see from GDB (%esi points to ev, and (%esi + 0x20)
is ev_io_next):
(gdb) p/x $esi
$2 = 0x2835fad0
(gdb) p/x *(void **)($esi + 0x20)
$3 = 0x2835fad0
I guess that would happen if I added the same event twice? But I'm not
doing that. Here is the pattern of event_add() and event_callbacks()
for each fd and struct ev * that I add. I'm adding events as EV_READ
or EV_WRITE, not EV_PERSIST, and with no timeout:
event_add(fd=9, ev=0x2831fec0)
event_callback(fd=9, ev=0x2831fec0)
event_add(fd=9, ev=0x2831fec0)
event_add(fd=11, ev=0x2833dcd0)
event_callback(fd=11, ev=0x2833dcd0)
event_add(fd=11, ev=0x2835fad0)
event_add(fd=10, ev=0x2833da80)
event_callback(fd=10, ev=0x2833da80)
event_add(fd=10, ev=0x2833da80)
event_callback(fd=11, ev=0x2835fad0)
event_add(fd=11, ev=0x2835fad0)
What am I doing wrong here? The only thing I can think of is that it
might not be OK to re-add the same event in the callback? But I copied
this code right out of event-test.c.
My program is single threaded, and I can deterministically get it
stuck in this state immediately using just one connection.
Thanks for your help!
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.