[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] libevent2 and delete-after-close with kqueue
- To: libevent-users@xxxxxxxx
- Subject: [Libevent-users] libevent2 and delete-after-close with kqueue
- From: Adrian Chadd <adrian@xxxxxxxxxxxxxxx>
- Date: Sat, 7 Jun 2014 15:41:13 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Sat, 07 Jun 2014 15:41:16 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=gAgXbSvla7HPmTq/ck1mFJriKHoh5AJ/9q5GyN8Rd/E=; b=ueMvWr9/xC7QXqa5Qm6/mFwV9X5XYOtO9byqQ4C6KoEO+5ddX3gGUuOby6mPWN9Dfb sFSPwUh2TchnM/Iw5CerBkdzoGhuvwfdX/0cnVVBwr1I3SD42HIQ1P8CfgsffIt2Ej7r uPE8Ty3jBDYLZVtini585wlhx3XtMDcFuxdzY3Hi9k0icAU16uo5kx6e92Ngq64zQHal 4Z/9wuJU6dAMc9kD8z39hJGKcFxAayXGggU9pMUy6Yio/TkQBSDGe6r/n7R6ABKSG/wx 9TXivdfZW57flPUK8quvHORXmWegYCYvaDhO8rb7O0U9vQkCW7gCJVE+sOvcG97udhO+ YFKA==
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
Hi all,
I'm trying to chase down a bug with libevent2-trunk.
The TL;DR is that I have ktrace traces from FreeBSD showing that an FD
delete event is being kqueued to a kqueue FD after the FD has been
closed in that thread. It's responsible for ENOTCAPABLE showing up.
Something like EBADF just drops through; ENOTCAPABLE currently causes
the IO loop to terminate. This is with a multi-threaded server, but
there's one event base per thread and one accept FD per event base.
It _looks_ like the evhttp / bufferevent code is doing the right thing
- ie, it's deleting the events (which should delete them from the
kqueue list) before calling close(). But there's a bunch of places
that I have to actually go and check. Unfortunately "EV_DELETE"
entries are being left on the kqueue list and not removed. The only
way to know that these need to be removed is to actually call the
event deletion function from evutil.c when the socket is closed.
Teaching evutil_closesocket() would do it, but it would require an
eventbase. It also implies that a socket is only in one event base -
it's quite possible servers have an FD in multiple event bases. Ugh.
What do people think?
-a
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.