[Catalyst] Proper way to perform cleanups on server shutdown?

Matt S Trout dbix-class at trout.me.uk
Wed Jul 11 18:21:32 GMT 2007


On Wed, Jul 11, 2007 at 09:03:29AM -0700, John Napiorkowski wrote:
> Okay, I've got something strange and could use some
> advice about the best way to create a test case for
> it.
> 
> Basically I am finding that END blocks anywhere in a
> Catalyst application (even in END blocks from included
> libraries) never get called when running the standard
> development server and then shutting it down with
> either an INT or TERM.
> 
> INT get's generated if you are running the development
> server forgrounded and then press 'ctrl-c' to exit it,
> while I get a TERM signal when running the server
> backgrounded and then using kill $pid on it.
> 
> I can demonstrate this by placing an END block in my
> root modules (the "MyApp.pm" module)
> 
> END {
>   print "got END BLOCK!\n";
> }
> 
> This will never run under the conditions I have
> described.

Correct.

An uncaught signal will result in the process immediately terminating, so
you never get as far as the END block.

This is normal unix behaviour, nothing to do with Catalyst.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list