Coro segfault

Marc Lehmann schmorp at schmorp.de
Fri Mar 21 12:05:44 CET 2014


I cannot reproduce your problem with either 5.14.4 or 5.18.1.

Note that your perl version is no longer officially supported (by perl
upstream), although it is supported by Coro.

On Fri, Mar 21, 2014 at 09:29:36AM +0400, Andrey Sagulin <say42 at ya.ru> wrote:
> gdb says that an error occured somewhere in State.so. I'm not a
> C-hacker so I cannot provide more details.

the "bt" command gives a backtrace, which is important to have.

also, do this in gdb and give us the output:

   printf "%s:%d\n", PL_curcop->cop_filegv->sv_any->xiv_u.xivu_namehek->hek_key+2, PL_curcop->cop_line

for the backtrace to be useful, you need to have binaries with debugging
info. these are usually provided as separate packages you need to
install. A backtrace should list function names and argument values. If it
doesn't, then you probably miss the debug info.

I can speculate about what happens: Perl has a longstanding bug (that perl
upstream refuses to fix, as so many bugs recently), namely, objects might
disappear even though they have references pointing to them. That only
happens when perl exits "cleanly".

That means that perl might call a destructor for an object that has already
been freed, and the underlying C library will then access corrupted data,
causing crashes.

In Coro, this most often manifests itself by a segfault in e.g.
coro_semaphore_adjust with a 0 pointer as argument, as perl has freed the
list of waiters even though the semaphore still references it.

If that is the case, then you have two options:

- make sure you don't hold any locks, watchers or anything else in a way that
  would cause perl to run into this problem. unsurprisingly, this is hard.
- call POSIX::_exit to exit your program without cleaning up. this means that
  destructors will not be called, but it does avoid the crashes (they never
  happen during runtime, fortunately).

Note that the above is a speculation - your test program doesn't look as
if it would trigger this bug, but the bug depends on the perl version,
compile time options, and a lot of other factors, so it cnanot be
excluded.

-- 
                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 anyevent mailing list