[Libguestfs] [collectd] collectd leaks SIGCHLD == SIG_IGN into plugins

Richard W.M. Jones rjones at redhat.com
Tue Nov 13 08:54:27 UTC 2018


On Tue, Nov 13, 2018 at 09:19:40AM +0100, Ruben Kerkhof wrote:
> Hi Rich,
> 
> On Fri, Nov 9, 2018 at 1:19 PM, Richard W.M. Jones <rjones at redhat.com> wrote:
> > Peter Dimitrov and myself were debugging a very peculiar bug when
> > libguestfs is run as a plugin from collectd:
> >
> >   https://www.redhat.com/archives/libguestfs/2018-November/thread.html#00023
> >
> > The long story short is that collectd leaks SIGCHLD == SIG_IGN setting
> > into plugins:
> >
> >   https://www.redhat.com/archives/libguestfs/2018-November/msg00095.html
> >
> > This means that any plugin that does the usual pattern of:
> >
> >   pid = fork ();
> >   ...
> >   if (waitpid (pid, NULL, 0) == -1) {
> >     perror ("waitpid");
> >     exit (EXIT_FAILURE);
> >   }
> >
> > will fail, because the forked subprocess is automatically reaped
> > before waitpid is called, resulting in the wait failing with errno ==
> > ECHILD.
> >
> > It is possible to work around this by adding:
> >
> >   signal (SIGCHLD, SIG_DFL);
> >
> > to the plugin.  However I believe this is a bug in collectd, and it
> > should sanitize signals (and maybe other things) before running
> > plugins.
> >
> > Rich.
> 
> Would you mind opening an issue at
> https://github.com/collectd/collectd/issues/new for this?

Peter:

I don't have enough information (like collectd version etc) to fill in
all the fields there.  Since you are running collectd and encountered
the problem originally, could you fill in the form requested above
please, and then let me know the issue number so that I am able to
follow it too.

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list