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-rc4346009478@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/PGStream.java:255)

The copy constructor no longer copies `SO_KEEPALIVE` from the old socket, while it still copies the buffer sizes, `soTimeout` and `tcpNoDelay`. Keep-alive now comes only from `tcpKeepSettings`, so:

- a stream built with the 4-arg constructor (`TcpKeepSettings.NONE`, `alive == null`) whose caller called `getSocket().setKeepAlive(true)` loses keep-alive on copy;
- a stream opened with `tcpKeepAlive=false` (or unset) and then switched on through `getSocket().setKeepAlive(true)` gets `false` reapplied on copy.

`ConnectionTest.pGStreamSettings` on master tests exactly the second case: `TestUtil.openDB()` without `tcpKeepAlive`, then `pgStream.getSocket().setKeepAlive(true)` and `assertTrue(newStream.getSocket().getKeepAlive())`. The PR changes the test to set the property instead. Please keep the `getKeepAlive()`/`setKeepAlive()` copy next to the other options (for streams the driver builds, it writes the value `tcpKeepSettings` already set). Restore `pGStreamSettings` as on master, and add the property-driven case as a separate test.

view thread (85+ messages)  latest in thread

Message-ID: <gh-pgjdbc-pgjdbc-3964-rc4346009478@github.com>
Permalink:  ../gh-pgjdbc-pgjdbc-3964-rc4346009478@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