Repository navigation
tests: Keep the WebSocket pending-read test pumping until its server closes - #3497
Open
madcodelife wants to merge 1 commit into
Open
madcodelife wants to merge 1 commit into
madcodelife wants to merge 1 commit into
Conversation
…closes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
tests::network::websocket_pending_read_does_not_block_write_or_closefails intermittently in theGPUI Shell Componentsjob (3 of the last 40 runs), with:The server saw the pong and the text, but not the close. This is a test race, not a product failure.
Why
The probe script only calls
socket.close()afterawait socket.write(...)resolves, and that continuation runs on the test's main-thread executor. The test pumped the executor once after the server received the text, then blocked onserver.join(). If the write had not resolved by then, nothing could run the close, so the server's 500 ms read timeout expired and it reportedsaw_close == false.Fix
Use the same approach as #2875 for the sibling test: keep pumping the executor until the server thread has finished and the view shows
write-and-close-finished, with a 10 s deadline. Then join the server and assert all three events. The text-received channel is no longer needed.How to Test
cargo test -p gpui-shell --lib websocket_pending_readRan 240 times, 8 in parallel, locally on macOS: all passed. The original code also passed 240/240 locally, so the race could not be reproduced on this machine; the fix is based on the failure output and the ordering above.