From: "Gilad Benjamini" <gilad@altornetworks.com>
To: "'Davide Libenzi'" <davidel@xmailserver.org>
Cc: "'Linux Kernel Mailing List'" <linux-kernel@vger.kernel.org>
Subject: RE: epoll and closed file descriptors
Date: Wed, 16 Sep 2009 17:23:09 -0700 [thread overview]
Message-ID: <024601ca372d$09ad9fb0$1d08df10$@com> (raw)
In-Reply-To: <alpine.DEB.2.00.0909161656150.3124@makko.or.mcafeemobile.com>
Davide wrote:
> On Wed, 16 Sep 2009, Gilad Benjamini wrote:
>
> > I am running repeatedly into a scenario where epoll notifies
> userland of
> > events on a closed file descriptor.
> > I am running a single thread application, on a single CPU machine so
> > multiple threads isn't the issue.
> >
> > A sample set of events that I have seen
> > - File descriptor (13) for a socket is closed
> > - epoll_wait returns with no events.
> > - Several epoll related calls happen
> > - More than 20 seconds after the "close", epoll_wait finds an event
> on fd 13
> > with EPOLLIN|EPOLLERR|EPOLLHUP.
> > - epoll_wait continues to report this event
>
> Epoll removes the fd from its container, when the last instance of the
> underlying kernel file pointer is released (or when you explicitly
> remove it with epoll_ctl(EPOLL_CTL_DEL)).
> If you continue to get the event, it means that someone else has an
> instance of the socket (that, looking at the events, saw a shutdown)
> open,
> by hence keeping the kernel object alive.
> If you don't want to see the events, just remove the socket from the
> epoll
> set before closing.
> Or, you remove the socket the first time you see an EPOLLHUP.
>
>
>
> - Davide
I would, but epoll is preventing me from doing so.
Early in sys_epoll_ctl there are these lines
file = fget(epfd);
if (!file)
goto error_return;
Leaving me in a kind of dead lock
Gilad
next prev parent reply other threads:[~2009-09-17 0:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-16 23:22 Gilad Benjamini
2009-09-17 0:07 ` Davide Libenzi
2009-09-17 0:23 ` Gilad Benjamini [this message]
2009-09-17 0:28 ` Bryan Donlan
2009-09-17 0:30 ` Davide Libenzi
2009-09-17 0:40 ` Gilad Benjamini
2009-09-17 0:45 ` Bryan Donlan
2009-09-17 0:53 ` Gilad Benjamini
2009-09-17 0:57 ` Bryan Donlan
2009-09-17 0:55 ` Davide Libenzi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='024601ca372d$09ad9fb0$1d08df10$@com' \
--to=gilad@altornetworks.com \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®