failures with "libev: ev_io_start called with corrupted watcher", ((WL)w)->next != (WL)w)

Marc Lehmann schmorp at schmorp.de
Wed Dec 17 13:16:07 CET 2014


On Sun, Dec 14, 2014 at 05:35:22PM -0800, Kirill Timofeev <kirill.timofeev at hulu.com> wrote:
> checked once again code and don't see where I could miss using
> ev_io_stop(). I would really appreciate if you would have a look at

Another common option is to call ev_init on active watcher memory, which
also corrupts it.

> unclear). Also please let me know if adding some logging can help.

Well, -DEV_VERIFY=3 would be a good first step, as that might catch the bug
earlier.

Anyways, I am not going to debug this for you, but questions you have to ask
yourself are things like "what keeps ds_schedule_flush from calling
ev_io_init on flush_watcher twice (without intervening stop)?".

In general, it's often easier to structure your program like this:

on job creation (e.g. connection):
- allocate watcher memory
- ev_xx_init them all

in between:
- call ev_xxx_stop/ev_xxx_set/ev_xxx_start as you wish, in that order

on job end/cancellatiopn etc:
- call ev_xxx_stop on all watchers
- free memory

This almost ensures that you get it right.

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