mojolicious/mojo-pg

Mojo::Pg fails to detect dead connection and does not reconnect

tyldum opened this issue · 4 comments

  • Mojo::Pg version: 4.17
  • Perl version: 5.26
  • Operating system: Ubuntu

Steps to reproduce the behavior

On a server that has Mojo:Pg connected issue this query to close all connections:
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity

Expected behavior

Mojo::Pg should create a new socket to the server and execute query.

Actual behavior

Subsequent calls to app->pg->db->query() fails with DBD::Pg::st execute failed: no connection to the server. It will never reconnect.

mst told me to revert commit 9b7e3bf, which is what I did in master...tyldum:revert-9b7e3bfde04c3d3022e12ea387643a78bec62a24

This fixes the issue for me in my lab setup.

Updated the linked fork with a reproducible test. Can create a MR if someone wants, but I considered it too trivial at this point. Besides, the test is a bit destructive in that it will close all connections to the current database, so YMMV if it's safe in your test env.

kraih commented

So, it's been two weeks and nobody has done this too trivial for a PR fix?

kraih commented

Fixed in 4.17. But i'm still rather disappointed that this was not fixed already while i was on vacation.