On Sun, 2022-08-28 at 16:31 +0200, Marc Lehmann wrote:
> On Sat, Aug 27, 2022 at 09:09:10PM +0530, Mushtaq Khan
> <mushtaqk.e...@gmail.com> wrote:
> > I see a segmentation fault ev_feed_event() called from
> > timer_reify(). I
> > used to see this issue intermittently now i see this quite
> > consistently in
> > my work environment.
> 
> Most likely you are seeing the result of memory corruption due to a
> bug
> elsewhere in your program, e.g. from a data race between threads,
> reusing
> memory of active watchers or something like that.
> 
> This can be difficult to track down - you can compile libev using
> -DEV_VERIFY=2 to enable very frequent checks of its data structures -
> this
> has a good chance of triggering an abor earlier, but especially data
> races
> can be hard to track down - make sure you lock your loops properly
> when using
> them in different threads, for example.
> 
I just wanted to report that I did experience more or less the same
issue:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fbdd97d6945 in ev_feed_event () from /usr/lib/libev.so.4
[Current thread is 1 (Thread 0x7fbdd70a46c0 (LWP 32580))]
(gdb) where
#0  0x00007fbdd97d6945 in ev_feed_event () from /usr/lib/libev.so.4
#1  0x00007fbdd97d7d32 in ev_run () from /usr/lib/libev.so.4

I have not much more info that the call stack because the libev lib has
been stripped out of any debug info.

I will for sure run my program with -fsanitize=address to rule out
memory corruption...

but beside that, I have a hard time figuring out what could cause a
segv into that small function...

- if realloc was failing, SIGABORT would be triggered.
- it cannot be watcher pointer since in the ev_run context, it is set
to &pipe_w
- invalid w_->pending

As a side note, I think that the assert text should be:
"libev: pipe_w not active, but pipe written"

An exceptional occurence but theoritically possible is the following:

ev_async_send() is called by another thread while the loop thread is
processing pending watchers and one of these watchers is calling
ev_async_stop() on the pending async watcher...

I am currently studying libev code to convince myself that libev code
handle correctly this case...

thank you chiming in if you can help me with my segv... I'll report
back here if I find something in the lib...

Greetings,


_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev

Reply via email to