Skip to content

Added NettyConnector read timeout test for #5600 - #4

Draft
mkarg wants to merge 2 commits into
masterfrom
vibe/issue-5600-netty-read-timeout
Draft

mkarg wants to merge 2 commits into
masterfrom
vibe/issue-5600-netty-read-timeout

Conversation

@mkarg

@mkarg mkarg commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

1 Summary

Issue eclipse-ee4j#5600 reports that NettyConnector does not respect timeouts: a request against a server
that was shut down hangs despite ClientProperties.CONNECT_TIMEOUT being set.

The timeout handling in the current code works: the read timeout is implemented by an
IdleStateHandler in the pipeline (NettyConnector#execute), the IdleStateEvent is handled by
JerseyClientHandler#userEventTriggered, which closes the channel, and
JerseyClientHandler#channelInactive completes the response future with a TimeoutException.
The connect timeout is passed to the Bootstrap via ChannelOption.CONNECT_TIMEOUT_MILLIS.

This PR adds a regression test that verifies ClientProperties.READ_TIMEOUT against a server
that accepts the connection but never sends a response.

2 Verification

All scenarios from eclipse-ee4j#5600 were executed against the current code:

  • READ_TIMEOUT against a server that accepts the connection but never responds:
    the request fails with a ProcessingException caused by a TimeoutException within
    the configured read timeout (new test ReadTimeoutRespectedTest, ~2s for a 2s timeout)
  • Request against a live server, then shutdown the server, then a subsequent request
    with CONNECT_TIMEOUT=30s: fails immediately with Connection refused, no hang
  • CONNECT_TIMEOUT=3s against a non-routable address (dropped SYN, no RST):
    fails with ConnectTimeoutException: connection timed out after 3000 ms after ~3.5s

The existing tests still pass:

mvn -pl :jersey-netty-connector test -Dtest='ReadTimeoutRespectedTest,TimeoutTest,ConnectionExceptionTest'
Tests run: 1, Failures: 0, Errors: 0 -- ReadTimeoutRespectedTest (2.031 s)
Tests run: 5, Failures: 0, Errors: 0 -- TimeoutTest
Tests run: 1, Failures: 0, Errors: 0 -- ConnectionExceptionTest

The issue is no longer reproducible; the reporting user never replied to the reproducer
results in the issue.

Closes eclipse-ee4j#5600

@mkarg
mkarg force-pushed the vibe/issue-5600-netty-read-timeout branch 4 times, most recently from ff81611 to a1726b4 Compare October 22, 2026 16:20
- The test verifies ClientProperties.READ_TIMEOUT against a server that
  accepts the connection but never sends a response
- The elapsed time assertion allows a 2s scheduling margin only, so it
  verifies the configured timeout rather than eventual termination
- A @timeout(10) annotation fails the test deterministically if the
  connector regression makes the request hang forever
- The silent server binds to port 0, so the test does not fail when a
  fixed port is already in use
- All eclipse-ee4j#5600 scenarios pass on the current code, the issue is no longer
  reproducible

Co-authored-by: mkarg <mkarg@users.noreply.github.com>
@mkarg
mkarg force-pushed the vibe/issue-5600-netty-read-timeout branch from a1726b4 to 4d4f0f2 Compare October 22, 2026 16:23
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

NettyConnector does not respect timeouts

1 participant