From: Peter Rabbitson Date: Thu, 8 Jan 2015 00:42:52 +0000 (+0100) Subject: Fix Postgres test hang with DBD::Pg 3.5.0+ (work around RT#100648) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=731c2d8bbf4da815c89a02cbd73f2475b7df2406;p=dbsrgits%2FDBIx-Class-Historic.git Fix Postgres test hang with DBD::Pg 3.5.0+ (work around RT#100648) It is not 100% clear to me why this is happening, as the change discussed[1] was not supposed to change behaviour outside of a transaction. The test in question essentially does a blocking request with a timeout. The way the default DBIC machinery works is to issue a ping() after the timeout induced exception, in order to opossibly retry the operation IFF the link went stale ($dbh thinks everything is in order, the RDBMS believes otherwise). After the changes in 3.5.0 this ping() now hangs, even though the access pattern did not change (there are no transactions involved on the handle in question). Either way, the fix is simple: just shim-away the ping for the duration of the test. In general this should be resolved on a higher level by disabling retries for the duration of the test (or maybe even disabling retries by default in the distant feature - see RT#47005) [1] https://rt.cpan.org/Ticket/Display.html?id=100648#txn-1438093 --- diff --git a/Changes b/Changes index 88b863f..40f7c6b 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,9 @@ Revision history for DBIx::Class - Fix incorrect collapsing-parser source being generated in the presence of unicode data among the collapse-points - Fix endless loop on BareSourcelessResultClass->throw_exception(...) + - Fix hang in t/72pg.t when run against DBD::Pg 3.5.0. The ping() + implementation changes due to RT#100648 made an alarm() based + timeout lock-prone. * Misc - Make the Optional::Dependencies error messages cpanm-friendly diff --git a/t/72pg.t b/t/72pg.t index 5f00ff9..548423c 100644 --- a/t/72pg.t +++ b/t/72pg.t @@ -407,9 +407,15 @@ lives_ok { $cds->update({ year => '2010' }) } 'Update on prefetched rs'; sub { die "DBICTestTimeout" }, )); - alarm(2); $artist2 = $schema2->resultset('Artist')->find(1); $artist2->name('fooey'); + + # FIXME - this needs to go away in lieu of a non-retrying runner + # ( i.e. after solving RT#47005 ) + local *DBIx::Class::Storage::DBI::_ping = sub { 1 }, DBIx::Class::_ENV_::OLD_MRO && Class::C3->reinitialize() + if DBIx::Class::_Util::modver_gt_or_eq( 'DBD::Pg' => '3.5.0' ); + + alarm(1); $artist2->update; };