bug in epoll affecting libev

Marc Lehmann schmorp at schmorp.de
Mon Oct 27 12:08:34 CET 2008

On Mon, Oct 27, 2008 at 10:31:19AM +0100, Marc Lehmann <schmorp at schmorp.de> wrote:
> I just found another bug in epoll that libev (currently) does not work

It's verified, and the extent is much larger than previously assumed: on
SMP systems, busy servers can get hundreds of spurious event notificaitons
for different/already closed file descriptors. It doesn't happen on
uniprocessor systems (or when I disable all my extra cores).

The current CVS version of libev contains a workaround - it uses an 8-bit
generation counter to filter out those bogus events, which is likely
enough (even under bad conditions, the event generation counter was always
off by one at max).

Fortunately, the ANFD structure did have 8 bits left for this purpose.

If you have a busy daemon doing lots of connects and you get spurious
ready notifications during connect only with epoll, current CVS might fix
your problem.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list