Messages in this thread | | | Date | Sun, 2 Nov 2008 20:15:57 +0100 | From | "Olaf van der Spek" <> | Subject | Re: 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. ;)
| |