mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Olaf van der Spek" <olafvdspek@gmail.com>
To: "Eric Dumazet" <dada1@cosmosbay.com>
Cc: "Davide Libenzi" <davidel@xmailserver.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: epoll behaviour after running out of descriptors
Date: Sun, 2 Nov 2008 20:15:57 +0100	[thread overview]
Message-ID: <b2cc26e40811021115h1bf711c7i2b220a92f7cf1abc@mail.gmail.com> (raw)
In-Reply-To: <490DFB2D.3090906@cosmosbay.com>

On Sun, Nov 2, 2008 at 8:10 PM, Eric Dumazet <dada1@cosmosbay.com> wrote:
> On listen queue, socket is still ready for an accept().

True, but not handy.

> Since you use edge trigered epoll, you'll only reveive new notification.

The strace shows I receive 10+.
If a return with EMFILE is indeed a no-op, I should receive only one.

> You probably had in you app a : listen(sock, 10), so after 10 notifications,
> your listen queue is full and TCP stack refuses to handle new connections.

I've got listen(l, SOMAXCONN);
IIRC SOMAXCONN is 128.

>  close(newfd); /* forget this incoming connection, we dont have enough fd */

Why not keep them in the queue until you do have enough descriptors?

> Of course, if your application is multi-threaded, you might adapt (and
> eventually reserve
> one emergency fd per thread)

Sounds like a great recipe for race conditions. ;)

  reply	other threads:[~2008-11-02 19:45 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 [this message]
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
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=b2cc26e40811021115h1bf711c7i2b220a92f7cf1abc@mail.gmail.com \
    --to=olafvdspek@gmail.com \
    --cc=dada1@cosmosbay.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®