[Libguestfs] collectd leaks SIGCHLD == SIG_IGN into plugins

Richard W.M. Jones rjones at redhat.com
Fri Nov 9 12:19:30 UTC 2018

Peter Dimitrov and myself were debugging a very peculiar bug when
libguestfs is run as a plugin from collectd:


The long story short is that collectd leaks SIGCHLD == SIG_IGN setting
into plugins:


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

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


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.

More information about the Libguestfs mailing list