in reply to Re: thread inside mod_perl handler will never been released
in thread thread inside mod_perl handler will never been released

Using setsid and exit I got extra httpd daemon at each fork.

So it doesn' seem a good solution

If I use Core::exit(0) instead of exit I got an httpd daemon in zombie state.

$pid = fork(); if( $pid == 0 ) { setsid(); # ----------------------------------------- close STDIN; close STDOUT; close STDERR; # ----------------------------------------- my $p_pid; $p_pid = getppid; ae_util::mylog( "START Child process: $$.$p_pid " ); sleep 1; ae_util::mylog( "EXIT Child process: $$.$p_pid " ); # CORE::exit(0); exit; }

I found another solution which is more simple and seems to works well:

$SIG{CHLD} = 'IGNORE';

and

$pid = fork(); if( $pid == 0 ) { # ----------------------------------------- close STDIN; close STDOUT; close STDERR; # ----------------------------------------- my $p_pid; $p_pid = getppid; ae_util::mylog( "START Child process: $$.$p_pid " ); sleep 1; ae_util::mylog( "EXIT Child process: $$.$p_pid " ); CORE::exit(0); }

Do you known if that solution ( ignore SIGCHLD signal ) have some drawback ?

Edited by planetscape - changed pre to code tags; added rudimentary formatting

( keep:1 edit:25 reap:0 )