On 15 September 2015 at 23:15, Michael Schout <msch...@gkg.net> wrote:
> As reported in other thread, I've seen mod_perl emit panic warnings such
> as the following ever since 5.19.7:
>
>  panic: attempt to copy freed scalar 7fb2264ffde0 to 7fb2264ffd08 at
> /Users/mschout/Sync/Apache-TryCatch/blib/lib/Apache/TryCatch.pm line 20.
>
> I've also seen random segementation faults caused by innocent looking
> "return" statements in a large code base.
>
[...]
>
> I bisected against perl git, using mod_perl 2.0.9 and apache 2.2.29 as
> the mod_perl environment, and installing TryCatch from cpan, and
> discovered that the following perl commit is the culprit:
>
>> commit 437e3a7dac994ebace1195549170c81f474d9c20
>> Author: Matthew Horsfall <wolfs...@gmail.com>
>> Date:   Wed Dec 11 18:28:21 2013 -0500
>>
>>     Optimise out PUSHMARK/RETURN if return is the last statement in a sub.
>>
>>     This makes:
>>
>>       sub baz { return $cat; }
>>
>>     Behave like:
>>
>>       sub baz { $cat; }
>>
>>     Which is notably faster.
>>

Thanks for the detective work, Michael. I've logged this on
rt.perl.org since it isn't yet clear whether the optimization has a
problem, or whether mod_perl (or maybe TryCatch / Devel::Declare) is
doing anything naughty:

https://rt.perl.org/Ticket/Display.html?id=126070

Reply via email to