Re: PROBLEM: Epoll frequently fails to notify connects at connectbursts

From: Davide Libenzi
Date: Tue Aug 25 2009 - 21:15:24 EST

On Wed, 26 Aug 2009, Will Brown wrote:

> *** 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)

- Davide

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at