Skip to content

Give the integration tests' nested containers the budget they actually use - #117412

Merged
Algunenano merged 1 commit into
masterfrom
integration-nested-budget-init-reserve
Sep 1, 2026
Merged

Algunenano merged 1 commit into
masterfrom
integration-nested-budget-init-reserve

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

Related: #117202
Related: #112984

Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) fails on master with Container memory budget exceeded (/docker) while every test in the batch passes - 15 of the 26 master runs after 2026-08-31 12:00:

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=25dfbdb6c5dd3c0bd78c7134c14045ddb7647bcf&name_0=MasterCI&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%206%2F6%29

docker_in_docker.sh splits the job's memory limit into three capped cgroup leaves and sizes /docker - the one that parents every nested test container - last, from whatever the other reserves leave. On the 61.78 GiB runner that is 40.78 GiB, and it is not enough. Across 58 collected job logs /docker peaked at exactly its cap in all 58, green runs included, so the leaf has no reclaim headroom at all and whether the kernel has to kill something is luck:

cgroup leaf /docker:  peak 40.78 GiB of 40.78 GiB cap (AT CAP - demand is at least this)
cgroup leaf /dockerd: peak 18.35 GiB of 42.78 GiB cap
cgroup leaf /init:    peak 21.58 GiB of 56.78 GiB cap

The partition rests on an assumption the kernel's own OOM report refutes. It gives /init a third of the job limit and /docker the remainder, on the grounds that /init's charge is anonymous while /docker holds page cache that reclaim can give back. Read off the kill, /docker is the opposite:

memory: usage 42756008kB, limit 42756044kB
total_rss 43330654208      <- 40.35 GiB anonymous
total_cache 753664         <- 0.7 MB of page cache

/init and /dockerd are the ones running on cache - they peak 20 GiB above what the partition promises them (16 GiB and 2 GiB reserves) and the job cgroup still never breaches, because reclaim takes that back. The only leaf that cannot give anything back is the one being sized last.

So /init keeps the floor instead of the share, and /docker gets the 8 GiB that frees: 48.78 GiB against a measured peak of 40.35 GiB of servers plus the 3.4-4.3 GiB a shutdown gdb attach adds on top. /init's own ceiling is unchanged - the reserve was never its cap - so this takes away none of the room it uses, and the worker plan derived from the budget stays at 3 workers (2 under --dist=each), so no job runs longer for this.

This is the remainder of the same overrun #117202 addressed. Serializing the shutdown gdb attaches removed the four-at-once pile-up and fixed shards 2/6 and 5/6 (0 occurrences since), but 6/6 still fails: there the servers alone reach 39.30 GiB across 34 processes, so a single 4 GiB attach no longer fits either, and half the kills there have no gdb in them at all - the victim is a clickhouse server.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Workflow [PR]
Sync PR [sync-upstream/pr/117412]

Version info

  • Merged into: 26.9.1.480 (included in 26.9 and later)

…y use

`docker_in_docker.sh` splits the integration job's memory limit into three capped cgroup leaves,
and `/docker` - the one that parents every nested test container - is sized last, from whatever
the other reserves leave. On the 61.78 GiB runner that is 40.78 GiB, and it is not enough: over
58 job runs `/docker` peaked at exactly its cap in all 58, so the kernel is picking a victim
whenever anything asks for more. The job then reports `Container memory budget exceeded
(/docker)` while every test in the batch passes - 15 of the 26 master runs of
`Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6)` after 2026-08-31 12:00, and
before that shards 2/6 and 5/6 as well.

The sizing rests on an assumption the kernel's own OOM report refutes. It gives `/init` a third
of the job limit and `/docker` the remainder, on the grounds that `/init`'s charge is anonymous
while `/docker` holds page cache reclaim can give back. Measured at the kill, `/docker` holds
40.35 GiB of anonymous memory against 753664 bytes of cache - not one page of it is reclaimable.
`/init` and `/dockerd` are the ones running on cache: they peak at 20.8 GiB and 18.3 GiB against
reserves of 16 GiB and 2 GiB, 20 GiB above what the partition promises them, and the job cgroup
still never breaches, because reclaim takes that back. The only leaf that cannot give anything
back is the one being sized last.

So `/init` keeps the floor instead of the share, and `/docker` gets the 8 GiB that frees:
48.78 GiB against a measured peak of 40.35 GiB of servers plus the 3.4 to 4.3 GiB a shutdown
`gdb` attach adds on top of them. `/init`'s own ceiling is unchanged - the reserve was never its
cap - so this takes away none of the room it uses. Worker concurrency is unchanged too: the plan
derived from the budget stays at 3 workers (and 2 under `--dist=each`), so no job runs longer for
this.

This is the remainder of the same overrun #117202 addressed. Serializing the shutdown `gdb`
attaches removed the 4-at-once pile-up and fixed shards 2/6 and 5/6, but in 6/6 the servers alone
reach 39.30 GiB across 34 processes, so a single 4 GiB attach no longer fits either - and half
the kills there have no `gdb` in them at all.

Related: #117202
Related: #112984

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=25dfbdb6c5dd3c0bd78c7134c14045ddb7647bcf&name_0=MasterCI&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%206%2F6%29
@clickhouse-gh

clickhouse-gh Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [251c854]

Summary: ✅


AI Review

Summary

This PR changes the integration-test cgroup partitioning on the shared amd-medium and arm-medium runners by reducing INTEGRATION_DIND_INIT_RESERVE from the capped one-third share to a flat 8 GiB, which increases CI_DIND_NESTED_BUDGET for the nested test containers without changing CI_DIND_INIT_LIMIT. I found no unresolved correctness or rollout issues in the current code: the worker plan remains unchanged on the 64 GiB runners that use this config, the change is consistent with the docker_in_docker.sh and integration_test_job.py consumers, and the PR CI run is green across the amd and arm integration shards that consume it.

Final Verdict
  • Status: ✅ Approve

@Algunenano
Algunenano added this pull request to the merge queue Sep 1, 2026
@Algunenano
Algunenano removed this pull request from the merge queue due to a manual request Sep 1, 2026
@Algunenano
Algunenano added this pull request to the merge queue Sep 1, 2026
Merged via the queue into master with commit d65ba26 Sep 1, 2026
174 checks passed
@Algunenano
Algunenano deleted the integration-nested-budget-init-reserve branch September 1, 2026 11:31
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 2, 2026
Picks up ClickHouse#117364 (fixes 03707_autopr_unsupported_cases under the old
analyzer) and ClickHouse#117412 (fixes the nested container memory budget that
OOM-killed integration test containers), which owned two of the failures
on the previous head. The Bugfix validation "Could not find master
builds in S3" failures have also stopped occurring upstream.
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 3, 2026
Picks up ClickHouse#117412 (merge commit d65ba26), which
re-budgets the integration tests' nested containers. That is the fix for the
'Container memory budget exceeded (/docker)' error that was the single root
failure on the previous head.
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 5, 2026
Picks up three merged fixes that post-date this branch's previous master
merge and that its CI run was red on:

  ClickHouse#117580  Bugfix validation master-build lookup for the new S3 prefix
  ClickHouse#117459  date-dependent toYYYYMM documentation example
  ClickHouse#117412  integration tests' nested-container memory budget

Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker This issue / pr blocks a new release pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants