DCPM: body bags
Neil Williams
linux at codehelp.co.uk
Mon Nov 17 16:04:42 CST 2003
On Friday 31 Oct 2003 10:54 am, Steve Marvell wrote:
> On the subject of "what do I do with a die from a module way way down
> the chain of command?":
>
> #!/usr/bin/perl
>
> local $SIG{__DIE__} = sub {
> die "You killed Kenny! @_";
> };
>
> die "you bastard";
>
> Be careful not to exit() in these handlers, since that really break
> thing when someone evals it and expects to catch the dies.
OK, I've done quite a few more upgrades since the meeting - including adding a
rollover and a lot more servers > 500 now.
The script already tries 6 queries sequentially per run. It also now repeats
to a new server if there's no DNS etc. because die() isn't dying.
Net result (sorry), is that I got a cron report tonight that instead of giving
the usual 4 to 6 message reports, gave 45! 15kb!
So by handling die(), I'm allowing the script to continue again and again. It
stops when it has finally contacted and queried successfully for each query -
unless it segfaults.
I'm trying to handle / prevent as many of these as I can but I don't actually
get notified of a segfault - the cron report ends, the result is emailed and
the segfault is only reported to the remote server logs. (I never see it on
the remote reports, even though it does appear on similar local console
printouts.)
Should I use exit() anyway - in the top level code? There are times when the
die() that has been handled is leaving the underlying module code in a bad
state. e.g. after an ECONNREFUSED, I quite often get a broken pipe error -
yet the server connection reporting the broken pipe is always fine when
tested separately. I also get cleanup errors from undefined connections
created using new() that cannot then be destroyed.
--
Neil Williams
=============
http://www.codehelp.co.uk/
http://www.dclug.org.uk/
http://www.isbn.org.uk/
http://sourceforge.net/projects/isbnsearch/
http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://mail.pm.org/archives/devoncornwall-pm/attachments/20031117/1db35992/attachment.bin
More information about the Devoncornwall-pm
mailing list