From: Peter Rabbitson <ribasushi@cpan.org>
Date: Tue, 28 Dec 2010 11:25:00 +0000 (+0100)
Subject: Fix a deadlock-prone test
X-Git-Tag: v0.08126~2
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=02050e77ae9d754e33ca2d5391f5a6bbbe3e43b1;p=dbsrgits%2FDBIx-Class.git

Fix a deadlock-prone test
---

diff --git a/Changes b/Changes
index 18a67f9..d6500b3 100644
--- a/Changes
+++ b/Changes
@@ -4,6 +4,7 @@ Revision history for DBIx::Class
         - Bump forgotten Class::Accessor::Grouped core dependency
         - Promote forgotten Hash::Merge optdep to a hard requirement
         - Skip t/storage/error.t on smokers with leaking perls
+        - Fix t/storage/txn.t deadlocks on slower machines
 
 0.08125 2010-12-27 04:30 (UTC)
     * New Features / Changes
diff --git a/t/storage/txn.t b/t/storage/txn.t
index 895eaaa..c4ecefd 100644
--- a/t/storage/txn.t
+++ b/t/storage/txn.t
@@ -233,6 +233,12 @@ sub _test_forking_action {
   for my $pid (@pids) {
     waitpid ($pid, 0);
     ok (! $?, "Child $pid exit ok (pass $pass)");
+  }
+
+  # it is important to reap all children before checking the final db-state
+  # otherwise a deadlock may occur between the transactions running in the
+  # children and the query of the parent
+  for my $pid (@pids) {
     isa_ok ($schema->resultset ('Artist')->find ({ name => "forking action $pid" }), 'DBIx::Class::Row');
   }
 }