perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jordan Baker" <su...@rogers.com>
Subject RE: Can't make a clean break (fork)
Date Thu, 31 Oct 2002 05:39:30 GMT
I'm currently doing something similar with fork in a mod_perl app for
doing some customer e-mailing which takes a too long to keep in
foreground.

Considering writing a little script to call via system() that will
fork() and perform the tasks because they can be done asynchronously.

Thought I would float out the idea and see what you thought about that.
______________________
Jordan Baker
jbb@contradix.comĀ 


-----Original Message-----
From: Aaron Johnson [mailto:solution@gina.net] 
Sent: October 30, 2002 11:18 PM
To: embperl@perl.apache.org
Subject: Can't make a clean break (fork)

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




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


Mime
View raw message