Skip Menu |

This queue is for tickets about the Devel-Leak CPAN distribution.

Report information
The Basics
Id: 19067
Status: open
Priority: 0/
Queue: Devel-Leak

People
Owner: Nobody in particular
Requestors: dom [...] idealx.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.03
Fixed in: (no value)



Subject: SEGV when re-using $handle several times
Attached test file calls CheckSV twice on the same $handle, causing Perl to SEGV. Tested with 0.03 on both SuSE's perl-5.8.3-32.9 and Debian Sarge's 5.8.8-3
Subject: zoinx.pl
use strict; use warnings; use Devel::Leak; our $handle; my $foo = "a"; Devel::Leak::NoteSV($handle); $foo .= "a"; warn "1"; Devel::Leak::CheckSV($handle); $foo .= "a"; warn "2"; Devel::Leak::CheckSV($handle); warn "3";
From: ATOURBIN [...] cpan.org
On Thu May 04 05:07:09 2006, guest wrote: Show quoted text
> Attached test file calls CheckSV twice on the same $handle, causing Perl > to SEGV.
It looks like on the first CheckSV invocation internal $handle data structures are freed (the handle is "unboxed pointer"!), so you cannot call that again. You simply get double free(), which is even detected with recent glibc. To fix this, $handle pointer should be boxed into an object reference, but that's additional SV which will be reported as leak. To my deep regret I have to inform you that Nick Ing-Simmons, the Devel::Leak author, died of a heart attack on Monday September 25th 2006. http://news.perlfoundation.org/2006/09/thanks_nick.html Now we have to fix Devel::Leak ourselves.
On Thu May 04 05:07:09 2006, guest wrote: Show quoted text
> Attached test file calls CheckSV twice on the same $handle, causing Perl > to SEGV. > > Tested with 0.03 on both SuSE's perl-5.8.3-32.9 and Debian Sarge's 5.8.8-3
Here is a quick fix for your problem. It only makes it clear that a $handle is no longer reusable after the first CheckSV() call. It simply marks $handle value for update when returning from XS (it is freed and set to NULL in check_used). Now I have experimental branch in which handles are boxed into full-fledged objects, with special typemap to prevent "scalar leak" inside XS code (from the Devel::Leak point of view). However, offhand it is not obvious what subsequent calls to CheckSV() should actually do. Should they report the leaks from the start of NoteSV() or rather from the point of previous CheckSV() call? So this fix is probably the best we should do at this point. Anyway, if you know of other bugs in Devel::Leak or somehow interested in further Devel::Leak development, please let me know. --- Leak.xs | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Leak.xs b/Leak.xs index 59b2390..5411f4b 100644 --- a/Leak.xs +++ b/Leak.xs @@ -198,9 +198,12 @@ CheckSV(obj) hash_ptr * obj CODE: { + if (!obj) + croak("invalid Devel::Leak handle (cannot reuse)"); RETVAL = check_used(&obj); } OUTPUT: + obj RETVAL IV -- 1.4.3.GIT
Subject: Re: [rt.cpan.org #19067] SEGV when re-using $handle several times
Date: Thu, 26 Oct 2006 14:19:33 +0200
To: bug-Devel-Leak [...] rt.cpan.org
From: Dominique Quatravaux <dom [...] idealx.com>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 via RT a écrit : Show quoted text
> > To my deep regret I have to inform you that Nick Ing-Simmons, the
Devel::Leak author, died of a heart attack on Monday September 25th 2006. http://news.perlfoundation.org/2006/09/thanks_nick.html This is bad news. I left a message there, I don't know how to express my gratitude and condolences to Nick's relatives. Show quoted text
> > Now we have to fix Devel::Leak ourselves.
So you appear to be the new maintainer, congratulations! - -- Dominique QUATRAVAUX Ingénieur senior 01 44 42 00 08 IDEALX -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFQKfUMJAKAU3mjcsRAgZYAJsEy7DEpH7O9Bg2KaPhMX+zdU5tHACgkz/P epkLkN4jeoXpWfNW1KpL8Q0= =EGSv -----END PGP SIGNATURE-----
Subject: Re: [rt.cpan.org #19067] SEGV when re-using $handle several times
Date: Thu, 26 Oct 2006 14:20:41 +0200
To: bug-Devel-Leak [...] rt.cpan.org
From: Dominique Quatravaux <dom [...] idealx.com>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 via RT a écrit : Show quoted text
> > Here is a quick fix for your problem. It only makes it clear that > a $handle is no longer reusable after the first CheckSV() call.
Looks just fine to me. I was moaning about the SEGV, not the fact that I have to NoteSV() all over again :-) - -- Dominique QUATRAVAUX Ingénieur senior 01 44 42 00 08 IDEALX -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFQKgZMJAKAU3mjcsRAnyUAJ9UCt9qXEdTCtQu5MOifR3325x1DQCfbqvU +yJnw29IqyY8VUJl8nFvifc= =NmEZ -----END PGP SIGNATURE-----
On Thu Oct 26 08:30:57 2006, dom@idealx.com wrote: Show quoted text
> This is bad news. I left a message there, I don't know how to express > my gratitude and condolences to Nick's relatives.
This is very sad indeed. Show quoted text
> > Now we have to fix Devel::Leak ourselves.
> So you appear to be the new maintainer, congratulations!
No, I'm not the new maintainer, but maybe I should become the one. Or maybe someone else who is more worthy. They just told me that "Andy [Lester] has kindly volunteered to coordinate the volunteers," so we'll see.