Repository navigation
Fix race condition in KeeperClient test helper causing flaky test_rm_with_version - #97644
Merged
Merged
Conversation
Contributor
…t_rm_with_version` The `execute_query` method in the Python test helper uses `epoll` to read from both stdout and stderr of the keeper-client process. When a command fails, the keeper-client writes the error to stderr and then the separator to stdout. However, when both events arrive simultaneously in `epoll.poll()`, the loop could process stdout first, find the separator, and return successfully without ever reading the pending stderr error data - causing the exception to be silently swallowed. Fix both sides: - C++ (`KeeperClient.cpp`): flush stderr before writing the stdout separator, ensuring error data is in the pipe buffer first. - Python (`keeper_utils.py`): process stderr events before stdout events in the poll loop, so errors are always collected before checking the separator. Also fix test cleanup: add `try/finally` with `drop_node_if_exists` to `test_rm_with_version` and `test_rm_without_version`, and give `test_rm_without_version` its own unique node path instead of reusing `/test_rm_with_version_node`. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97554&sha=3f86a6142c6920239c1b3adedfe82ccb5fcd6515&name_0=PR&name_1=Integration%20tests%20%28amd_binary%2C%204%2F5%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ests-mode Co-Authored-By: Claude Opus 4.6 <[email protected]>
alexey-milovidov
force-pushed
the
fix-keeper-client-test-race-condition
branch
3 times, most recently
from
February 22, 2026 22:43
36b416c to
5bd35fe
Compare
This was referenced Aug 16, 2026
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.
Summary
KeeperClient.execute_querywhereepollcould process the stdout separator before reading stderr error data, causing exceptions to be silently swallowedcerrbefore writing the stdout separator inrunInteractiveInputStreamto ensure error data reaches the pipe buffer firsttry/finallycleanup and unique node paths totest_rm_with_version/test_rm_without_versionCI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97554&sha=3f86a6142c6920239c1b3adedfe82ccb5fcd6515&name_0=PR&name_1=Integration%20tests%20%28amd_binary%2C%204%2F5%29
#97554
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
🤖 Generated with Claude Code
Version info
26.2.1.1058