Fatal error: Uncaught PDOException: SQLSTATE[HY000] in Laminas DB Adapter: reconnection strategy?
0 reputation · 28 Jun 2022, 03:07 UTC
The goal is to diagnose why intermittent connection pool exhaustion occurs in a Laminas application that uses the Laminas\Db\Adapter\Adapter with persistent PDO connections.
When a database server becomes temporarily unavailable, the adapter throws Fatal error: Uncaught PDOException: SQLSTATE[HY000] and the PDO instance is considered closed. Subsequent queries fail until a new Adapter instance is created. This behavior is documented in Laminas 3.4 and earlier, and a deprecation notice appears in 3.5, but no retry or reconnection logic is exposed.
The unresolved decision is whether the adapter should expose a configurable retry strategy, and how that would interact with PHP‑FPM’s connection pool. This gap can cause a cascade of failures in production when a single broken connection depletes the pool.
1. Does the current Laminas DB Adapter provide any configuration option to enable automatic reconnection or retry on PDOException?
2. If not, what is the recommended pattern for preventing pool exhaustion in a long‑running PHP‑FPM environment?
3. How does enabling PDO::ATTR_PERSISTENT affect the adapter’s handling of failed connections and the need for manual reconnection?