perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Johnson <solut...@gina.net>
Subject Can't make a clean break (fork)
Date Thu, 31 Oct 2002 04:18:03 GMT
Back again with a similar question.  I put in place some code a few
months ago based on a reply from a member.  It is allowing me to run the
external process correctly, but in doing deployment of the code and
watching the system memory usage it appears that the process is still
attached to the mod_perl process.  Here is a snippet of code:

   $SIG{'CHLD'} = 'IGNORE';
   defined (my $kid = fork) or 
   $seo->error_to_log( "Cannot fork: $!" );
   if ($kid) {
       $seo->error_to_log( "Parent has finished, kid's PID: $kid" );
   } else {        
            
   	close($req_rec->connection->fileno);
        # added in an attempt to make the process completely seperate
        $req_rec->cleanup_for_exec(); # untie the socket
        # chdir '/' or die "Can't chdir to /: $!";
        close STDIN;
        close STDOUT;
        close STDERR;        
           
        $seo->_debug(0);
        exec( $seo->external_report_app(), $number ) or
        $seo->error_to_log("Cannot execute exec: $!" , 1 );
        CORE::exit(0);
    }    

I am running this with the latest version of mod_perl and Apache and the
dev3 of 2.0b9 with 5.8 Perl on the development server and 5.6.1 and
2.0b8 on a production machine, both running Linux.
My detached process starts approx. 16 additional forked processes so it
is important for me to complete detach myself from the apache process.

Aaron Johnson


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message