Repository navigation
Fix fork deadlock in uexpect causing test_interactive_totp_authentication timeout - #100299
Merged
Merged
Conversation
…ication` timeout under MSan The test hung at `Popen` when spawning the 5th bash process, stuck at `os.read(errpipe_read, 50000)` for 900s until pytest-timeout killed it. Root cause: `preexec_fn=os.setsid` forces Python to use fork+exec instead of the safer posix_spawn/vfork path. Combined with leftover reader daemon threads (never joined), this creates a multi-threaded fork deadlock: a reader thread holds a lock during fork(), and the child process deadlocks trying to acquire it. Two fixes: 1. Replace `preexec_fn=os.setsid` with `start_new_session=True` — the equivalent Python 3.2+ parameter that doesn't force the slow fork path, avoiding multi-threaded fork deadlocks. 2. Join the reader thread in `IO.close` to ensure proper cleanup before the next session is created. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100290&sha=55b637c00a57c55412341f944e3d40154b1d635f&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%203%2F6%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 task
Contributor
|
Workflow [PR], commit [d971f12] Summary: ✅ AI ReviewSummaryThis PR updates ClickHouse Rules
Final Verdict
|
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.
Fix fork deadlock in
uexpectthat causedtest_interactive_totp_authenticationto hang for 900s under MSan.The test spawns 10 sequential interactive client sessions via pty. After 4 sessions completed, the 5th hung at
Popen(stuck atos.read(errpipe_read)) becausepreexec_fn=os.setsidforces Python to use fork+exec, and leftover reader daemon threads (never joined) caused a multi-threaded fork deadlock.Two fixes:
preexec_fn=os.setsidwithstart_new_session=True— avoids forcing the slow fork pathIO.closeto ensure cleanup before the next sessionhttps://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100290&sha=55b637c00a57c55412341f944e3d40154b1d635f&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%203%2F6%29
#100290
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.4.1.112