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: Wed, 09 Sep 2026 20:20:23 +0000
Message-ID: <gh-pgjdbc-pgjdbc-3964-rc3972654797@github.com> (raw)
In-Reply-To: <gh-pgjdbc-pgjdbc-3964@github.com>
References: <gh-pgjdbc-pgjdbc-3964@github.com>
(on .github/workflows/matrix.mjs)
Retracting what I wrote here earlier: the axis should stay. Running the whole suite with the properties set is exactly the coverage worth having — the question it answers is not "do the probes fire" but "does the mere presence of the setting break anything", and it already answered that, since the Windows failure below is the axis doing its job. Keeping it also closes a standing gap: `tcpKeepAlive` itself has never been in the matrix.
What I would change is the values.
**Split `yes` into "keep-alive on" and "keep-alive tuned".** `tcpKeepAlive=true` works on every JDK and every OS, so it should not be gated behind the JDK 11 check that line 535 applies to the whole group — today a Java 8 job titled `keep_alive` sets nothing at all. The three tuning properties are the part with a platform floor.
```js
matrix.addAxis({
name: 'keep_alive',
title: x => x.value === 'no' ? '' : 'keep_alive_' + x.value,
values: [
{value: 'no', weight: 60}, // This is the default value, prefer testing it more
{value: 'on', weight: 20},
{value: 'tuned', weight: 20},
]
});
```
and at line 535:
```js
if (v.keep_alive !== 'no') {
testJvmArgs.push('-DtcpKeepAlive=true');
}
if (v.keep_alive === 'tuned') {
testJvmArgs.push('-DtcpKeepAliveIdle=30', '-DtcpKeepAliveInterval=10', '-DtcpKeepAliveCount=9');
}
```
**On the numbers.** `tcpKeepAliveIdle=30` is a good choice — far from the 7200 default, so a wrong value is visible, and short enough that an idle pooled connection in the suite actually reaches the probing state. `tcpKeepAliveInterval=1` with `tcpKeepAliveCount=9` is the one I would raise: it gives a 9-second death window, and a 9-second stall is not exotic on a loaded runner with a containerised server doing `fsync`. `interval=10` keeps the window at 90 seconds — still two orders of magnitude below the stock `7200 + 9*75` and still proof that the values took effect, without inventing flakiness that looks like a driver bug.
**On gating `tuned`.** That depends on how the capability question above is resolved. If the driver ends up ignoring an unsupported option with a warning, as libpq does, no gating is needed and `tuned` can run everywhere — which is the better outcome, because then the axis also covers the ignore path. If setting an unsupported option stays fatal, the axis has to avoid the combinations where it is unsupported:
```js
// jdk.net keep-alive socket options: Linux and macOS from JDK 11, Windows from JDK 22
matrix.imply({keep_alive: {value: 'tuned'}}, {java_version: v => v === eaJava || v >= 11});
matrix.exclude({keep_alive: {value: 'tuned'}, os: {value: 'windows-latest'}, java_version: v => v < 22});
```
Note `v.java_version >= 11` at line 535 is NaN-false for the early-access row, so as written `-ea` never exercises the feature; `:341` shows the idiom that handles that.
Style nits while the block is being touched: the axis is indented 3 and 4 spaces where every neighbour uses 2, and it is the only axis whose values carry no comment saying which value is the default.