Skip to content

Install the binary last in the Install packages job - #113032

Merged
alexey-milovidov merged 1 commit into
masterfrom
install-packages-binary-last
Aug 2, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
install-packages-binary-last

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Related: #111960

Install clickhouse binary in deb fails on master from time to time:

Code: 243. DB::Exception: Not enough space for clickhouse binary in /usr/bin, required 3.96 GiB, available 2.46 GiB. (NOT_ENOUGH_SPACE)

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=c2c9039413b2e96f64fdbbdecaa23381fb9924df&name_0=MasterCI&name_1=Install%20packages%20%28amd_release%29

The runners hand this job 4-6 GiB of free space out of 58 GiB, and the binary test is by far the most disk hungry of the job. The self-extracting archive unpacks in place, so /packages/clickhouse grows from 1 GiB to 4 GiB, and clickhouse install needs as much again to copy the binary into /usr/bin: it hard links the binary when it can, but /packages is a directory mounted from the host, so the link cannot be made. On top of that the installer refuses to start unless the whole size of the binary is available. Altogether that is around 7 GiB, and the test used to run in the middle of the job while more than 6 GiB of packages it does not need at all were still on disk. The very same test passed later in the same run, after the deb packages had been deleted.

Both binary tests now run at the very end, once every package has been deleted, which is worth 7 GiB on its own, and the tgz packages are deleted as well. Keeping the binary packed until then leaves 3 GiB more for the tgz tests, which are the next most disk hungry.

docker system prune in the clean up hook of the job also gets -f: without it the command was asking for a confirmation on a terminal that is not there and exiting without deleting anything.

Changelog category (leave one):

  • CI Fix or Improvement

Version info

  • Merged into: 26.8.1.650 (included in 26.8 and later)

`Install clickhouse binary in deb` fails on master from time to time with
`Not enough space for clickhouse binary in /usr/bin, required 3.96 GiB,
available 2.46 GiB`:

https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=c2c9039413b2e96f64fdbbdecaa23381fb9924df&name_0=MasterCI&name_1=Install%20packages%20%28amd_release%29

The runners start the job with 4-6 GiB of free space, and the binary test is
the most disk hungry of the job by a wide margin: the self-extracting archive
unpacks in place, so `/packages/clickhouse` grows from 1 GiB to 4 GiB, and
`clickhouse install` needs as much again to copy the binary into `/usr/bin` -
a hard link cannot be made from a directory mounted from the host. It used to
run in the middle of the job, while more than 6 GiB of packages that it does
not need at all were still on disk.

Run both binary tests at the very end instead, once every package has been
deleted, and delete the tgz packages too. Keeping the binary packed until then
leaves 3 GiB more for the tgz tests as well.

Also pass `-f` to `docker system prune` in the clean up hook of the job: it was
asking for a confirmation on a terminal that is not there and exiting without
deleting anything.
@clickhouse-gh

clickhouse-gh Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0afdb31]

Summary: ✅


AI Review

Summary

This PR moves the self-extracting binary install checks to the very end of the Install packages job, after the deb, rpm, and tgz artifacts have been deleted, and it makes the Docker cleanup hook non-interactive by adding -f to docker system prune. I did not find a correctness or reliability regression in the current diff: the reordered flow matches the stated disk-pressure failure mode, and the current PR CI is green, including both Install packages jobs.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 2, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Aug 2, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 2, 2026
Merged via the queue into master with commit 63c2c39 Aug 2, 2026
180 checks passed
@alexey-milovidov
alexey-milovidov deleted the install-packages-binary-last branch August 2, 2026 23:35
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 3, 2026
alexey-milovidov pushed a commit to Onyx2406/ClickHouse that referenced this pull request Aug 7, 2026
Install packages (amd_release) failed on master sha 7039251 with

  dpkg: error processing archive clickhouse-common-static-dbg_26.8.1.673_amd64.deb
   cannot copy extracted data for './usr/lib/debug/usr/bin/clickhouse.debug' to
   '/usr/lib/debug/usr/bin/clickhouse.debug.dpkg-new': failed to write
   (No space left on device)

The runner arrived at 55G used / 3.2G available / 95% full, while apt announces
"After this operation, 4413 MB of additional disk space will be used". The first
of 18 substeps therefore could not succeed, and the outcome was settled before
the job wrote a byte.

The job's own footprint is not the variable. It is constant at +3-4 GiB across
green and failing runs alike, which is why the three merged fixes in this area
(ClickHouse#111960 synchronous per-substep docker rm, ClickHouse#112751 stop installing dbg in most
tests, ClickHouse#113032 binary tests last plus a non-interactive docker system prune) did
not close it: all three shrink or reorder that constant footprint. All three are
ancestors of this failing build.

What discriminates green from red is the state the runner starts in:

  FAIL  7039251 amd  i-0969e2fde61d860b0  55G used / 3.2G avail / 95%  1/18 fail
  GREEN 2251e69 amd  i-0b4dbf6ffb28c656e  24G used /  34G avail / 42%  18/18 ok
  GREEN 2251e69 arm  i-08f529e20e7f4090e  18G used /  41G avail / 31%  18/18 ok

CIDB shows the same start-state exhaustion in 15 Install packages runs over the
last 20 days, 7 on master and 8 on release branches (26.5 four, 26.6 two, 26.3
and 26.4 one each). Only 2 of the 15 carry this dpkg signature; the other 13
raise earlier, in the tgz substep, where docker run cannot allocate and exits
125, in 9 of the 13 while creating a containerd overlayfs snapshot dir and in
the other 4 at another daemon-side path under /var/lib/docker or /tmp. All 13
are exit 125 and all 13 are ENOSPC in the same substep, so the start-state class
is the same regardless of which allocation happens to be the one that fails.
Those 13 abort the job before any test row exists, so CIDB records them with an
empty test_name, which is why a breadth query keyed on the test name undercounts
the class. One of them, a61e6f1 on 26.3, ran on this same instance
i-0969e2fde61d860b0 54 minutes earlier, also one job after a Docker keeper image
run: same box, same residue, a different substep happening to be the one that
ran out.

Install packages runs on the style-checker pool, which also hosts the multi-arch
docker image builds. install_check.py pulls exactly two images, and the green
runner's post-hook deleted exactly those two; the failing runner's post-hook
deleted eight tags, six of which this job never pulled: five
clickhouse/clickhouse-keeper:head-* tags, including arm64 ones on an amd runner,
plus a stale install-deb-test tag.

That residue has an identified producer. Joining on the CIDB instance_id, the
job immediately before the failure on the same box is Docker keeper image for
BackportPR ClickHouse#112982 (sha 934bc90, branch backport/25.8/108977), 14:33:46 to
14:38:30, with the install job starting at 14:45:21 and nothing in between. It
ran in the non-push flavour (EVENT_TYPE='pull_request'), so its six builds used
--output=type=docker and tagged every arch in the local image store, whereas a
master-flavour run pushes by digest and creates no local arch tag. Its own
post-hook removed exactly one of those six tags; the five survivors are the same
five keeper tags the install job deleted 15 minutes later, and two of the image
IDs it reported as "unable to delete (must be forced) - image is referenced in
multiple repositories" before exiting 123 are among the IDs the install job then
removed.

The reason it left them is a hook version skew. At the producer's sha the cleanup
hook has no forced pass at all, only builder prune, container prune and an
unforced docker rmi. The forced pass over clickhouse/clickhouse- and
clickhouse/install- images was added by ba64179, which is an ancestor of
this failing master build but is not on the 25.8 line. Multi-arch head-* images
share layers and so are referenced in multiple repositories, which is exactly
what an unforced rmi refuses to remove.

docker_clean_up_hook was registered only as post_hooks, so on the consumer side
it frees that residue after the failure.

Register the same hook as a pre_hooks entry as well, on both Install packages
configs. That covers 4 parametrized jobs (amd and arm) across the PR, BackportPR,
MasterCI and ReleaseBranchCI workflows, 8 job objects in total, each verified
pre=1 post=1. Fixing the producer instead would mean backporting the newer hook to
every release and backport branch still in flight, whereas defending at the
consumer covers residue from any producer running any hook version. Nothing is
narrowed or skipped: no glob, no package, no test, no assertion. Re-pulling the
two install images costs seconds against a 900 s timeout: the measured deb+rpm
totals in the three captured logs are 4 s, 12 s and 9 s.

The reclaim is best-effort, deliberately. The hook ignores every Shell.check
return and returns True; runner.py builds the pre-hook result but never feeds it
into the flag gating the run, and appends it after the parent status was already
computed. Adding strict=True was rejected: the hook is shared by four other
post_hooks registrations, so failing closed would newly break unrelated checks on
a cleanup hiccup, and gating a run on pre-hooks is a praktika-wide contract
change. If the reclaim frees nothing the outcome is today's, never worse.

Note that pre_hooks is not among the fields dropped from the job digest, so the
config digest changes and the first run after merge is uncached instead of served
from cache. That is intended: a result cached without the pre-hook should not
satisfy the new config.

There is no local reproducer, since the trigger is another job's leftover disk
state on a shared runner, and a green run on this change proves nothing because
it requires drawing a dirty runner. Validation is mechanical: pre_hooks verified
non-empty on all four jobs, praktika yaml regenerating no workflow YAML, and the
hook exiting 0 both on a clean store and on one seeded with the observed residue,
which it removes while leaving unrelated images untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants