Dieser Post wurde aus meiner alten WordPress-Installation importiert. Sollte es Darstellungsprobleme, falsche Links oder fehlende Bilder geben, bitte einfach hier einen Kommentar hinterlassen. Danke.
A new problem appeared about a week ago: Perl paniced - something I've never seen before - with an internal error message "attempt to copy freed scalar". The problem occurred in Carp.pm which is a Perl core module.
Carp tries to get the argument of subroutine calls of all subs on the current stack. PerlMonks told me that some variable passed to a sub on the stack went out of scope since the sub was called.
The module causing the errors is using a customer $SIG{ALRM} handler which die()s out of an eval() call and moving that handler definition into the eval block stopped the errors for some days until one came back today.
Searching the Internet for any information took me to another page which didn't solve the problem but provided an easy way to reproduce it:
perl -MCarp -le 'f(@ARGV); sub f { my $x = shift(@ARGV); carp($x)}' a vpanic: attempt to copy freed scalar 1333588 to 134d7c0 at /usr/local/share/perl/5.12.4/Carp.pm line 182.I updated Carp to 1.23 - no change.Shortly before giving up, I started debugging Carp.pm itself a little bit - and accidentally solved the problem.
Carp.pm's line 182 is
my $arg = shift;Adding a debug message which shows $_[0] fixed the problem and lead to the following final fix (lines 181-184 shown):
sub format_arg {
my $arg = $_[0]; shift;
if ( ref($arg) ) {Hopefully one of the Carp maintainers will add this (or another) fix soon because I don't like the idea of local patching Perl (core) modules. I'll have a hard time getting the
Noch keine Kommentare. Schreib was dazu