Re: jdbc tcpKeepAlive parameter - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: jdbc tcpKeepAlive parameter
Date
Msg-id CA+0W9LNznYag9+4NzVJbL9zcFkwQSLdKiRA6M2Gi0TLiuELuTg@mail.gmail.com
Whole thread Raw
In response to jdbc tcpKeepAlive parameter  (John R Pierce <pierce@hogranch.com>)
List pgsql-jdbc
On 19 October 2011 12:42, John R Pierce <pierce@hogranch.com> wrote:
> the documentation is a little skimpy on the operation of tcpKeepAlive...
>
> we've got a scenario where the java client applications sometimes abort
> without cleaning up, and leave a postgres server process just sitting there.
>     I'm assuming tcpKeepAlive=true would cause these processes to timeout
> eventually and clean themselves up?   Is this a 2-way keepalive, in that if
> the server process dies, the client connection would timeout, too?

tcpKeepAlive just sets SO_KEEPALIVE on the client socket. These TCP
keepalives are outgoing only.
If you want to detect a dead client, you'll need to set the keepalive
options on the server side.

> on libpq, there's some options for the keepalive interval and count, but I
> don't see any such in JDBC?

Java's socket API only exposes SO_KEEPALIVE, not the finer tuning
options, so we're stuck with the defaults.

Oliver

pgsql-jdbc by date:

Previous
From: John R Pierce
Date:
Subject: jdbc tcpKeepAlive parameter
Next
From: Ana Carolina Comandulli
Date:
Subject: revision of the translation to pt_BR