Repository navigation
test(chaos): ProbeExecutorTest's exec stub keeps the stream open until the client has read the exit status - #383
Merged
Merged
Conversation
…l the client has read the exit status cmdProbeComparesTheOutputOfACommandThatExitedZero failed PR #374's CI with "ended without an exit status". The cause is in fabric8's mockwebserver. Its WebSocketSession queues the open messages one at a time, and its executor closes the socket as soon as no message is pending. When it sent the output before the status was queued, it closed the socket first, and exitCode() completed with null. waitFor(50) did not help, because a ready-made StatusStreamMessage keeps a delay of 0. On main, the two exit-status tests failed 1 run in 1,000. execWithStatus now also expects a client message that never comes. The mock keeps a socket open while it waits for one, so the client closes the socket itself once it has read the status: 0 failures in 4,000 runs. ProbeExecutor is unchanged. fabric8's Vert.x socket reports the close in frame order, so a status the API server sends before its close frame is always read first.
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.
ProbeExecutorTest.cmdProbeComparesTheOutputOfACommandThatExitedZerofailed CI on #374 (run 39061200842, attempt 1) withthe command in pod krafter-brokers-0 ended without an exit status.Cause: the mock server, not ProbeExecutor
fabric8 mockwebserver 7.2.0
WebSocketSession.onOpencallssend()once per message. Each call adds the message topendingMessages, then schedules it on a 1-thread executor. After each send, the executor closes the socket ifpendingMessagesis empty. When the executor sent the output beforeonOpenhad added the status, it closed the socket first. The status went out after the close, andexitCode()completed with null. ThewaitFor(50)from #368 did not help: a ready-madeStatusStreamMessagekeeps a delay of 0.Production cannot hit this. fabric8's
VertxWebSocketreports the close from Vert.x'sendHandler, which runs in frame order, so a status the API server sends before its close frame is always read first.Fix
execWithStatusalso expects a client message that never comes (.expect("never sent").andEmit("unused").always()). While the mock is waiting for a client message, it never closes the socket itself. The client closes it once it has read the status.waitFor(50)becomesimmediately(), since it never added a delay.exec(...)is unchanged. It sends one message and no status, for the test of a stream that ends without one, and a single message cannot race.Checks (local)
@RepeatedTest(500)on the two exit-status tests: 1 failure in 1,000 runs, with the CI error.@RepeatedTest(2000): 0 failures in 4,000 runs, and no slowdown (about 117 ms per run against 108 ms).ProbeExecutorTest, 20 runs in a row: all 48 tests passed every time.spotless:checkon JDK 25 passed, and so didgo test ./cmd -run TestMCPCaveat. No caveat ref cites this file.