libev release candidate

Marc Lehmann schmorp at schmorp.de
Thu Jan 2 04:06:36 CET 2014


On Tue, Dec 31, 2013 at 04:16:31AM +0000, Marcus Chuang <fuyuan.chuang at gmail.com> wrote:
> > Phew, thanks a lot. Two bugs in such simple code :/
> 
> I have a similar case while using libev-4.15. I found libev sometimes didn't 
> notify me when one socket is readable in "multiple" connections. Thus, I tried 
> to turn on debugging(set EV_VERIFY to 3), then I got this assert message:
> 
> ev.c:205: verify_watcher: Assertion `("libev: pending watcher not on pending 
> queue", ((loop)->pendings) [(((W)w)->priority - (((0x7f) & 4) ? -2 : 0))][w-
> >pending - 1].w == w)' failed.
> 
> This assert message is not happened in only one connection. Is my or libev's 
> bug? Thanks for your reply.

You can't say from the message itself, but from experience, it's very
unlikely that the bug is in libev (the asserts have never caught a bug in
libev before).

What this particular assertion failure means is that a watcher is in
pending state, but libev doesn't know about that (it's not on the pending
list where it has to be).

It's hard to say what that causes, but the primary reason for any kind of
corruption like this is reusing the watcher memory (moving it, modifying
it, initialiasing it, freeing it etc.) while the watcher is still active
(pending or started).

The safe way is to make sure the watcher is stopped explicitly before any
kind of modification is attempted.

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



More information about the libev mailing list