Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Request help for work around for bug in perl 5.10.1 (weak magic)

by babel17 (Acolyte)
on Dec 12, 2012 at 21:43 UTC ( #1008593=note: print w/ replies, xml ) Need Help??


in reply to Re: Request help for work around for bug in perl 5.10.1 (weak magic)
in thread [Solved] Request help for work around for bug in perl 5.10.1

So I apologize for the lack of clear error messages. The code is detached, so I have to trap __DIE__ and write to syslog. This is done as follows:

$SIG{__DIE__} = \&die_catcher; ... # # die_catcher # # Try to log the call stack if we die # sub die_catcher { for my $caller ( CallStack() ) { alog(LOG_ERR, $caller); } } ... # # Courtesy of Perl Monks http://www.perlmonks.org/?node_id=51097 # sub CallStack { local $@; eval { confess( '' ) }; my @stack = split m/\n/, $@; shift @stack for 1..3; # Cover our tracks. return wantarray ? @stack : join "\n", @stack; }
I'm not really that familiar with Carp, I'll see what I can figure out to make it give a more complete backtrace.


Comment on Re^2: Request help for work around for bug in perl 5.10.1 (weak magic)
Download Code
Replies are listed 'Best First'.
Re^3: Request help for work around for bug in perl 5.10.1 (backtrace)
by tye (Cardinal) on Dec 12, 2012 at 22:34 UTC
    I'm not really that familiar with Carp, I'll see what I can figure out to make it give a more complete backtrace.

    The problem wasn't that the backtrace was unacceptable. The problem was that you simply failed to log @_ (really just $_[0]), which is the most important thing to log when logging inside of a __DIE__ handler.

    Luckily, the backtrace also happened to include a truncated version of that message. But the solution isn't to try to get the backtrace to not truncate. The solution is to log $_[0] directly (along with the backtrace).

    In this particular case, the interesting backtrace is the C backtrace, but that isn't as easy to get (you'd likely need a non-stripped build and gcc and...).

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008593]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2015-07-29 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls