Bug 859910

Summary: Hint-hash copying can leak
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: perlAssignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: cweyl, iarnell, jplesnik, kasal, lkundrak, mmaslano, perl-devel, ppisar, psabata, rc040203, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://rt.perl.org/rt3/Public/Bug/Display.html?id=107000
Whiteboard:
Fixed In Version: perl-5.16.3-270.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-02 13:11:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Pisar 2012-09-24 11:43:09 UTC
Dying in tied %^H leaks memory:

use Config;
use Test::LeakTrace;

# [perl #107000]
package hhtie {
    sub TIEHASH { bless [] }
    sub STORE    { $_[0][0]{$_[1]} = $_[2] }
    sub FETCH    { die if $explosive; $_[0][0]{$_[1]} }
    sub FIRSTKEY { keys %{$_[0][0]}; each %{$_[0][0]} }
    sub NEXTKEY  { each %{$_[0][0]} }
}
leaktrace {
    eval q`
       BEGIN {
           $hhtie::explosive = 0;
           tie %^H, hhtie;
           $^H{foo} = bar;
           $hhtie::explosive = 1;
       }
       { 1; }
    `;
};

Fixed in upstream with commit:

commit 0db511c03fa45894d146905ba3408b3be3f5baa0
Author: Father Chrysostomos <sprout>
Date:   Sun Sep 23 12:42:15 2012 -0700

    [perl #107000] Don’t leak if hh copying dies

Perl 5.14.2 as well as 5.16.1 (all Fedoras) are affected.

Comment 1 Petr Pisar 2012-09-24 11:56:45 UTC
Well, this is not complete fix. The upstream test suit fails on test added by the commit in blead as well as in 5.16.1.

Comment 2 Petr Pisar 2012-09-25 11:28:53 UTC
The blead issue was bug in build system. The 5.16.1 branch requires another commit:

commit 895cdc83ca4f8ad093074b3bd5d0fbc1d09f7628
Author: Father Chrysostomos <sprout>
Date:   Fri Sep 21 22:01:19 2012 -0700

    Free iterator when freeing tied hash

Third commit will be good too:

commit aec0c0cc27651656899efeb7c4f64d2838a9cf9e
Author: Father Chrysostomos <sprout>
Date:   Fri Sep 21 18:23:20 2012 -0700

    Don’t leak deleted iterator when tying hash

Comment 3 Fedora Update System 2013-04-11 11:02:45 UTC
perl-5.16.3-262.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/perl-5.16.3-262.fc19

Comment 4 Fedora Update System 2013-04-11 11:09:55 UTC
perl-5.16.3-242.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/perl-5.16.3-242.fc18

Comment 5 Petr Pisar 2013-04-11 12:21:18 UTC
We are not going to fix it in F17 because it's to risky.

Comment 6 Fedora Update System 2013-04-20 19:15:40 UTC
perl-5.16.3-262.fc19, perl-Sys-Syslog-0.32-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2013-04-25 00:45:29 UTC
perl-5.16.3-242.fc18, perl-Sys-Syslog-0.32-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.