[Catalyst] How to stop Catalyst::Engine::HTTP::POE?

Jon Schutz jon+catalyst at youramigo.com
Thu May 24 06:01:56 GMT 2007


Hi Andy,

On Thu, 2007-05-24 at 00:35 -0400, Andy Grundman wrote:
> On May 24, 2007, at 12:03 AM, Jon Schutz wrote:
> 
> > I am using Catalyst::Engine::HTTP::POE in a test harness; when the  
> > tests
> > complete, I would like to gracefully terminate all child processes  
> > that
> > C::E::HTTP::POE starts.
> >
> > My code forks and starts C::E::HTTP::POE, then later my cleanup code
> > kills the forked child, but extra processes (grandchildren) created by
> > C::E::HTTP::POE get left behind.
> 
> Are you using preforking?  When you kill the parent it should take  
> out all the children, maybe there is a bug.
> 

No, I hadn't set CATALYST_POE_MAX_PROC as I'm happy with forking on-
demand in this app.  However, I just tried it now, and it made no
difference.

Here is the launching code:

    ($testsite_running) = $self->run_forks(sub { 
	$ENV{CATALYST_ENGINE} = "HTTP::POE"; 
	$ENV{CATALYST_POE_MAX_PROC} = 4; # Tried with and without
	require $testsite; 
	$testsite_class->config( ... );
	$testsite_class->setup;
	$testsite_class->run($port, undef, $self->{testsite_options}); 
    });

and run_forks() just does the fork, runs the given sub, and remembers
the child PID for later.

The process tree looks like this:

├─bash(5436)───perl(15424)─┬─perl(15428)─┬─perl(15431)
│                          │             └─perl(15432)
│                          ├─perl(15433)
│                          └─other_server.pl(15435)

where the main code is 15424, which on completion kills children 15428,
15433 and 15435, and 15431, 15432 get left behind.  15428 is the forked
child from the code described above, and 15431 and 15432 are created by
C::E::HTTP::POE.

Regards,

-- 

Jon






More information about the Catalyst mailing list