develooper Front page | perl.perl5.porters | Postings from January 2004 / ithreads interaction

Elizabeth Mattijsen
January 24, 2004 10:48
Subject: / ithreads interaction
Message ID:
This came in on the perl-loop list (courtesy Gensky Regnus).  Not 
sure whether this is a problem with Event or with  As it 
is a distinct possibility it's the latter, I thought I'd post it 
here.  If consensus is this requires an RRT ticket, I'll resubmit as 
a perlbug.

Further simplified from the example on perl-loop, it boils down to 
this little program:

use threads;
use Event;

# my $timer = Event->timer(   # with this line it crashes
Event->timer(                 # with this line it's ok
    interval => 1,
    cb       => sub { warn "starting thread\n"; async { 1 } },


The valgrind output is

starting thread
Bizarre SvTYPE [64] at 
/usr/local/lib/perl5/5.8.3/i686-linux-thread-multi/ line 61.
==28797== Invalid read of size 4
==28797==    at 0x8066888: S_my_exit_jump (in 
==28797==    by 0x80667DF: Perl_my_failure_exit (in 
==28797==    by 0x80A78C6: Perl_vcroak (in /usr/local/bin/perl5.8.3-threaded)
==28797==    by 0x80A7A6E: Perl_croak (in /usr/local/bin/perl5.8.3-threaded)
==28797==    Address 0x8 is not stack'd, malloc'd or free'd
Segmentation fault

I've checked line 61 in that's the line on which sub 
async {} is defined.

Some more checking reveals that the bizarry copy occurs when it's 
"goto"ing "new".  However, if I replace the goto with a threads->new( 
@_ ), then the problem still occurs at the same location.

Liz Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About