Repository navigation
Fix PgEncoder to fully close the connection on idle timeout - #1756
Open
tsegismont wants to merge 1 commit into
Open
tsegismont wants to merge 1 commit into
tsegismont wants to merge 1 commit into
Conversation
See eclipse-vertx#1755 PgEncoder.close() used channel.shutdownOutput() to send EOF after the Terminate message. This is a TCP half-close: the client sends FIN but waits for the server's FIN before channelInactive fires. When the server is unresponsive the channel hangs open indefinitely, which means ch.closeFuture() never completes and the connection is never released. Replace shutdownOutput() with ctx.close() so the full Netty close is initiated from the client side immediately after flushing the Terminate message, regardless of whether the server responds. Also propagate ctx.close(promise) in the overridden Netty close handler so the pipeline promise is completed rather than silently dropped. Add testReadIdleTimeoutClosesConnection: a raw Java ServerSocket completes the PG handshake then stays silent. With readIdleTimeout=200ms the idle handler fires and closes the channel. Without the fix the closeHandler never fires and the test times out. Assisted-By: Claude Sonnet 4.6 Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
vietj
reviewed
Oct 20, 2026
vietj
left a comment
Member
There was a problem hiding this comment.
the test should avoid using java net socket
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #1755
PgEncoder.close() used channel.shutdownOutput() to send EOF after the Terminate message. This is a TCP half-close: the client sends FIN but waits for the server's FIN before channelInactive fires. When the server is unresponsive the channel hangs open indefinitely, which means ch.closeFuture() never completes and the connection is never released.
Replace shutdownOutput() with ctx.close() so the full Netty close is initiated from the client side immediately after flushing the Terminate message, regardless of whether the server responds.
Also propagate ctx.close(promise) in the overridden Netty close handler so the pipeline promise is completed rather than silently dropped.
Add testReadIdleTimeoutClosesConnection: a raw Java ServerSocket completes the PG handshake then stays silent. With readIdleTimeout=200ms the idle handler fires and closes the channel. Without the fix the closeHandler never fires and the test times out.
Assisted-By: Claude Sonnet 4.6