perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schout <>
Subject Re: panic: attempt to copy freed scalar caused by calling cgi->param with TryCatch since perl 5.19.7
Date Wed, 16 Sep 2015 17:22:31 GMT
On 9/16/15 7:08 AM, Vincent Veyron wrote:

> I put your test handler on a machine running Debian 8 (jessie), it works just fine.

I cannot reproduce this at all.

I tried on Debian 8 jessie running in virtualbox.

perl, modperl, apache all from debian packages.  using prefork MPM.

TryCatch installed from cpan or from debian packages, makes no
difference at all.

[Wed Sep 16 19:12:11.418852 2015] [perl:error] [pid 29001] [client] panic: attempt to copy freed scalar 7f62b088a6d0 to
7f62b088a580 at
/home/vagrant/modperl-trycatch-bug/lib/Apache/ line 20.\n

perl -v :
This is perl 5, version 20, subversion 2 (v5.20.2) built for

dpkg -l *mod-perl* :
ii  libapache2-mod-perl2                           2.0.9~1624218-2
        amd64                        Integration of perl with the
Apache2 web server

apache2 -v:

Server version: Apache/2.4.10 (Debian)
Server built:   Aug 28 2015 16:28:08

I did not use a  Can't see that making any difference.

I just added this at the end of apache2.conf:
PerlSwitches -I/home/vagrant/modperl-trycatch-bug/lib
PerlModule Apache::TryCatch

<Location /crashme>
    SetHandler perl-script
    PerlResponseHandler Apache::TryCatch

I also did it with a in /home/lib like you say you have.

PerlRequire /home/lib/

<Location /crashme>
    SetHandler perl-script
    PerlResponseHandler Apache::TryCatch
and /home/lib/Apache/
package Apache::TryCatch;

use Apache2::Const -compile => qw(OK);
use TryCatch;
use CGI;

sub handler :method {
    my ($self, $r) = @_;


    print $self->crash($r);

    return Apache2::Const::OK;

sub crash {
    my $cgi = CGI->new;

    try { $cgi->param(x => 'x') }

    return "OK";


And if fails 100% of the time for me that way also when accessing /crashme:

[Wed Sep 16 19:19:30.092140 2015] [perl:error] [pid 29154] [client] panic: attempt to copy freed scalar 7f2bcf672758 to
7f2bcf672200 at /home/lib/Apache/ line 20.\n

Not sure what you have done differently, but the bug is definitely there
on debian 8.

Michael Schout

View raw message