bug in epoll affecting libev

Marc Lehmann schmorp at schmorp.de
Mon Oct 27 10:31:19 CET 2008


I just found another bug in epoll that libev (currently) does not work
around: epoll_wait sometimes returns readyness notifications for the
"an older" fd - when an fd gets closed and a new one gets allocated, a
subsequent epoll_wait might receive a spurious readyness notification for
that fd.

This has already been noted in the documentatioon, unfortunately, I found
a case where this is hard to work around: when one does a non-blockign
connect on an fd one cannot find out easily whether the "writable"
indicates a connect error or is just a spurious notification.

This is just a heads-up, I will probably implement a simple generation
counter using the unused 8 bits in the ANFD structure to work around this
bug.

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