Repository navigation
Use fewer stateful-prepare insert threads for regular sanitizer runs - #110185
alexey-milovidov merged 2 commits into
Conversation
The hits_s3 stateful data prepare INSERT (INSERT INTO test.hits_s3 SELECT * FROM test.hits) runs with max_insert_threads=16 on regular sanitizer Stateless jobs, tracking ~24 GiB and pushing ASan RSS to ~42 GiB, which memcg-OOM-kills the server (Server died + OOM in dmesg). The prior reduction to 4 threads only applied to bugfix-validation runs because build_type is only passed there. Fall back to the job name to detect the sanitizer on the regular path too, mirroring the limit_source pattern in functional_tests.py::run_tests. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
cc @alexey-milovidov — follow-up to #109954: that reduced stateful-prepare insert threads to 4 on sanitizer builds, but only on the bugfix-validation path (build_type is only passed there). Regular sanitizer Stateless jobs still used 16 threads, so the hits_s3 INSERT tracked ~24 GiB and OOM-killed the server. This falls back to the job name to detect the sanitizer on the regular path too. |
|
Workflow [PR], commit [742062b] Summary: ✅ AI ReviewSummaryThis PR tries to make Findings
Final Verdict
|
CI finish ledger — d38e5dfEvery failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
This PR touches only Session id: cron:our-pr-ci-monitor:20260713-020000 |
leshikus
left a comment
There was a problem hiding this comment.
LGTM, this is the same pattern as in functional_tests.py::run_tests
| # just a smaller peak. On regular (non-bugfix-validation) runs build_type | ||
| # is not passed, so fall back to the job name to detect the sanitizer, | ||
| # mirroring the limit_source pattern in functional_tests.py::run_tests. | ||
| sanitizer_source = build_type if build_type is not None else Info().job_name |
There was a problem hiding this comment.
The current regular stateless path already passes a non-None build identifier into prepare_stateful_data: functional_tests.py forwards args.options at ci/jobs/functional_tests.py:870-882, and the CI job definitions populate that with strings like amd_asan_ubsan, distributed plan, parallel / amd_tsan, parallel / amd_msan, WasmEdge, ... (ci/defs/job_configs.py:696, :778, :793, :863). Because of that, the jobs named in the PR description never reach this Info().job_name fallback in current code, so this patch no longer changes the behavior it claims to fix.
If there is still a remaining caller that invokes prepare_stateful_data with build_type=None, could you point to that path? Otherwise this PR looks stale and should probably be dropped or retargeted.
There was a problem hiding this comment.
Confirmed, and the change that made this unreachable is already on this branch.
On master (ca27b5fb05aeef97) prepare_stateful_data has exactly two callers repo-wide, and neither can pass None:
ci/jobs/functional_tests.py:1002passesbuild_types[0] if is_bugfix_validation else args.optionsci/jobs/functional_tests.py:1231passesbugfix_bt
--options is declared with default="" in parse_args, so args.options is always a string; functional_tests.py:397 already depends on that, calling .split(",") on it unconditionally. The commit that moved the detection to the call site is a9bc526b0 "Propagate build type to prepare_stateful_data for normal sanitizer runs" from #110574 (merged 2026-07-18), and it reached this branch in the 2026-07-28 master merge, so the fallback here is dead code on its own head.
Measured rather than argued: I lifted the thread-count statements verbatim from both trees and drove them over the --options string of every functional-tests job instance master defines (61 instances, 29 carrying a sanitizer token). max_insert_threads is identical on all 61. The only input on which the two versions differ is build_type=None, which no caller produces.
One correction to the retarget option: a caller passing an empty --options would also get 16 threads, and this patch would not change that either, since it tests is not None rather than truthiness. No job passes empty --options (0 of 61), so there is nothing left to retarget to.
So this is superseded by #110574 and can be closed.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
The stateful data prepare step runs
INSERT INTO test.hits_s3 SELECT * FROM test.hitswithmax_insert_threads=16. On regular sanitizer Stateless jobs this single INSERT tracks ~24 GiB and pushes ASan RSS to ~42 GiB, which memcg-OOM-kills the server (Server died+OOM in dmesg).#109954 already reduced this to 4 threads on sanitizer builds, but only for the bugfix-validation path, because
build_typeis only passed there. On regular runsbuild_typeisNone, sois_sanitizerwas alwaysFalseand the INSERT still used 16 threads.Fix: when
build_typeis not passed, fall back toInfo().job_nameto detect the sanitizer, mirroring the existinglimit_sourcepattern infunctional_tests.py::run_tests(which already doesbuild_type if build_type is not None else Info().job_name). Same data is loaded, just a smaller peak.Example failure (amd_asan_ubsan, distributed plan, parallel): peak server MemoryTracking 24.2 GiB at 17:47:14 from the single hits_s3 INSERT; server OOM-killed at 42 GiB anon-rss. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110152&sha=729886a3f8576eae108e6bd09bc29c4922a39212&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29
Version info
26.9.1.381(included in26.9and later)