Repository navigation
Conversation
Flaky and targeted integration checks size the pool as `min(ncpu // MAX_CPUS_PER_WORKER, mem_gb // MAX_MEM_PER_WORKER_DIST_EACH)`. An `amd-medium` runner logs `ncpu: 16` and `mem_gb: 61`, so the 20 GB budget still yields three workers. Each `--dist=each` worker runs the whole changed module set in its own Docker cluster, and three of them - a Hadoop JVM, `minio`, the S3 proxies and several ASan servers each - exhaust the 62.7 GB container cgroup. The kernel OOM killer takes `pytest` and then `dockerd`, the run reports `node down: Not properly terminated` and overruns its session timeout. 24 GB per worker gives two workers here and three from 72 GB up. Sequential repeats stay at `max(3, workers)`, so the flakiness signal is unchanged. ClickHouse#107529 introduced the 20 GB budget against the same failure and intended two workers on a 60 GB runner; the runner reports 61 GB, one GB above the point where the division changes. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115277&sha=8a253f5b442c2503d40d0606fc79197de555a851&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 Related: ClickHouse#115277 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [d7f7499] Summary: ✅ AI ReviewSummaryThis PR changes integration-test worker sizing so flaky and targeted runs use the job cgroup limit instead of host RAM, and it rejects worker plans that exceed that enforced limit. The sizing logic looks consistent with the failure report, but I would not clear the review yet because the new Tests
Final Verdict
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
Review pointed out that the previous commit raised `MAX_MEM_PER_WORKER_DIST_EACH` to compensate a measurement error rather than fixing it, and that the reserved headroom would drift again. That is right, and the gap is by construction: `ci/defs/job_configs.py` starts the integration container with `--memory=LIMITED_MEM`, i.e. `physical_memory() - 2 GiB`, while the sizing code inside that container reads host RAM through `Utils.physical_memory` and so over-counts by exactly the reserved 2 GiB - the failing job logged `mem_gb: 61` against an enforced limit of 59 GiB. `Utils.memory_limit` resolves the job's own cgroup through `/proc/self/cgroup` and reads `memory.max` (v2) or `memory.limit_in_bytes` (v1), falling back to physical memory when there is no limit. Resolving the path is required rather than reading the mount root: CI passes `--cgroupns=host`, so `/sys/fs/cgroup/memory.max` is the host root cgroup and reads as `max`. Verified under Docker with `--memory=2g` on a 7 GiB host: `cgroupns=private` resolves `/sys/fs/cgroup/memory.max`, `cgroupns=host` resolves `/sys/fs/cgroup/docker/<id>/memory.max`, both returning 2 GiB. With the enforced limit, `min(16 // 5, 59 // 20) = 2` workers, so `MAX_MEM_PER_WORKER_DIST_EACH` goes back to 20. Loadfile runs are unchanged: `min(16 // 5, 59 // 11) = 3`, as before. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
| return int(subprocess.check_output(["sysctl", "-n", "hw.memsize"]).strip()) | ||
|
|
||
| @staticmethod | ||
| def memory_limit() -> int: |
There was a problem hiding this comment.
Now that flaky/targeted worker sizing depends entirely on Utils.memory_limit, this helper needs focused regression coverage for the cgroup layouts it branches on. Please add a small ci/tests matrix for cgroup v2 (memory.max), cgroup v1 (memory.limit_in_bytes), and the unlimited cases (max / v1 sentinel) so a parsing regression here cannot silently send these jobs back to sizing off host RAM.
There was a problem hiding this comment.
The current head still only changes ci/praktika/utils.py:567-592 and adds the runtime preflight in ci/jobs/integration_test_job.py:933-939; there is still no focused ci/tests coverage for the v1, v2, inherited-parent, and unlimited branches of Utils.memory_limit.
That startup allocation exercises only the one live runner layout the job happens to see today, so it does not protect the parser itself from regressing back to sizing off host RAM on the other cgroup shapes this helper now has to support.
Picks up 81699bd, which fixes the version-pinned `test_settings_history_source_gate` self-test that failed `CI Tests` on this branch. Praktika reuses a cached result for an unchanged digest, so a re-run alone could not pick it up.
… clusters Review raised two points on `Utils.memory_limit`. A cgroup v2 leaf reading `max` does not mean unlimited, because limits are inherited: with `/parent` at 64G and `/parent/child` at `max`, the process is still capped at 64G. The helper read only the leaf and fell back to host RAM, which is the bug this branch removes. It now walks from the leaf up to `/sys/fs/cgroup` and keeps the smallest numeric value it finds, which is what the kernel enforces and which also absorbs the v1 unlimited sentinel. Note that `base/base/getMemoryAmount.cpp` does not do this - its loop climbs only while `memory.max` cannot be opened and returns "unlimited" as soon as it opens one holding `max`, so it has the same blind spot rather than being a model for it. Verified in containers running this function. With `--memory=2g` it returns 2048 MiB under both `--cgroupns=private` and `--cgroupns=host`. In a child cgroup with no `memory.max` of its own under a root limited to 2g, it returns 2048 MiB where the previous single-level read returned the 7933 MiB of host RAM. The second point asked for a unit matrix over synthetic cgroup layouts. A test built on fake trees pins the parser, not the outcome that matters, so instead the job now allocates and touches `workers * mem_per_worker` before starting any cluster. A runner that cannot back the plan fails within seconds of the job starting instead of thrashing for 45 minutes and reporting nothing, which is the failure mode of the report below. `mem_per_worker` moves above the branch so it is defined on both paths, and local runs skip the check. Cost measured at 5.5-6.0 GiB/s: about 7s for the flaky check's 2 x 20GB. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115277&sha=8a253f5b442c2503d40d0606fc79197de555a851&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The budget check added in the previous commit committed `workers * mem_per_worker` of pages before starting the clusters. Under Linux overcommit that allocation almost never returns `MemoryError`: on a runner that cannot back the plan the cgroup OOM killer fires instead, and with `oom_score_adj=1000` inherited from the job container it kills the harness. That turns jobs which previously completed under pressure into OOM kills, and it burns seconds of every integration job to learn nothing the kernel has not already told us. Assert the sizing invariant instead: `workers` must not exceed what the enforced limit affords, `max(1, mem_gb // mem_per_worker)`. It costs nothing, cannot push the cgroup anywhere, and still fails immediately on the case this branch is about - the failing report planned 3 workers of 20GB against an enforced 59GB. The `max(1, ...)` mirrors the `or 1` floor in the sizing, so a runner smaller than one worker's budget keeps running with a single worker rather than refusing to start. It also covers `--workers`, which bypasses the sizing entirely: `--workers 8` with a 20GB budget on a 59GB runner now fails at once instead of thrashing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Dear @leshikus, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Master solves the same problem with |
Related: #115277
Related: #107529
The flaky/targeted integration checks size their xdist pool as
min(ncpu // MAX_CPUS_PER_WORKER, mem_gb // MAX_MEM_PER_WORKER_DIST_EACH), butmem_gbcame fromUtils.physical_memory.ci/defs/job_configs.pystarts the job container with--memory=LIMITED_MEM(physical_memory() - 2 GiB), so sizing over-counted by exactly that headroom: the failing job loggedmem_gb: 61against an enforced 59 GiB and started three--dist=eachworkers.Each worker then ran
test_storage_hdfs/test.pyplustest_storage_s3/test.pyin its own Docker cluster.host_metrics.jsonlshows memory climbing monotonically across the 15-minutetest_storage_s3module - 57% at its start, 99.5% at 04:40:52, iowait already 20% from 04:33. From 04:41:09 the runner holds 100% CPU and 99.5% memory for twenty minutes with no test progress, the kernel reaps the servers and then the workers ([gw0] node down: Not properly terminated), and the job ends onTimeout exceeded [3244], exit code 137. No single test is responsible: the two slowest-looking ones insert 20 rows and write 10 objects.Utils.memory_limitresolves the job's cgroup through/proc/self/cgroupand readsmemory.maxormemory.limit_in_bytes, falling back to physical memory when unlimited. Resolving the path matters - CI passes--cgroupns=host, so/sys/fs/cgroup/memory.maxis the host root and readsmax. The check now getsmin(16 // 5, 59 // 20) = 2workers, soMAX_MEM_PER_WORKER_DIST_EACHstays at 20; loadfile runs keep 3.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115277&sha=8a253f5b442c2503d40d0606fc79197de555a851&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Workflow [PR]
Sync PR [sync-upstream/pr/115785]