Re: executeQuery hangs on busy server - PROPOSAL: socketTimeout parameter

From: Kris Jurka <books(at)ejurka(dot)com>
To: Andrea Spinelli <aspinelli(at)imteam(dot)it>
Cc: pgsql-jdbc(at)postgresql(dot)org, Alessandro Magnolo <amagnolo(at)imteam(dot)it>, Valerio Mazzoleni <vmazzoleni(at)imteam(dot)it>
Subject: Re: executeQuery hangs on busy server - PROPOSAL: socketTimeout parameter
Date: 2007-08-10 09:43:47
Message-ID: Pine.BSO.4.64.0708100538530.31534@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 10 Aug 2007, Andrea Spinelli wrote:

> I am using jdbc to access a large database on a busy PostgreSQL server (8.1)
> hosted on Windows, from several web applications.
>
> Occasionally, my executeQuery hang forever. They block on a read operation in
> SocketInputStream.socketRead0 (seen on the debugger) and stay there for
> _days_. They disappear only by stopping the application server (Tomcat).

I believe this is a bug in the 8.1 windows port. What's the exact version
you are using? I think this was fixed in 8.1.6.

> connection.setSoTimeout( 120000 );
>
> Long queries (>2min) fail with a SQLException signalling a communication
> problem with the server - which is what I want.
>
> I think this could be reworked into one more connection parameter
> "socketTimeout", where 0 means no timeout; the value of the parameter would
> of course substitute the hard-coded 120000.
>
> I've seen a feature request on GBorg about stopping long-running queries,
> which could be satisfied by what I'm proposing. (actually, the connection
> parameter works connection-wide, while the feature request deals with single
> queries).

People want the query to be stopped, but they don't want their whole
connection to be killed which is what your change does.

Kris Jurka

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message László Hornyák 2007-08-10 10:09:45 Re: statement caching patch from Laszlo Hornyak for review
Previous Message Andrea Spinelli 2007-08-10 08:24:22 executeQuery hangs on busy server - PROPOSAL: socketTimeout parameter