Skip to content

[5.2] Fix PgEncoder to fully close the connection on idle timeout - #1761

Merged
tsegismont merged 1 commit into
5.2from
backport/1760-to-5.2
Oct 21, 2026
Merged

tsegismont merged 1 commit into
5.2from
backport/1760-to-5.2

Conversation

@tsegismont

Copy link
Copy Markdown
Member

Backport of #1760 to 5.2
Cherry-picked commit: faf9310

See #1755

The `PgEncoder` close override sends the Terminate message but was not propagating the close, so the channel never fully closed when `readIdleTimeout` fired on an unresponsive connection.

Propagate `ctx.close(promise)` when `closeSent` is false; otherwise wire the promise to `ch.closeFuture()` to let the normal `shutdownOutput` cycle complete without cutting off in-flight server responses.

Add `testReadIdleTimeoutClosesConnection` using a Vert.x `NetServer` with `ALLOW_HALF_CLOSURE` to simulate an unresponsive server that doesn't send FIN back.

Fix `testMaximumParametersExceeded` to use `asyncAssertFailure` so the VertxUnit runner waits for the query result.
Without this, the runner tears down the `Vertx` instance immediately after the test method returns, closing the PG connection before the server response arrives, which changes the failure reason from a parameter count error to a connection lost error.

Assisted-By: Claude Opus 4.6

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
(cherry picked from commit faf9310)
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
@tsegismont tsegismont modified the milestone: 5.2.3 Oct 21, 2026
@tsegismont
tsegismont merged commit ecfaf27 into 5.2 Oct 21, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant