-If children should occur, keep them from becoming zombies

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4900 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-01-06 20:03:48 +00:00
parent 8aa8e1f9ae
commit d2cc0f30b6

View File

@ -37,6 +37,7 @@ use Sys::Syslog;
use Storable qw/freeze thaw/;
use IO::Socket;
use Data::Dumper;
use POSIX qw/WNOHANG/;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr';
@ -149,6 +150,8 @@ sub init_dbworker {
}
unless ($dbworkerpid) {
#This process is the database worker, it's job is to manage database queries to reduce required handles and to permit cross-process caching
$SIG{CHLD} = sub { while (waitpid(-1,WNOHANG) > 0) {}}; #avoid zombies
#TODO: how children are being born, I'm not sure, but on occasion it happens
$0 = "xcatd: DB Access";
use File::Path;
mkpath('/tmp/xcat/');