Обсуждение: jdbc tcpKeepAlive parameter

Поиск
Список
Период
Сортировка

jdbc tcpKeepAlive parameter

От
John R Pierce
Дата:
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?

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


--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


Re: jdbc tcpKeepAlive parameter

От
Oliver Jowett
Дата:
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