Re: PROBLEM: Failure to deliver SIGCHLD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Harris wrote:
>
> [2.] The problem occurs in a forking server similar in function to
> inetd.  The server employs a very simple SIGCHLD handler that loops on
> wait(2), until all zombie processes have been collected.  For no
> immediately apparent reason, the parent process behaves as if it no
> longer receives SIGCHLD.  Manually sending the signal has no effect.

Sounds like a blocked signal.

> [6.] This is the code for the signal handler in the server application. 
> 
>     void reaper_man (int signum)
>     {
>             int stat;
>             while ( waitpid(-1, &stat, WNOHANG) > 0 );
>     }
> 
>     signal (SIGCHLD, reaper_man);  /* from main() */
>
> I dare say it contains no bugs (famous last words)

It does - it clobbers errno :-)

My suggestions: use sigaction with defined restart/mask/etc behaviour
instead of signal.  Save and restore errno in the signal handler.
Make sure SIGCHLD isn't blocked.

But if your only interest is to get rid of the zombies, the most simple
solution would be to set SIGCHLD to ignore.

Ciao, ET.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux