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

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


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.

Being naive w.r.t POE, I have tried POE::Kernel->stop() to no effect.

I can see in the code how I could dig out the list of child processes
from internal data structures in C::E::HTTP::POE and terminate them, but
obviously that's not the right way.

In C on Linux, I would set the children to die with the parent using
prctl(PR_SET_PDEATHSIG, SIGKILL) - my efforts to find an equivalent in
perl have failed but I presume there must be a way...

Currently I've worked around the problem by sending a termination signal
to the whole process group, which is a really bad idea - literally
suicide - so I'd appreciate any comments/suggestions.

A few months ago I raised the idea of a standard
Catalyst::Engine::shutdown method or equivalent (related to a different
problem at the time).  Response was fairly quiet at the time, so I guess
I'm the only one hitting this type of problem, yes?

-- 

Jon




More information about the Catalyst mailing list