[Bast-commits] r3653 - in DBIx-Class/0.08/trunk: .
lib/DBIx/Class/Storage t
captainL at dev.catalyst.perl.org
captainL at dev.catalyst.perl.org
Tue Aug 7 15:11:19 GMT 2007
Author: captainL
Date: 2007-08-07 15:11:18 +0100 (Tue, 07 Aug 2007)
New Revision: 3653
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/trunk/t/50fork.t
Log:
fixed storage->connected fork bug
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2007-08-07 13:07:06 UTC (rev 3652)
+++ DBIx-Class/0.08/trunk/Changes 2007-08-07 14:11:18 UTC (rev 3653)
@@ -1,5 +1,6 @@
Revision history for DBIx::Class
-
+ - fixed storage->connected fork bug
+ (test and fix from Radu Greab)
- refactor Statistics to create debugging filehandle to fix bug with
closed STDERR, update docs and modify Versioned to use Statistics
(original fix from diz)
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2007-08-07 13:07:06 UTC (rev 3652)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2007-08-07 14:11:18 UTC (rev 3653)
@@ -668,6 +668,7 @@
}
else {
$self->_verify_pid;
+ return 0 if !$self->_dbh;
}
return ($dbh->FETCH('Active') && $dbh->ping);
}
Modified: DBIx-Class/0.08/trunk/t/50fork.t
===================================================================
--- DBIx-Class/0.08/trunk/t/50fork.t 2007-08-07 13:07:06 UTC (rev 3652)
+++ DBIx-Class/0.08/trunk/t/50fork.t 2007-08-07 14:11:18 UTC (rev 3653)
@@ -18,7 +18,7 @@
$num_children = 10;
}
-plan tests => $num_children + 5;
+plan tests => $num_children + 6;
use lib qw(t/lib);
@@ -45,6 +45,23 @@
};
ok(!$@) or diag "Creation eval failed: $@";
+{
+ my $pid = fork;
+ if(!defined $pid) {
+ die "fork failed: $!";
+ }
+
+ if (!$pid) {
+ exit $schema->storage->connected ? 1 : 0;
+ }
+
+ if (waitpid($pid, 0) == $pid) {
+ my $ex = $? >> 8;
+ ok($ex == 0, "storage->connected() returns false in child");
+ exit $ex if $ex; # skip remaining tests
+ }
+}
+
my @pids;
while(@pids < $num_children) {
More information about the Bast-commits
mailing list