Messages in this thread | | | Date | Tue, 25 Aug 2009 18:24:47 -0700 (PDT) | From | Davide Libenzi <> | Subject | Re: PROBLEM: Epoll frequently fails to notify connects at connect bursts |
| |
On Tue, 25 Aug 2009, Davide Libenzi wrote:
> On Wed, 26 Aug 2009, Will Brown wrote: > > > PLEASE CC: ME ON ANY REPLIES, thank you. > > > > *** 1. Epoll frequently fails to notify connects at connect bursts > > > > *** 2. Sometimes, when several connects come in quickly, epoll > > establishes tcp connections (according to 'netstat') but then fails to > > notify the application by returning from epoll_wait(). In those cases > > a subsequent connection or an EPOLLIN or EPOLLOUT event can cause a > > return from epoll_wait(), which then causes the previously ignored > > connection to be reported. But then the more recent event is not > > notified, the whole sequence lags and everything gets out of whack. > > The problems can easily be reproduced on my Ubuntu machine which runs > > a kernel version 2.6.28 using supplied test program. I also have a > > Ubuntu hosted in VMWare running a 2.6.27 version kernel, which appears > > to NOT have the same problem. > > Multiple quasi-simultaneous events for the same fd are merged. This is why > on POLLIN on accepting sockets you want to do something like: > > while ((afd = accept(sfd, ...)) != -1) > add_client(afd);
Of course, with sfd in non-blocking mode. Alternatively, you drop EPOLLET for the sfd socket.
- Davide
| |