Subject: | segfault on joining multiple threads using Kavorka |
Date: | Wed, 19 Mar 2014 20:24:47 +0000 |
To: | bug-Kavorka [...] rt.cpan.org |
From: | Aaron Trevena <ajt [...] thermeon.com> |
Using kavorka in threaded code is crashing very hard.. even managing to make my terminal hang, quite impressive for a relatively innocuous test case ..
test script:
use strict;
use Test::More;
use threads;
{
package ThreadedExample;
use Kavorka;
use Moose;
method foo {
return { '$self' => $self, '@_' => \@_ };
}
}
my $subref = sub {
my $id = shift;
warn "id : $id";
# sleep 1;
return $id;
};
my @threads;
foreach my $foo_id (qw/bar1 bar2 bar3 bar4 bar5 bar6/){
push @threads, threads->create($subref, $foo_id);
# sleep 1;
# push @threads, threads->create($subref, $foo_id . 'A');
}
my @results;
for my $thread (@threads){
warn "joining thread $thread";
push @results, $thread->join;
}
ok(1); # didn't explode!
done_testing;
output :
perl -w kavorka_thread.t
id : bar1 at kavorka_thread.t line 16.
id : bar2 at kavorka_thread.t line 16.
id : bar3 at kavorka_thread.t line 16.
id : bar4 at kavorka_thread.t line 16.
id : bar5 at kavorka_thread.t line 16.
joining thread threads=SCALAR(0x941b3b8) at kavorka_thread.t line 30.
id : bar6 at kavorka_thread.t line 16.
joining thread threads=SCALAR(0x941b3d8) at kavorka_thread.t line 30.
joining thread threads=SCALAR(0x941b3f8) at kavorka_thread.t line 30.
*** glibc detected *** perl: malloc(): smallbin double linked list corrupted: 0x0b501738 ***
^C
Sometimes will get segfault and dumped core, using in a Moose::Role will almost always give a segfault rather than the double link list corruption.
We've also seen the same error message happen in the same place with Moops, so it's some trick that they're both doing that fails in this way
Message body is not shown because it is too large.