Repository navigation
Conversation
shouldHonourConfiguredUpstreamConnectTimeout read System.nanoTime() only after the AdminClient had been constructed in the outer try-with-resources header. The AdminClient bootstraps on construction, and that is the sole trigger for the proxy's upstream dial, so the clock started after the connect timeout window had already begun. The measured elapsed therefore spanned less than the configured 2s timeout, and under CI jitter the floor assertion could go negative and fail intermittently. Read the clock before creating the Admin by moving its construction into a nested try-with-resources after startedAt, so the measured window fully contains the connect timeout. Re-enable the test that was temporarily disabled in kroxylicious#5111. Relates-to: kroxylicious#5111 Assisted-by: Claude Opus 4.8 <[email protected]> Signed-off-by: AdityaThakur1998 <[email protected]>
|
|
SamBarker
pushed a commit
to Divyanshkumar62/kroxylicious
that referenced
this pull request
Oct 28, 2026
…roxylicious#5140) shouldHonourConfiguredUpstreamConnectTimeout read System.nanoTime() only after the AdminClient had been constructed in the outer try-with-resources header. The AdminClient bootstraps on construction, and that is the sole trigger for the proxy's upstream dial, so the clock started after the connect timeout window had already begun. The measured elapsed therefore spanned less than the configured 2s timeout, and under CI jitter the floor assertion could go negative and fail intermittently. Read the clock before creating the Admin by moving its construction into a nested try-with-resources after startedAt, so the measured window fully contains the connect timeout. Re-enable the test that was temporarily disabled in kroxylicious#5111. Relates-to: kroxylicious#5111 Assisted-by: Claude Opus 4.8 <[email protected]> Signed-off-by: AdityaThakur1998 <[email protected]> Signed-off-by: Sam Barker <[email protected]>
franvila
pushed a commit
to franvila/kproxy
that referenced
this pull request
Oct 30, 2026
…roxylicious#5140) shouldHonourConfiguredUpstreamConnectTimeout read System.nanoTime() only after the AdminClient had been constructed in the outer try-with-resources header. The AdminClient bootstraps on construction, and that is the sole trigger for the proxy's upstream dial, so the clock started after the connect timeout window had already begun. The measured elapsed therefore spanned less than the configured 2s timeout, and under CI jitter the floor assertion could go negative and fail intermittently. Read the clock before creating the Admin by moving its construction into a nested try-with-resources after startedAt, so the measured window fully contains the connect timeout. Re-enable the test that was temporarily disabled in kroxylicious#5111. Relates-to: kroxylicious#5111 Assisted-by: Claude Opus 4.8 <[email protected]> Signed-off-by: AdityaThakur1998 <[email protected]> Signed-off-by: Francisco Vila <[email protected]>
franvila
pushed a commit
to franvila/kproxy
that referenced
this pull request
Nov 18, 2026
…roxylicious#5140) shouldHonourConfiguredUpstreamConnectTimeout read System.nanoTime() only after the AdminClient had been constructed in the outer try-with-resources header. The AdminClient bootstraps on construction, and that is the sole trigger for the proxy's upstream dial, so the clock started after the connect timeout window had already begun. The measured elapsed therefore spanned less than the configured 2s timeout, and under CI jitter the floor assertion could go negative and fail intermittently. Read the clock before creating the Admin by moving its construction into a nested try-with-resources after startedAt, so the measured window fully contains the connect timeout. Re-enable the test that was temporarily disabled in kroxylicious#5111. Relates-to: kroxylicious#5111 Assisted-by: Claude Opus 4.8 <[email protected]> Signed-off-by: AdityaThakur1998 <[email protected]> Signed-off-by: Francisco Vila <[email protected]>
franvila
pushed a commit
to franvila/kproxy
that referenced
this pull request
Nov 18, 2026
…roxylicious#5140) shouldHonourConfiguredUpstreamConnectTimeout read System.nanoTime() only after the AdminClient had been constructed in the outer try-with-resources header. The AdminClient bootstraps on construction, and that is the sole trigger for the proxy's upstream dial, so the clock started after the connect timeout window had already begun. The measured elapsed therefore spanned less than the configured 2s timeout, and under CI jitter the floor assertion could go negative and fail intermittently. Read the clock before creating the Admin by moving its construction into a nested try-with-resources after startedAt, so the measured window fully contains the connect timeout. Re-enable the test that was temporarily disabled in kroxylicious#5111. Relates-to: kroxylicious#5111 Assisted-by: Claude Opus 4.8 <[email protected]> Signed-off-by: AdityaThakur1998 <[email protected]> Signed-off-by: Francisco Vila <[email protected]>
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.



Closes #5111.
ResilienceIT#shouldHonourConfiguredUpstreamConnectTimeoutwas disabled under #5111 after failing intermittently on CI, never locally:Expecting actual: 1.983740463S
to be greater than or equal to: 2S
This re-enables it and fixes the cause. Test-only change.
Cause
The test timed a window that started after the thing it was measuring.
System.nanoTime()was read in the try body, by which point the AdminClient — created in the try-with-resources header — had already bootstrapped and caused the proxy to dial the blackholed address. Soelapsed = CONNECT_TIMEOUT − gap + reconnect, wheregapis the time between the dial starting and the clock being read. The gap sat on the wrong side of the inequality: anything that stalled in it madeelapsedsmaller, and with ~120ms of margin it only had to stall for ~140ms to go negative.Confirmed two ways. First, by inspection:
ServerConnectionStateMachine#initConnectionis the onlyBootstrap.connectinkroxylicious-runtime, reachable only viaconnect(), whose three callers inClientConnectionStateMachineeach require an established downstream client channel.DefaultKroxyliciousTester's constructor creates no client, so nothing in proxy startup can dial. Second, by measurement — scraping everykroxylicious_proxy_to_server*series a full second after the tester was constructed and beforetester.admin()was called:tester.admin()..._connections_total {node_id=bootstrap}proxy_to_serverseriesNo meters registered at all beforehand. The AdminClient is the only trigger, so a clock read before it strictly precedes the dial.
Fix
Read the clock before anything that can initiate an upstream connect, by moving the Admin creation into a nested try after it:
elapsed > CONNECT_TIMEOUT + reconnectnow holds by construction rather than by margin — any pause anywhere increaseselapsedinstead of eating into it. The nested try is why theWhenlabel sits above a resource header; creating the client isn't the action under test, anddescribeCluster()remains a single statement.Testing
Same assertions, same constants, same configuration.
ResilienceITpasses as a full class, 9 tests, 0 skipped.The ~200ms shift is larger than the 1.4ms of construction time the reordering moves. Most likely the gap was dominated by first-use initialisation of the JDK
HttpClientinsideManagementClient, which is cheap once warm and expensive on the first construction in a fork — which would also explain why the failure was order-dependent and so only ever appeared on CI. Not worth chasing further, since the fix removes the term whatever its size.No changelog entry: nothing user-facing changes.
🤖 Assisted by Claude Opus