You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A query on a socket that died silently (a dropped NAT entry, a frozen serverless instance, a half-open TCP connection) waits until TCP gives up, which can take minutes. The server's statement_timeout cannot help, because nothing reaches the server. Keep-alive does not cover data already in flight. Upstream reports: porsager#1089, porsager#513, porsager#394.
Proposal
A query_timeout option in seconds, off by default, plus a per-query .timeout(seconds).
At expiry, send a CancelRequest. On a live socket the query rejects with 57014 and the connection keeps working.
If nothing comes back within a short grace period, destroy the connection and reject with a new QUERY_TIMEOUT code. The socket is presumed dead.
In the phase table this is a queryTimeout event in Ready and Draining (send the cancel and arm the grace timer) and a queryTimeoutGrace event that closes the connection. Initializing needs an explicit decision on whether internal startup queries are covered. No new phase is needed.
Open questions
Option names, in seconds like the existing options.
Grace period length, and whether it is configurable.
Whether the timeout covers queued time or only time on the wire.
Tests
Fake server blackhole mode: the socket stays open and nothing is answered or closed.
Real PostgreSQL in Docker: kill -STOP the backend process for a genuinely silent server, and check the query fails within bounds.
Activity