Subject: | DBI 1.620 causes segfault in Perl when used with module Thread::Pool::Simple. |
I am using Perl version 5.14 on Linux 2.6.32.52_1-osix-3466 (custom
Linux distribution from LFS) with DBI version 1.620 as well as version
0.25 of the module Thread::Pool::Simple (from CPAN).
The module Thread::Pool::Simple does not include any XS code, and itself
uses only the modules Carp, Storable, Thread::Queue and
Thread::Semaphore. These are all included in the Perl distribution as of
Perl 5.14 and possibly also earlier versions.
The attached script causes a segmentation fault in Perl without any
Perl-specific error messages being generated.
It is only necessary to include the DBI module with a use statement in
order to trigger the segfault, creating a database handle is not
necessary. Conversely, removing the use statement causes the script to
work as expected.
Version 1.620 of DBI causes this issue, while 1.616 does not. Based on
the changes document on the DBI CPAN page, the following changes appear
to be potential candidates for the introduction of this problem:
In 1.617:
Enhanced performance for threaded perls (Dave Mitchell, Tim Bunce)
In 1.618:
Significantly optimized DBI internals for threads (Dave Mitchell)
Xsub to xsub calling optimization now enabled for threaded perls.
If it is necessary to contact me, please Cc the email to the following
addresses:
dws@open.ch
fh@open.ch
ras@open.ch
As I will not be available until next Friday.
Thanks for your attention,
Rowan Klöti
Open Systems AG
Subject: | test-segfault.pl |
#!/usr/bin/env perl
use strict;
use warnings;
use lib '/shared/rok/OSAGera/lib';
use lib '/opt/OSAGora/cpan';
use DBI;
use Thread::Pool::Simple;
sub _process_job
{
(my $value) = @_;
return 2 * $value;
}
my $pool = Thread::Pool::Simple->new(
min => 1,
max => 10,
load => 1/10,
do => [
\&_process_job,
],
);
my @values = (1..10);
print "In: @values\n";
my @job_ids = map { $pool->add($_) } @values;
$pool->join();
my @results = map { $pool->remove($_) } @job_ids;
print "Out: @results\n";