lkml.org 
[lkml]   [2008]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: epoll behaviour after running out of descriptors
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. ;)


\
 
 \ /
  Last update: 2008-11-02 20:47    [W:0.063 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site