Cole Robinson writes ("Re: [Xen-devel] [libvirt] [vbox-dev] Assert with libvirt 
+ xen hvm"):
> I took a cursory look at libxl's sigchld handling... it's intense to say the
> least, but there's some driver options that tweak the handling. Maybe there's
> a simple fix.

Sadly the way that there's a single SIGCHLD handler in the Unix API is
extremely awkward in multithreaded programs.  The complicated code in
libxl is trying to help cope with that.

> On 01/26/2015 08:17 AM, Klaus Espenlaub wrote:
> > The rationale why the runtime installs a dummy signal handler is that if
> > SIGCHLD is set to be ignored (that's the default) then POSIX compliant
> > waitpid() won't work. It's mentioned in the wait(2) man page on my linux
> > system, see the notes about the ECHILD error code.

I think you are wrong about this.

SIGCHLD (like all signals) is set to SIG_DFL by default.  But it is
only SIG_IGN that causes automatic reaping of children.  I normally
use the online Open Group spec to check this kind of thing - it's more
authoritative than manpages.

  
http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03

  SIG_IGN

  ...

  If the action for the SIGCHLD signal is set to SIG_IGN, child
  processes of the calling processes shall not be transformed into
  zombie processes when they terminate. If the calling process
  subsequently waits for its children, and the process has no
  unwaited-for children that were transformed into zombie processes,
  it shall block until all of its children terminate, and wait(),
  waitid(), and waitpid() shall fail and set errno to
  [ECHILD].

I don't know exactly what virtualbox does with children but if the
only reason it is setting a SIGCHLD handler is to avoid its children
being automatically reaped, leaving it set to SIG_DFL will work just
fine.

If virtualbox always reaps its children synchronously (ie, it does not
use SIGCHLD to get notified of child death) then setting the libxl
signal mode to

  libxl_sigchld_owner_libxl_always_selective_reap

in libvirt should work.  This is what libvirt (at laast in master)
does.

There would then be no need for virtualbox to do anything to SIGCHLD.
Although, it might be worth checking that it isn't SIG_IGN and
screaming somewhere if it is.

Incidentally it seems to me possible that the reason why virtualbox
explictly sets a SIGCHLD handler may be that at some point in the past
you had encountered a bug with someone in the same process setting
SIGCHLD to SIG_IGN.

Ian.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to