Re: PostgreSQL query timeout do not stop JDBC client attemptto read data from the server - Mailing list pgsql-jdbc

From Vladimir Sitnikov
Subject Re: PostgreSQL query timeout do not stop JDBC client attemptto read data from the server
Date
Msg-id CAB=Je-HrS2N51W+sJFj7C1iHbZtWn=hu=_UaXLDHjLN6djdx_A@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL query timeout do not stop JDBC client attempt to read data from the server  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc

Dave, as Michael's stacktrace includes QueryExecutorImpl.processResults -> PGStream.ReceiveChar, that means the issue has nothing to do with TCP deadlock. The client somehow fails to detect socket failure => it looks like OS-TCP timeouts => it looks like a misconfigured firewall (e.g. the one that silently drops connections that are idle for more than 30 seconds).

Michael, can you please clarify if your setup involves firewalls in-between app and PG?

TCP deadlock symptom is "JDBC is trying to send more data, while the backend is trying to send response".

It is strange that in Michael's case pgjdbc thinks the connection is still alive.

We can try to protect from that kind of case by adding java-level interrupt (and/or set socket timeout to some finite value). However, adding proper interrupt logic does not seem easy, so I would still appreciate more details on the case (and/or reproducer).

Vladimir

pgsql-jdbc by date:

Previous
From: Vladimir Sitnikov
Date:
Subject: Re: PostgreSQL query timeout do not stop JDBC client attempt to read data from the server
Next
From: Benoit Salotti
Date:
Subject: How to send queries to master and failover to slave ?