pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mike Charnoky <noky@nextbus.com>
To: Craig Ringer <ringerc@ringerc.id.au>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Hung JDBC connections
Date: Mon, 11 Jun 2012 11:02:08 -0400
Message-ID: <4FD60870.4040304@nextbus.com> (raw)
In-Reply-To: <4FD416D9.8020808@ringerc.id.au>
References: <4FD20A3F.70602@nextbus.com>
	<4FD416D9.8020808@ringerc.id.au>


On 06/09/2012 11:39 PM, Craig Ringer wrote:
>
> Of course, It's not very friendly for the JDBC driver to wait 
> indefinitely without periodically checking and seeing if the 
> connection was progressing, so I'm glad to see that's changed in  9.1.
>
I took a look at the 9.1 JDBC driver source code, very enlightening. I 
see that Statement.setQueryTimeout() doesn't actually do anything! The 
method sets a member variable which is never accessed locally or by any 
subclasses or via getQueryTimeout(). There is even the following comment 
in AbstractJdbc2Statement:
     /** Timeout (in seconds) for a query (not used) */
     protected int timeout = 0;

I see that ConnectionFactoryImpl does allow the underlying Socket's 
so_timeout and so_keepalive options to be set using the connection 
parameters string: 
http://jdbc.postgresql.org/documentation/91/connect.html (socketTimeout 
and tcpKeepAlive). Didn't realize these options existed, I will 
definitely be taking advantage of these.

However, I see these options were available as far back as 8.4. What 
exactly are these driver changes in 9.1 that you mentioned???


Mike



view thread (9+ messages)  latest in thread

Message-ID: <4FD60870.4040304@nextbus.com>
Permalink:  ../4FD60870.4040304@nextbus.com/
Also on:    postgresql.org/message-id/4FD60870.4040304@nextbus.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: noky@nextbus.com, ringerc@ringerc.id.au
  Subject: Re: Hung JDBC connections
  In-Reply-To: <4FD60870.4040304@nextbus.com>
  References: <4FD20A3F.70602@nextbus.com> <4FD416D9.8020808@ringerc.id.au> <4FD60870.4040304@nextbus.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox