Red Hat Bugzilla – Bug 537777
'Attempt to free unreferenced scalar' when running a perl program with threads
Last modified: 2018-10-27 10:02:50 EDT
Escalated to Bugzilla from IssueTracker
Event posted on 2009-11-14 07:29 GMT by spoyarek Base OS: RHEL-5.4 Problem Description: Joining or undefining a thread variable (using undef) in a perl program results in an internal perl error: Attempt to free unreferenced scalar: SV 0x7b5a840, Perl interpreter: 0x7a1e2f0 during global destruction. How Reproducible: Always Steps to Reproduce: $ cat test.pl #!/usr/bin/perl use threads; my $subref = sub { 42; }; my $t; while(1) { $t=threads->new($subref); $t->join(); } $ perl test2.pl Actual Result: Attempt to free unreferenced scalar: SV 0x7b7dcb0, Perl interpreter: 0x7b4cfb0 during global destruction. Attempt to free unreferenced scalar: SV 0x7b7e1e0, Perl interpreter: 0x7b4cfb0 during global destruction. . . Expected Result: The internal error should not show up. Additional Information: An upstream patch is available, which fixes this: http://perl5.git.perl.org/perl.git/commitdiff/dd5ef8e06fad97042101d2f0784676bb2111654b I have attached a patch adapted to RHEL-5. I have tested it to verify that it works. Would like a review of the patch so that I can give a test package to the customer to verify. This event sent from IssueTracker by mpoole [Support Engineering Group] issue 365873
Created attachment 369666 [details] backport of upstream patch
Reproducer can be reduced to #!/usr/bin/perl use threads; my $subref = sub { 42; }; my $t=threads->new($subref); $t->join();
The patch looks all right.
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Cause Joining or undefining a thread variable (using undef) in a perl program results in an internal perl error. Consequence Error message on stderr: Attempt to free unreferenced scalar: SV 0x7b5a840, Perl interpreter: 0x7a1e2f0 during global destruction. Fix Backport of upstream patch fixed perl internals. Result The internal error do not show up.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0199.html