Re: PostgreSQL query timeout do not stop JDBC client attempt to read data from the server

From: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>, Michał Niklas <michal(dot)niklas(at)heuthes(dot)pl>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: PostgreSQL query timeout do not stop JDBC client attempt to read data from the server
Date: 2016-06-26 18:50:04
Message-ID: CAB=Je-HrS2N51W+sJFj7C1iHbZtWn=hu=_UaXLDHjLN6djdx_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Dave> This
https://www.postgresql.org/message-id/alpine.BSO.2.03.1309261345001.26217%40ejurka.com
might be related.

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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Benoit Salotti 2016-06-28 09:41:26 How to send queries to master and failover to slave ?
Previous Message Dave Cramer 2016-06-25 12:40:38 Re: PostgreSQL query timeout do not stop JDBC client attempt to read data from the server