Fix Postgres test hang with DBD::Pg 3.5.0+ (work around RT#100648)
authorPeter Rabbitson <ribasushi@cpan.org>
Thu, 8 Jan 2015 00:42:52 +0000 (01:42 +0100)
committerPeter Rabbitson <ribasushi@cpan.org>
Wed, 15 Jun 2016 13:02:32 +0000 (15:02 +0200)
commitb409dead875c0ea3984c66ff5f742628d0dd71b4
tree3ff4f0a8841b35fa0b9be3a20b48eb40aa178544
parentaffbcf255331b5994b23d00f80c98e0d1117a4ee
Fix Postgres test hang with DBD::Pg 3.5.0+ (work around RT#100648)

( cherry-pick of 731c2d8b )

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
Changes
lib/DBIx/Class/Optional/Dependencies.pm
t/72pg.t
xt/optional_deps.t