Apache2::SubProcess subprocess not subprocessing properly

Tosh Cooey <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Organization Twelve Hundred Group LLC
Message-ID <[email protected]>
Hi after much trial and all error I am seeing that the browser 
connection closing is also stopping my subprocess.

The main ModPerl::Registry program looks like this:
### file.pl ###
use Apache2::SubProcess ();
use JSON();

&main(shift);

sub main {
   my $r = shift;
   ...
   $r->spawn_proc_prog ('/web/html/file_fork.pl', \@argv);
   return print $cgi->redirect('index.pl');
}
###

And

### file_fork.pl ###
use JSON();
use warnings;
use POSIX 'setsid';
chdir '/'                or die "Can't chdir to /: $!";
open STDIN, '/dev/null'  or die "Can't read /dev/null: $!";
open STDOUT, '+>>', '/tmp/debug.txt' or die "Can't write to 
/tmp/debug.txt: $!";
open STDERR, '>&STDOUT'  or die "Can't dup stdout: $!";
setsid or die "Can't start a new session: $!";

   # run your code here or call exec to another program
foreach my $num (1..10) {
   warn $num;
   sleep(1);
}
###

When file.pl is executed it calls file_fork.pl and file_fork starts to 
print 1, 2, 3 and then stops around 2 or 3 depending on how long my 
browser is connected.

Are there any glaring errors that anyone sees?  It should work shouldn't 
it, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 after 10 seconds...

Thank-you all!

Tosh


-- 
McIntosh Cooey - Twelve Hundred Group LLC - http://www.1200group.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.