Farenji has asked for the wisdom of the Perl Monks concerning the following question:
I hope someone can shed some light on the following strange problem:
I'm using perl5.10 with mod_perl2 (ModPerl::Registry) / apache2, with a fairly big perl application consisting of quite a few own modules and a bunch of CPAN modules. Normally, when I do a die('whatever') in the code, or if there's a fatal error, this shows up in the error log like:
[Fri Jul 31 16:18:58 2009] [error] whatever at module.pm line 123Lately I noticed that in certain cases, these errors disappear in some black hole. Don't know what happens with it and why. For example, this works fine:
But the following will give nothing at all in the logs:#!/usr/bin/perl use strict; use Foo; die('this will appear in the error log like expected');
#!/usr/bin/perl use strict; use Foo; # here, something happens that messes up the die handler? my $foo = Foo->new(); die('this will NOT appear in the error log at all');
The following DOES give errors in the log:
#!/usr/bin/perl use strict; use Foo; # here, something happens that messes up the die handler? my $foo = Foo->new(); # but this apparently fixes it: undef $foo; die('this DOES appear in the error log');
Unfortunately, the Foo module is company confidential so I cannot post the code of this module here. I checked the entire module, including all (direct and indirect) dependencies, but so far I haven't found anything suspicious. There's no weird perl magic going on, as far as I can tell. All scripts are CGI compatible so no specific mod_perl directives. There are a lot of modules "use"d however so it's like looking for a needle in the haystack..
This problem doesn't turn up on the command line. Nor does it when I use plain old CGI. Then everything works fine. So I figure it's got something to do with mod_perl.
I tried changing the die signal handler, I tried all of the following, but without the desired effect: (I also tried it without "local", no change)
local $SIG{__DIE__} = ''; # no effect local $SIG{__DIE__} = 'DEFAULT'; # no effect # this gives a warning in the error log, no error local $SIG{__DIE__} = sub { warn @_ }; # this has no effect, nothing at all in the logs: local $SIG{__DIE__} = sub { die @_ };
For debugging purposes, redirecting the die to a warn is a viable workaround, but the application also contains a SOAP::Lite server, and in the server code, I use
to throw Soap errors. The problem is that this doesn't work in cases described here; then, an empty Soap message is returned. That's a show stopper.die SOAP::Fault->new(..);
ATM, I don't know anymore where to look and what to look for, to solve this. Could anyone point me in a direction, or give me some suggestions I might try to solve this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Disappearing fatal errors and die() with mod_perl2
by Bloodnok (Vicar) on Jul 31, 2009 at 15:49 UTC | |
by Farenji (Novice) on Jul 31, 2009 at 16:59 UTC | |
by Bloodnok (Vicar) on Aug 02, 2009 at 23:47 UTC | |
|
Re: Disappearing fatal errors and die() with mod_perl2
by perrin (Chancellor) on Jul 31, 2009 at 21:41 UTC |