[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0908251823470.18518@makko.or.mcafeemobile.com>
Date: Tue, 25 Aug 2009 18:24:47 -0700 (PDT)
From: Davide Libenzi <davidel@...ilserver.org>
To: Will Brown <dr.hfuhruhurr@...il.com>
cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists