Repository navigation
Tear down an integration test's cluster when its module ends, not at session end - #117564
Conversation
…session end `Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6)` reports `Container memory budget exceeded (/docker)` with every test in the job passing, including on trees that already carry ClickHouse#117412. Of the 196 such rows across all integration checks on 2026-09-01, 191 are that one shard. `test_refreshable_mat_view` and `test_refreshable_mat_view_replicated`, both on that shard, and `test_distributed_over_distributed` declare their cluster fixture `scope="session"`. A leaf pytest file cannot share a fixture with another file, so session scope buys nothing while the module runs and only defers `cluster.shutdown()` to the end of the xdist worker's session. Their ClickHouse servers, Keepers, MinIO and nginx proxies then stay charged to the `/docker` cgroup leaf for the rest of the ~105 minute job: 12.4-15.2 GiB, 26-37% of that leaf's entire anonymous budget, held by modules that have finished. `worker_plan` cannot account for them. With `ncpu: 16` the `cpus // 5` half binds at 3 workers, so the plan models `3 * 11 = 33 GiB` regardless of the budget, which is why raising the leaf cap from 40.78 to 48.78 GiB moved the ceiling without getting above demand: the leak is a fixed tax, not a share. Module and session scope give a fixture the same lifetime across one file's tests, so this changes no assertion. Measured by replaying docker lifecycle events over four modules run back to back: peak concurrent containers drop from 13 across 4 compose projects to 5 across 1, and each fixed module's last `destroy` moves from 48-286 s after the next module's first `create` to 2 s before it. Running all three modules in full gave the same 126 test outcomes on the unchanged and the changed tree, and over 5 repeats. These are the only 3 of 1120 leaf integration test files that use session scope. In `tests/integration/conftest.py` it is correct, so the new check in `various_checks.sh` is scoped to `test_*/test*.py`; it reports 3 files before this change, 0 after, and exactly 1 when session scope is restored in one file. The shutdown `gdb` attach is a second contributor and is not addressed here. Related: ClickHouse#117412 Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own cold
Severity: ❌ blocker / Independently verified while reviewing, and clean: no session-scoped consumer of the three Session id: cron:clickhouse-review-slot-10:20260901-172800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20260901-161100 |
|
Workflow [PR], commit [72c4b21] Summary: ✅ AI ReviewSummaryThis PR narrows three module-local integration-test cluster fixtures from Missing context / blind spots
Final Verdict✅ No review findings in the current diff. |
|
cc @maxknv, could you review this? Three integration test files declare their cluster fixture |
Related: #117412
Related: #113107
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6)still reportsContainer memory budget exceeded (/docker)with every test in the job passing, on this PR's own base, a master tree that carries #117412. The run cited on #113107 predates it. At 17:35 UTC on 2026-09-01 that one shard is 192 of 197 such rows fleet-wide.https://github.com/ClickHouse/ClickHouse/actions/runs/33296819525/job/99262785281
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=8627fa22f01595b16121a0d6100ef243475c778c&name_0=MasterCI&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%206%2F6%29
Three test files declare their cluster fixture
scope="session"instead ofscope="module":test_refreshable_mat_viewandtest_refreshable_mat_view_replicated, both on this shard, andtest_distributed_over_distributed. A leaf pytest file cannot share a fixture, so session scope only deferscluster.shutdown()to the end of the xdist worker's session. Their servers, Keepers, MinIO and proxies stay resident for the rest of the ~105 minute job, holding 12.4-15.2 GiB, 26-37% of the/dockerleaf's whole anonymous budget.worker_plancannot see them: withncpu: 16the CPU half binds at 3 workers, so it models3 * 11 = 33 GiBat any budget. A fixed tax, not a share, so 8 GiB more cap raised the ceiling without reaching demand.Only 3 of 1120 leaf test files use session scope; in
conftest.pyit is correct, so the newvarious_checks.shcheck is scoped totest_*/test*.py.Module and session scope give a fixture the same lifetime across one file's tests, so no coverage is lost. Replaying docker lifecycle events over four consecutive modules, peak concurrent containers drop from 13 across 4 projects to 5 across 1, and each fixed module's last
destroymoves from 48-286 s after the next module's firstcreateto 2 s before it. All three modules, 126 tests, gave identical outcomes on the unchanged and changed trees and over 5 repeats.Not addressed here: the shutdown
gdbattach is the second contributor, resident at 70 of 154 kernel OOM snapshots at 4.8-7.7 GiB RSS.Workflow [PR]
Sync PR [sync-upstream/pr/117564]
Workflow [PR]
Sync PR [sync-upstream/pr/117564]
Version info
26.9.1.599(included in26.9and later)