Skip Menu |
 

This queue is for tickets about the autobox CPAN distribution.

Report information
The Basics
Id: 80400
Status: resolved
Priority: 0/
Queue: autobox

People
Owner: CHOCOLATE [...] cpan.org
Requestors: tokuhirom+cpan [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 2.78



Subject: Segmentation fault with END block
Download (untitled) / with headers
text/plain 192b
This code cause SEGV. use strict; use warnings; use utf8; { package M; my $X; sub register { $X = $_[0] } END { $X->() } } use autobox; M::register(sub { 1->OMG(); });
Download (untitled) / with headers
text/plain 109b
Thanks for reporting this. Simpler test case: my $X; END { $X->() } use autobox; $X = sub { 1->OMG() };
Download (untitled) / with headers
text/plain 509b
I guess there is no reason to free resources at END state. Because OS will free memory at process end. Here is a propsed patch. index 7506b08..9456ecd 100644 --- a/autobox.xs +++ b/autobox.xs @@ -343,8 +343,8 @@ END() PL_check[OP_ENTERSUB] = autobox_old_ck_subr; } - PTABLE_free(AUTOBOX_OP_MAP); - AUTOBOX_OP_MAP = NULL; + /* PTABLE_free(AUTOBOX_OP_MAP); */ + /* AUTOBOX_OP_MAP = NULL; */ MODULE = autobox PACKAGE = autobox::universal
Download (untitled) / with headers
text/plain 627b
How do you think about this patch? On Fri Feb 01 04:41:38 2013, TOKUHIROM wrote: Show quoted text
> I guess there is no reason to free resources at END state. Because OS > will free memory at process > end. > > Here is a propsed patch. > > index 7506b08..9456ecd 100644 > --- a/autobox.xs > +++ b/autobox.xs > @@ -343,8 +343,8 @@ END() > PL_check[OP_ENTERSUB] = autobox_old_ck_subr; > } > > - PTABLE_free(AUTOBOX_OP_MAP); > - AUTOBOX_OP_MAP = NULL; > + /* PTABLE_free(AUTOBOX_OP_MAP); */ > + /* AUTOBOX_OP_MAP = NULL; */ > > MODULE = autobox PACKAGE = autobox::universal
Download (untitled) / with headers
text/plain 593b
Thanks for the patch and sorry for not replying. Obviously it's better than a segfault, but "let the OS take care of it" feels like a workaround rather than a fix. Cleaning up an allocated resource is not something to be ashamed of :-) Ideally, I'd rather know why the segfault occurs there e.g. is there another/better/safer (later?) hook for destructors/cleanup? I've spotted ancient, unfixed (but reported) bugs in perl's special-block handling in the past, so admittedly this may be the only solution. On Tue Apr 30 03:09:44 2013, TOKUHIROM wrote: Show quoted text
> How do you think about this patch?
This should be fixed in 2.78. Thanks again.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.