Repository navigation
Backport #100396 to 25.8: Fix TSan data race in Keeper AuthID between preprocess and commit - #108965
Conversation
The `AddAuthDelta` stores a `shared_ptr<AuthID>` that is shared between the delta and the uncommitted state. During `commit`, the code was move-constructing from this shared `AuthID` via `std::move(*operation.auth_id)`, which could race with a concurrent `preprocess` call reading the same `AuthID` through `uncommitted_state.session_and_auth` without holding `auth_mutex`. Fix by copying instead of moving. https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=3134af4b1eeebf8773015eb04eb1aa1a80bd2f17&name_0=MasterCI&name_1=Integration%20tests%20%28amd_tsan%2C%206%2F6%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> (cherry picked from commit 15ad49a)
|
Workflow [BackportPR], commit [d3c675a] |
continue-pr statusThe change is correct and minimal — a one-line backport of #100396: copy instead of The only red is an unrelated, known CI-infra flake, not caused by this PR:
Fix for the flake: I opened #108987 to backport the init.d retry loop to I did not re-run the failed install job (the overall run is still in progress so GitHub refuses) and did not re-merge |
continue-pr updateThe blocker is now resolved. The sole red on the previous head ( The fix for that flake, #108987 (backport of the The backport itself is unchanged — still the one-line copy-instead-of- |
The `initd_test` script in `ci/jobs/install_check.py` on `25.8` runs `clickhouse-client -q 'SELECT version()'` exactly once, immediately after the init.d wrapper prints `Server started`. The wrapper only checks that the pid file exists, but on a slow CI host (notably the `amd_debug` build) the server can take several seconds longer to open the TCP listener on port 9000. The test then fails with `Code: 210. DB::NetException: Connection refused (localhost:9000)`. In the same job the sibling `binary_test` already retries `SELECT version()` in a loop, and on `25.8` backport runs it routinely takes ~4 seconds (4 retries) before the debug server accepts connections, while `initd_test` gives up after the first attempt. This is the same failure mode as ClickHouse#86278, which was fixed on `master` by ClickHouse#106056 ("Extend `Run server init.d` retry budget from 5s to 30s"). That fix never reached `25.8`, so the flake keeps blocking `25.8` backport PRs (for example ClickHouse#108965 and ClickHouse#108917). Because the `25.8` `initd_test` predates the retry loop entirely, ClickHouse#106056 does not cherry-pick cleanly; this commit adapts the same fix by adding a 30-iteration poll loop that breaks early on success, matching the existing `binary_test` and `keeper_test` patterns. `SYSTEMCTL_SKIP_REDIRECT` is intentionally not added, since the `25.8` init.d script does not support it. Related: ClickHouse#86278, ClickHouse#106056 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Backport of #100396 (commit
15ad49a97fd9) to the25.8release branch.The
AddAuthDeltastores ashared_ptr<AuthID>that is shared between the delta and the uncommitted state. Duringcommit, the code was move-constructing from this sharedAuthIDviastd::move(*operation.auth_id), which could race with a concurrentpreprocesscall reading the sameAuthIDthroughuncommitted_state.session_and_authwithout holdingauth_mutex. The fix copies instead of moving.The fix landed on
masteron 2026-03-24 but was never backported, so25.8still has the racystd::move(*operation.auth_id)inKeeperStorage::commit. ThreadSanitizer keeps reporting this data race in the Keeper instance during integration test teardown on25.8and on backport PRs built on it.For example, on the
25.8backport PR #108917 the only CI failure is exactly this race, detected at the shutdown of the unrelatedtest_polymorphic_partscluster:Related issue: #82719.
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
25.8.26.6