Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id F38CF19F3CE for ; Mon, 11 Jun 2012 12:02:25 -0300 (ADT) Received: from mail.nextbus.com ([70.36.235.122] helo=toque.corp.nextbus.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Se68O-0004Uf-UD for pgsql-jdbc@postgresql.org; Mon, 11 Jun 2012 15:02:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by toque.corp.nextbus.com (Postfix) with ESMTP id D0C6B150023D; Mon, 11 Jun 2012 08:02:11 -0700 (PDT) X-Virus-Scanned: amavisd-new at nextbus.com Received: from toque.corp.nextbus.com ([127.0.0.1]) by localhost (toque.corp.nextbus.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uTAhquNc1Hlu; Mon, 11 Jun 2012 08:02:11 -0700 (PDT) Received: from papa.noky.net (cpe-74-79-19-54.twcny.res.rr.com [74.79.19.54]) by toque.corp.nextbus.com (Postfix) with ESMTPSA id 63A371500272; Mon, 11 Jun 2012 08:02:10 -0700 (PDT) Message-ID: <4FD60870.4040304@nextbus.com> Date: Mon, 11 Jun 2012 11:02:08 -0400 From: Mike Charnoky User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Craig Ringer CC: pgsql-jdbc@postgresql.org Subject: Re: Hung JDBC connections References: <4FD20A3F.70602@nextbus.com> <4FD416D9.8020808@ringerc.id.au> In-Reply-To: <4FD416D9.8020808@ringerc.id.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/51 X-Sequence-Number: 23045 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