mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Olaf van der Spek <olafvdspek@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: epoll behaviour after running out of descriptors
Date: Sun, 2 Nov 2008 14:49:41 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0811021445260.9451@alien.or.mcafeemobile.com> (raw)
In-Reply-To: <b2cc26e40811021417o38f9b171ka669961d93b9025c@mail.gmail.com>

On Sun, 2 Nov 2008, Olaf van der Spek wrote:

> On Sun, Nov 2, 2008 at 10:17 PM, Davide Libenzi <davidel@xmailserver.org> wrote:
> >> Wouldn't the port space require about 20+ k connects? This issue
> >> happens after 1 k.
> >
> > The reason for "When accept returns EMFILE, I call epoll_wait and accept
> > and it returns with another EMFILE." is because your sockets-close logic
> > is broken.
> 
> It's not broken, it's designed that way. It's designed to hit the
> descriptor limit and then close all sockets some time after.
> 
> > You get an event for the listening fd, you go call accept(2)
> > and in one or two passes you fill up the avail fd space, then you go back
> > calling epoll_wait(), and yet back to accept(2). This w/out triggering the
> > file-close-relief code (yes, you fill up 1K fds *before* 30 seconds). Of
> > course you get another EMFILE.
> 
> The second EMFILE doesn't make sense, epoll_wait shouldn't signal the
> socket as ready again, right?

At the time of the first EMFILE, you've filled up the fd space, but not 
the kernel listen backlog. Additions to the backlog, triggers new events, 
that you see after the first EMFILE. At a given point, the backlog is 
full, so no new half connections are dropped in there, so no new events 
are generated.
Again, sleeping on (EMFILE && ET) is bad mojo, and nowhere is written that 
events should be generated in the EMFILE->no-EMFILE transitions.



- Davide



  reply	other threads:[~2008-11-02 22:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-01 16:38 Olaf van der Spek
2008-11-02 18:25 ` Davide Libenzi
2008-11-02 18:33   ` Olaf van der Spek
2008-11-02 18:48     ` Davide Libenzi
2008-11-02 18:51       ` Olaf van der Spek
2008-11-02 19:10         ` Eric Dumazet
2008-11-02 19:15           ` Olaf van der Spek
2008-11-02 19:17         ` Davide Libenzi
2008-11-02 19:20           ` Olaf van der Spek
2008-11-02 19:27             ` Davide Libenzi
2008-11-02 20:41               ` Olaf van der Spek
2008-11-02 21:17                 ` Davide Libenzi
2008-11-02 22:17                   ` Olaf van der Spek
2008-11-02 22:49                     ` Davide Libenzi [this message]
2008-11-03  8:07                       ` Olaf van der Spek

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=Pine.LNX.4.64.0811021445260.9451@alien.or.mcafeemobile.com \
    --to=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olafvdspek@gmail.com \
    /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®