You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Raymond Wan <rw...@kuicr.kyoto-u.ac.jp> on 2008/04/17 18:29:27 UTC

Forking a process [in Practical mod_perl book]

Hi all,

I'm trying to fork a long-running process which I do not want to wait 
for.  I was getting a lot of "ssh <defunct>" processes, so I  did some 
googling and found this from the aforementioned O'reilly book:

http://www.perl.com/lpt/a/701

And sure enough, there's a section on "Avoiding Zombie Processes".  In 
this section's example code, the authors have added these two lines to 
the top:

-----
my $r = shift;
$r->send_http_header('text/plain');
-----

which did not exist in the previous examples.  I don't quite understand 
why setting the HTTP header has any relevance to zombie processes.  
Apologies if I missed it somewhere on this page, but could anyone shed 
some light on why these two lines are important enough to remain in all 
future examples on this topic?

Thank you!

Ray




Re: Forking a process [in Practical mod_perl book]

Posted by Raymond Wan <rw...@kuicr.kyoto-u.ac.jp>.
Hi all,

Raymond Wan wrote:
> -----
> my $r = shift;
> $r->send_http_header('text/plain');
> -----


Sorry for the trouble but while googling for the problem, I came by the 
reason:  "send the output of system() to the client":  
http://www.mail-archive.com/modperl@apache.org/msg36062.html

I also realized that the solution for modperl1 differs for modperl2 and 
the above snippet seems relevant to MP1...

Thanks!

Ray