pg.ddx.io  GitHub: pgjdbc/pgjdbc (issues + PRs as email threads)  
help / color / mirror / Atom feed
From: vlsi (@vlsi) <noreply+vlsi@github.com>
To: pgjdbc/pgjdbc <noreply+pgjdbc-pgjdbc@github.com>
Subject: Re: [pgjdbc/pgjdbc] PR #3964: feat: add tcpKeepAliveCount, tcpKeepAliveIdle and tcpKeepAliveInterval connection properties
Date: Thu, 22 Oct 2026 08:14:13 +0000
Message-ID: <gh-pgjdbc-pgjdbc-3964-rc4346009497@github.com> (raw)
In-Reply-To: <gh-pgjdbc-pgjdbc-3964@github.com>
References: <gh-pgjdbc-pgjdbc-3964@github.com>

(on pgjdbc/src/main/java/org/postgresql/core/TcpKeepSettings.java)

A value the operating system rejects is ignored with a WARNING, while `0` and negative values fail the connection with `INVALID_PARAMETER_VALUE`. From the user's side the boundary between the two is arbitrary, and the warning path hides the typical mistake. `tcpKeepAliveIdle=60000` (milliseconds instead of seconds) is rejected on Linux, where `TCP_KEEPIDLE` accepts 1..32767, so the connection keeps the 7200-second default the user was trying to shorten. Linux rejects `tcpKeepAliveCount=200` the same way, since `TCP_KEEPCNT` accepts at most 127. libpq does not ignore a rejected value: `setKeepalivesIdle` returns 0 after `libpq_append_conn_error(conn, "%s(%s) failed: %s", "setsockopt", ...)`, and that address fails. Only an option missing at compile time is a silent no-op. The class comment at :27–28 ("Like libpq, … rejects is ignored with a warning") states the opposite.

The earlier review asked for the out-of-range case to take the shape `tcpKeepAliveCount=abc` already has. Please report an OS rejection as a `PSQLException` with `INVALID_PARAMETER_VALUE` naming the property and the value. It should not mark the host `ConnectFail` in `GlobalHostStatusTracker`: both the `IOException` and the `SQLException` catch in `openConnectionImpl` do that today, and the value is rejected the same way for every host. Keep warn-and-continue for unsupported options only, and update the docs sentence "or the operating system rejects the value, the driver logs a warning".

view thread (85+ messages)  latest in thread

Message-ID: <gh-pgjdbc-pgjdbc-3964-rc4346009497@github.com>
Permalink:  ../gh-pgjdbc-pgjdbc-3964-rc4346009497@github.com/

 · 


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