Event.pm / ithreads interaction
[email protected] (Elizabeth Mattijsen) Sat, 24 Jan 2004 19:47:19 +0100
| Newsgroups | perl.perl5.porters,perl.loop |
|---|---|
| Message-ID | <p05111b00bc3861d73498@[192.168.56.3]> |
This came in on the perl-loop list (courtesy Gensky Regnus). Not
sure whether this is a problem with Event or with threads.pm. 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 } },
);
Event::loop;
================================================
The valgrind output is
starting thread
Bizarre SvTYPE [64] at
/usr/local/lib/perl5/5.8.3/i686-linux-thread-multi/threads.pm line 61.
==28797== Invalid read of size 4
==28797== at 0x8066888: S_my_exit_jump (in
/usr/local/bin/perl5.8.3-threaded)
==28797== by 0x80667DF: Perl_my_failure_exit (in
/usr/local/bin/perl5.8.3-threaded)
==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 threads.pm: 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