Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 8098
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: at [...] altlinux.org
megath [...] iof.ru
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.31_5
Fixed in: 1.40



Subject: thread safety and CLONE.
$dbh->connect; $dbh->disconnect; undef $dbh; #what should I do here ? how to really destroy $dbh ? threads->create(...); # each thread allocate its own connection. Pg has no driver CLONE() function so is unsafe threaded thread failed to start: DBD::Pg::dr connect failed: handle 1 is owned by thread 804c008 not current thread 83fc3b8 (handles can't be shared between threads and your driver may need a CLONE method added) at /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi/DBI.pm line 590, <F> line 2. perl DBI 1.40-4 perl DBD Pg 1.31-5
Subject: add CLONE method for use with threads
Hello, DBD::Pg doesnot work in multi-threaded mode because it lacks CLONE method. The following simple patch fixes the problem. -- Alexey Tourbin ALT Linux Team
--- DBD-Pg-1.32.orig/Pg.pm 2004-02-25 21:25:52 +0300 +++ DBD-Pg-1.32/Pg.pm 2004-10-27 01:02:52 +0400 @@ -94,6 +94,10 @@ return $dbh->{private_dbdpg}{pg_use_catalog}; } + sub CLONE { + undef $drh; + } + 1; }