perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Schout <msch...@gkg.net>
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
192.168.1.107:63580] panic: attempt to copy freed scalar 7f62b088a6d0 to
7f62b088a580 at
/home/vagrant/modperl-trycatch-bug/lib/Apache/TryCatch.pm line 20.\n

perl -v :
This is perl 5, version 20, subversion 2 (v5.20.2) built for
x86_64-linux-gnu-thread-multi

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 startup.pl.  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
</Location>
------

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

apache2.conf:
-----
PerlRequire /home/lib/startup.pl

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

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

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

    $r->content_type('text/plain');

    print $self->crash($r);

    return Apache2::Const::OK;
}

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

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

    return "OK";
}

1;
-----

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
192.168.1.107:63594] panic: attempt to copy freed scalar 7f2bcf672758 to
7f2bcf672200 at /home/lib/Apache/TryCatch.pm line 20.\n

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

Regards,
Michael Schout

Mime
View raw message