develooper Front page | perl.perl5.porters | Postings from April 2010

[perl #27085] segfault when using a shared hash ref with ithreads

From:
Alexandr Ciornii via RT
Date:
April 12, 2010 11:06
Subject:
[perl #27085] segfault when using a shared hash ref with ithreads
Message ID:
rt-3.6.HEAD-6227-1271095598-1244.27085-15-0@perl.org
Also segfaults for me on Strawberry Perl 5.12.0 RC0.

On Tue Feb 24 17:32:50 2004, stas wrote:
> 
> This is a bug report for perl from stas@rabbit.stason.org,
> generated with the help of perlbug 1.34 running under perl v5.8.3.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> The following program segfaults:
> 
> #foo
> package My::InterpreterCounter;
> 
> use strict;
> use warnings FATAL => 'all';
> 
> use threads;
> use threads::shared;
> 
> my $obj = My::InterpreterCounter->new();
> 
> my $ctr = &share({});
> $ctr->{cnt} = 1;
> 
> sub new {
>      my $class = shift;
>      my $self = 0;
>      return bless \$self, $class;
> }
> 
> sub CLONE {
>      print "CLONE\n";
>      $$obj = 1;
> }
> 
> sub DESTROY {
>      print "DESTROY\n";
>      lock $ctr;
>      $ctr->{cnt}--;
> }
> 
> sub END {
>      print "END\n";
>      # DESTROY object now before $ctr went out of scope
>      #undef $obj;
> }
> 
> __END__
> 
> % perl foo
> END
> DESTROY
> Segmentation fault
> 
> gdb) where
> #0  0x403aabd6 in sharedsv_elem_mg_FETCH ()
>     from
> /usr/lib/perl5/5.8.3/i386-linux-thread-
> multi/auto/threads/shared/shared.so
> #1  0x00000001 in ?? ()
> #2  0x4013bb78 in ?? ()
>     from /usr/lib/perl5/5.8.3/i386-linux-thread-multi/CORE/libperl.so
> #3  0x00000050 in ?? ()
> 
> sorry, that perl has no debug built.
> 
> the following tweaks make the segfault go away:

( http://rt.perl.org/rt3/Ticket/Display.html?id=27085 )

-- 
Alexandr Ciornii, http://chorny.net




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About