Diagnostic Queries
Symptoms
The client stopped receiving data from the server and the read timed out. The driver reports SQLSTATE 08006 (connection_failure).
- A read on the connection timed out.
- Common with network stalls or an unresponsive server.
- May follow a long query or a dropped network path.
What the server log shows
could not receive data from server: Connection timed out
Why PostgreSQL raises this — what the manual says
Section 32.2 Connection Status Functions:
“Ordinarily, an OK status will remain so until PQfinish, but a communications failure might result in the status changing to CONNECTION_BAD prematurely.”
When the client waits for server data beyond the socket/keepalive timeout (because the server is unresponsive or the network path failed), the read times out and the driver reports 08006.
Common causes
- Network instability or a severed path mid-query.
- An unresponsive/overloaded server backend.
- Firewall/NAT idle timeouts silently dropping the connection.
How to fix it
- Reconnect and retry; design for transient network failures.
- Tune TCP keepalives (
tcp_keepalives_idle, etc.) to detect dead connections. - Investigate server load/long queries and network reliability; use a pooler.
Related & next steps
Reference: PostgreSQL 18 Section 34.1 “Connection Control”.
Thanks — noted. This helps keep the database accurate.