Skip to content

Fix "No space left on device" in the Install packages job - #111960

Merged
alexey-milovidov merged 8 commits into
masterfrom
install-packages-disk-space
Jul 31, 2026
Merged

alexey-milovidov merged 8 commits into
masterfrom
install-packages-disk-space

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jul 26, 2026 •

Copy link
Copy Markdown
Member

The Install server tgz test of the Install packages (amd_release) job fails on master from time to time with

cp: error writing '/usr/lib/debug/usr/bin/clickhouse.debug': No space left on device

CI report (also 2026-07-23 and 2026-07-25, roughly one master run in twenty).

The doinst.sh script generated for the tgz packages copies the unpacked files to their destinations, so both copies are on the disk at the same time. For clickhouse-common-static-dbg that is 3.4 GB twice, and the whole test needs 8.3 GB inside the container, on top of the ~6 GB of packages the job downloads. The runner starts the job with 12 to 27 GB free depending on what ran on it before, so the test is one bad neighbour away from filling the disk.

Changes:

  • doinst.sh moves the unpacked files instead of copying them. Measured on the packages of 33b1529393521883bad6dcd397d81251be0800c7, the writable layer of the container goes from 8349 MB down to 4175 MB, with an identical set of installed files and identical ownership. Moving also keeps the file modes of the package, so a tgz installation now matches a deb one, and it succeeds when the destination is a running executable, where copying fails with ETXTBSY. The tarball carries the ownership of the user who built the packages, so the files are explicitly chowned to root - which is what copying as root did implicitly.
  • The test containers are removed synchronously. docker run --rm reclaims the writable layer asynchronously, while the next test, which writes several more gigabytes, starts right away.
  • The free space is logged after every test, because running out of it surfaces as an unrelated error in whatever runs next (in the report above it also truncated the log artifacts of the failed tests to zero bytes).
  • ./packages was missing from the digest of the build job, so changes to the packaging did not schedule a rebuild of the packages. Added.

Changelog category (leave one):

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

Version info

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

The `Install server tgz` test of `Install packages (amd_release)` fails from
time to time with

    cp: error writing '/usr/lib/debug/usr/bin/clickhouse.debug': No space left on device

The `doinst.sh` script generated for the tgz packages copies the unpacked files
to their destinations, so both copies are on the disk at the same time. For
`clickhouse-common-static-dbg` that is 3.4 GB twice, and the whole test needs
8.3 GB inside the container, on top of the ~6 GB of packages the job downloads.
The runner starts the job with 12 to 27 GB free depending on what ran on it
before, so the test is one bad neighbour away from filling the disk - and it
does, roughly once in 20 runs on master.

Move the files instead of copying them. Measured on the packages of
33b1529, this takes the writable layer of the
container from 8349 MB down to 4175 MB, with an identical set of installed
files and identical ownership. Moving also keeps the file modes of the package,
so a tgz installation now matches a deb one, and it succeeds when the
destination is a running executable, where copying fails with `ETXTBSY`. The
tarball carries the ownership of the user who built the packages, so the files
are explicitly chowned to root - which is what copying as root did implicitly.

Remove the test containers synchronously as well: `docker run --rm` reclaims
the writable layer asynchronously, while the next test, which writes several
more gigabytes, starts right away. And log the free space after every test,
because running out of it surfaces as an unrelated error in whatever runs next.

`./packages` was missing from the digest of the build job, so changes to the
packaging did not schedule a rebuild of the packages. Add it.

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

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a5e8dec]

Summary: ✅


AI Review

Summary

This PR reduces disk pressure in the Install packages job by moving tgz payloads instead of copying them, adds stricter container cleanup, and teaches the tgz installer to preserve several destination-inode cases. One installer edge case is still wrong, though: the new dangling-symlink write-through path creates a fresh target with umask-derived metadata instead of the package file's metadata, so a symlinked binary can be installed as a non-executable regular file. Because that leaves the install silently broken, I would not merge this as-is.

Findings

❌ Blockers

  • [packages/build:152] In the new dangling-symlink path there is no destination inode to preserve. cat "$filepath" > "$destpath" therefore creates the target with the shell's default mode and without the package file's label/xattrs, so a symlinked binary path now becomes a plain non-executable file. A concrete trace is chmod 755 src; ln -s /shared/bin /usr/bin/clickhouse; cat src > /usr/bin/clickhouse, which leaves /shared/bin at an umask-derived mode instead of 0755. The old cp -r refused this case, so the new code turns a loud failure into a silent broken install. Suggested fix: either keep dangling symlinks unsupported, or special-case -L && ! -e and recreate the target with the package metadata after creating it.
Final Verdict

❌ Changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 26, 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.

Very good.

@alexey-milovidov alexey-milovidov self-assigned this Jul 26, 2026
@alexey-milovidov
alexey-milovidov requested a review from maxknv July 26, 2026 16:08
Comment thread packages/build Resolved
alexey-milovidov and others added 2 commits July 27, 2026 09:45
…nst.sh`

The tgz installer used `cp -r`, which follows a symlink at the destination and
writes through it, so an installation keeping `/etc/clickhouse-server/config.xml`
or a binary elsewhere and linking to it kept the indirection after an upgrade.
`mv -f` replaced the symlink with a regular file instead.

Write through an existing destination symlink with `cat`, the way copying did,
and keep the rename for every other destination. The disk space that the rename
saves is in the multi-gigabyte payload of the packages, which is never installed
over a symlink.

Add a `Install tgz over a symlinked config` test to the `Install packages` job
that installs the client package over a symlinked
`/etc/clickhouse-client/config.xml` and checks that the link and its target
survive.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Both failures in the coverage jobs are unrelated to this packaging change and are known:

Merged master and pushed the fix for the review finding.

Comment thread packages/build Resolved
Comment thread ci/jobs/install_check.py Resolved
@maxknv

maxknv commented Jul 27, 2026

Copy link
Copy Markdown
Member

If it's normal for a job to use more than 50GB, we can switch it to ARM|AMD_SMALL runners. They have larger disks.

…led container cleanup

`mv` replaces the destination inode with the one from the unpack tree, so an installed
file inherited the SELinux label of the temporary extraction directory instead of the
label its final path should have. Run `restorecon` on the moved path where SELinux is
enabled and the tooling is present; the write-through branch keeps the destination
inode and needs nothing.

`docker rm --force --volumes` is now the mechanism that reclaims the writable layer
synchronously, so a failure there means the job is about to run out of disk space -
make it strict, instead of continuing with a leaked layer and misattributing the next
failure.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Addressed both AI review findings in 9c3e288:

  • Blocker (packages/build): after mv, the installed file inherited the SELinux label of the temporary extraction directory. doinst.sh now detects an active SELinux (selinuxenabled plus restorecon present) once and relabels every moved path from the policy. The write-through branch keeps the destination inode, so it needs no relabeling. Verified locally against a fake root with stub selinuxenabled/restorecon: both moved files are relabeled, symlinked destinations are still written through, and no leftovers remain in the unpack tree.
  • Major (ci/jobs/install_check.py): the docker rm --force --volumes cleanup is now strict=True, so a failed reclaim stops the job at the point where the real problem happened instead of leaking the writable layer into the next test.

@maxknv, the job does not legitimately need more than 50 GB - the peak came from copying the tgz contents (twice the space of the debug-symbol packages) and from the writable layers being reclaimed asynchronously. With this change the writable layer goes from 8349 MB to 4175 MB per test and is freed synchronously, so the current runners are enough; the added df -h / logging will show if that stops being true.

…erved

The rename fast path in the tgz `doinst.sh` replaced the destination inode for
every regular file, so an upgrade dropped ACLs and other extended attributes set
on paths like `/etc/clickhouse-server/config.xml`, and other hard links to an
installed file kept pointing at the pre-upgrade contents.

`keep_destination_inode` now decides per destination: a symlink, a destination
with more than one link, an ACL (the `+` in `ls`) or any extended attribute other
than the SELinux label is written through with `cat`, keeping the inode the way
`cp -r` did. Everything else - including every fresh installation, which is what
the disk-space problem is about - is still renamed.

Added `Install tgz over a hard-linked config` to `ci/jobs/install_check.py`.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Addressed the remaining AI review Major in 9732bd9 (packages/build).

The rename fast path is now taken only for destinations whose inode does not have to survive the installation. doinst.sh gained keep_destination_inode, which writes through with cat - keeping the inode, its ownership, permissions and attributes, exactly as cp -r did - when the destination is:

  • a symlink (as before);
  • a regular file with more than one link, so every other hard link sees the new contents;
  • a regular file with an ACL, detected by the + after the permissions in ls -ld;
  • a regular file with any other extended attribute, detected by getfattr where it is installed. The SELinux label is deliberately excluded, because it is recreated from the policy by restorecon and every file has one on an SELinux system, which would make the rename path unreachable.

Everything else - and in particular every fresh installation, which is the case the disk-space problem is about - is still renamed, so the writable-layer saving is unchanged.

Verified against a fake root: a plain existing file is renamed over (inode changes), a hard-linked destination keeps its inode and both links get the new contents, a symlinked destination is still written through, a destination with a user.* xattr keeps its inode and the attribute, an ACL destination keeps its inode and the ACL even with getfattr unavailable, a fresh path is installed, and nothing is left in the unpack tree. dash -n and shellcheck -s sh are clean apart from the pre-existing backtick style notes. Added Install tgz over a hard-linked config to ci/jobs/install_check.py.

Also merged master.

The remaining red - Upgrade check (amd_release), Error message in clickhouse-server.log, DiskLocalCheckThread failing to open disk*_02961/clickhouse_disk_checker_* - is unrelated to packaging: it comes from the disk checker racing with the removal of the test disks, it happens on several unrelated pull requests every day for the last two weeks, and this change touches only the tgz installer and the Install packages job, while the upgrade check installs deb packages.

@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111960&sha=9c3e28869c3d1b52874b325fe086503858b5e418&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29 and provide a fix in a separate PR. If the fix is already in progress, link it here.

@groeneai

Copy link
Copy Markdown
Collaborator

Your reading is right, and the fix is already in progress but incomplete for this exact run.

The in-progress fix is #110773 (mine, open), a scoped allow-list entry for the DiskLocalCheckThread teardown race in tests/docker_scripts/upgrade_runner.sh. I ran its matcher against the actual upgrade_error_messages.txt from your report: 4 of the 5 lines are dropped, and one survives.

<Error> disk2_02961::DiskLocalCheckThread: Code: 33. DB::Exception: Cannot read all data.
Bytes read: 0. Bytes expected: 2: While checking access for disk disk2_02961. (CANNOT_READ_ALL_DATA)

It is the same race, caught one statement later. IDisk::checkAccessImpl writes the probe file, reads it back, then re-reads it at an offset; the offset read is readStrict of payload.size() - offset = 4 - 2 = 2 bytes, which is the "Bytes expected: 2". "Bytes read: 0" means the file was already gone at that point, so readStrict throws CANNOT_READ_ALL_DATA instead of the open throwing FILE_DOESNT_EXIST. All five lines in the artifact land within 6.3 ms of each other, i.e. one teardown event across the fixture disks.

#110773's matcher pins ENOENT exactly via the errno: 2, field terminator, and this variant carries no errno, so it slips through. That was deliberate: its contract test asserts CANNOT_READ_ALL_DATA still fails the job, on the grounds that it means the disk corrupted data. That reasoning holds for the Content of ... does not matches after read shape but not for a short read of a vanished file. Over 120 days there are 6 DiskLocalCheckThread CANNOT_READ_ALL_DATA rows, across 6 unrelated PRs, 0 on master, all on Upgrade check (amd_release), all on fixture disks, and all the Bytes read: 0. Bytes expected: 2 short-read shape; none are the content-mismatch shape.

So I am widening #110773 to also drop the short-read shape on the fixture disks, keeping the content-mismatch line failing. I verified both directions before proposing it: the real line from your run is dropped, and the contract test's content-mismatch line still surfaces. That keeps it one PR for one race rather than a second allow-list entry for the same event.

None of this is caused by your change; the upgrade check installs deb packages and this is the periodic disk checker racing the fixture-disk teardown, as you said. I will follow up here when #110773 has the widened matcher pushed.

@groeneai

Copy link
Copy Markdown
Collaborator

Following up as promised, with a correction: the root cause I gave you was wrong, and the fix is no longer an allow-list.

There is no teardown race. In the artifact from your run the five error lines land at 07:47:05.17, while Received termination signal is at 07:47:15.52 and Shutdown disk disk1_02961 at 07:47:18.98. The server is fully up and serving when they appear, about 10 s before anything starts shutting down.

What actually happens is that one process holds two DiskLocal objects for a single configured disk. With keeper_server present, KeeperContext::initializeDisks initializes its own disk selector over the same storage_configuration.disks subtree the global Context uses, and its validator accepts type=local. Each object arms its own DiskLocalCheckThread, and both named the probe file from the process-wide server UUID, so the two threads write, read and unlink one shared path. checkAccessImpl is write-Rewrite then read then read-at-offset then unlink, so whichever step loses the race decides the code: FILE_DOESNT_EXIST, CANNOT_UNLINK, or the CANNOT_READ_ALL_DATA short read I showed you when a sibling Rewrite truncates the file mid-read. The disk is healthy throughout, and checkAccessImpl also marks it broken, which the checker publishes into BrokenDisks.

So the short-read line was not a variant the matcher had missed. It was the same self-collision, and filtering any of it was hiding a product bug. #110773 now gives each check thread its own probe file and reverts the allow-list entirely, so genuine disk failures on those disks are no longer suppressed. That the errors come from the new server's log is what makes a product fix sufficient here.

The report's own server log settles it: Disk check for disk <name> started appears exactly twice for each of disk1_02961 through disk4_02961 and backups, while grep -o clickhouse_disk_checker_[0-9a-f-]+ over the whole 77167-line log yields exactly one name, c7741e40-ab74-40fd-a3d8-00cd05e80a92. Ten threads, one path. All five error lines carry that same name.

Reproduced deterministically on master with one local disk, keeper_server, and local_disk_check_period_ms of 1: two check threads, one shared probe name, 8617 error lines in 30 s across all three codes. With the fix they take distinct files and log nothing. Removing keeper_server gives one thread and no errors.

Still not caused by your change.

alexey-milovidov and others added 2 commits July 30, 2026 23:48
…attr

Two findings from the AI review on the tgz installer's rename fast path:

* A dangling symlink at the destination fell through to `mv -f`, because
  `keep_destination_inode` tested `-e` (which follows the link) before `-L`.
  The symlink test now comes first, so every existing symlink - dangling or
  not - is written through and survives the installation. Added an
  `Install tgz over a dangling symlink` test to the `Install packages` job.

* On a host without `getfattr` there is no portable way to see whether the
  destination carries extended attributes, so an existing regular file now
  conservatively keeps its inode there. The disk-space saving is unaffected:
  it comes from the fresh installation, where no destination exists and the
  rename path is still taken.

Also fixed the `Install tgz over a hard-linked config` test: it compared the
contents with `diff`, which is not installed in the minimal rpm image; the
comparison is now done in the shell.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111960&sha=49a46ea352cd8cf6ef09dc253815d6695d0aebb5&name_0=PR&name_1=Install%20packages%20%28amd_release%29
#111960

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Addressed both remaining AI review findings in f6a1f47 (packages/build):

  • Blocker (dangling symlinks): keep_destination_inode now tests -L before -e. Since -e follows the link, a dangling symlink looked nonexistent and fell through to mv -f; now every existing symlink - dangling or not - stays on the write-through path and survives the installation, with the target created the way cp would have. Added an Install tgz over a dangling symlink test to the Install packages job.
  • Major (getfattr unavailable): on a host without getfattr there is no portable way to see whether the destination carries extended attributes, so an existing regular file now conservatively keeps its inode - written through with cat, exactly the old cp -r behavior. The disk-space saving is unaffected, because it comes from the fresh installation, where no destination exists and the rename path is still taken.

Also fixed the red Install tgz over a hard-linked config test: the hard-link semantics themselves passed (same inode, both links updated), but the final content comparison used diff, which is not installed in the minimal rpm image. The comparison is now done in the shell.

Verified against a fake root in both variants (with and without getfattr): fresh path renamed, dangling symlink survives and its target is created, live symlink written through, hard-linked destination keeps its inode with both links updated, user.* xattr destination keeps its inode and the attribute, plain existing file is renamed when getfattr is present and keeps its inode when it is not, and nothing is left in the unpack tree. dash -n and shellcheck -s sh show only the pre-existing style notes.

The remaining red, 01666_merge_tree_max_query_limit in the coverage run, is unrelated to packaging and tracked in #112426.

Also merged master.

Comment thread packages/build
if [ ! -L "$filepath" ] && keep_destination_inode "$destpath"; then
# The destination keeps its inode, so its ownership, permissions, attributes and every
# other hard link to it stay valid after the upgrade, as they did when copying.
cat "$filepath" > "$destpath"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This write-through branch is only safe when the destination symlink already points at an existing inode. In the new dangling-symlink case there is no inode to preserve: shell redirection creates the target with the process umask, and this branch never re-applies the package file's mode, owner, SELinux label, or other xattrs.

That means a symlinked binary path can now install silently as a non-executable file. A minimal trace is chmod 755 src; ln -s /shared/bin /usr/bin/clickhouse; cat src > /usr/bin/clickhouse, which leaves /shared/bin at an umask-derived mode instead of 0755. The old cp -r refused to write through dangling symlinks here, so this turns a loud failure into a broken install. Can we either keep dangling symlinks unsupported, or special-case -L && ! -e and recreate the target with the package metadata after creating it?

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 31, 2026
Merged via the queue into master with commit 59f0c88 Jul 31, 2026
179 checks passed
@alexey-milovidov
alexey-milovidov deleted the install-packages-disk-space branch July 31, 2026 16:10
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The last unresolved review finding (write-through of a dangling symlink creating the target with the installation umask instead of the packaged mode) landed with the merge and is real - I reproduced it with a fake-root simulation of the merged doinst.sh: the targets came out 0600 instead of 0644/0755, and were not chowned to root.

Fixed in the follow-up #112766: a dangling destination is now renamed into the resolved link target and gets chown -h root:root + restorecon, so the link keeps its indirection and the installed file keeps the packaged metadata, still without extra disk space. The Install tgz over a dangling symlink test installs under umask 077 and asserts the mode and the ownership.

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 31, 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.
pull Bot pushed a commit to Mu-L/ClickHouse that referenced this pull request Aug 9, 2026
Follow-up to ClickHouse#111960. When the destination is a symlink whose target does
not exist yet, `doinst.sh` wrote through it with a shell redirection, which
creates the target with the `umask` of the installation and with no relation
to the mode, the ownership or the label of the packaged file - a symlinked
binary path would install as a non-executable file owned by the builder.

There is no destination inode to preserve in that case, so the packaged file
is renamed to where the link points instead: the link keeps its indirection,
and the installed file gets the metadata it has in the package, the same way
a fresh installation does. A symlink to an existing file is still written
through, so its inode, ownership and attributes survive an upgrade.

`Install tgz over a dangling symlink` now installs under `umask 077` and
asserts the mode and the ownership of the installed target.

Verified with a fake-root simulation of the generated `doinst.sh`: before the
change the dangling-symlink targets came out `0600` instead of `0644`/`0755`,
after it they carry the packaged mode, while the write-through, hard-link and
fresh-install paths are unchanged.

Related: ClickHouse#111960
qiuyanjun888 pushed a commit to qiuyanjun888/ClickHouse that referenced this pull request Oct 12, 2026
`Install packages` declares four artifacts in `requires` (deb, rpm, tgz and the
raw binary) and praktika downloads all four into `ci/tmp` before the job script
starts, but `install_check.py` installs one flavour at a time. Reading the step
change across each `free_packages()` call in the failing run's own `df` timeline
(master 31f27d8): debs 2.5 GiB, rpms 2.5 GiB,
tarballs 3.2 GiB, plus `ci/tmp/clickhouse` at about 1 GiB that is never deleted.
About 9.2 GiB of package files stay resident for the whole job, of which the
substep that failed needed only the 2.5 GiB of debs. `apt` asked for 4753 MB
there against 4.3 GiB free, so the job's peak is near 14 GiB and `dpkg` ran out
of space unpacking `clickhouse.debug`.

Split each of the four ParamSets into three, one per flavour, using the
`--no-deb`, `--no-rpm` and `--no-tgz` flags that already existed in
`install_check.py` and were never set. The peak drops to about 9 GiB, or 7 GiB
for tgz. On the host that failed, which arrived with 13.5 GiB free of a 58 GiB
volume, the deb job would have started with 10.0 GiB free instead of 4.3 GiB.
This is growth proportional on the demand side: the peak now tracks one
flavour's size instead of the sum of four, where the four previous fixes in this
family each reclaimed a fixed amount of space that package growth then consumed.

Three supporting changes in `install_check.py`: pull the deb image when the deb
or tgz group runs and the rpm image when the rpm or tgz group runs, since both
tgz runs install the same tarballs in both images; guard the `strict=True`
`chmod +x ci/tmp/clickhouse` behind the deb or rpm group, without which the tgz
job aborts before running anything because it does not require the binary
artifact; and correct the two comments the split falsifies. The stale 6.8 GiB
tgz figure in `test_install_tgz` is corrected in the same pass: ClickHouse#111960 already
made it wrong when it changed the generated `doinst.sh` to rename the unpacked
tree into place instead of copying it.

Coverage is unchanged. The substep set of one pre-change job and the union of
the three new jobs match name for name, 26 substeps split 5 + 3 + 18 with no
overlap, cross-checked against the CIDB substep list of a green pre-change run.
Every substep still runs once per arch, in the same image, with the same
packages; only which artifacts are on disk while it runs changes.

This reduces exposure rather than removing it. The runner admission floor stays
at `free_blocks_threshold = 3_000_000` 1 KiB blocks (2.86 GiB) and 5 percent, so
a host admitted below about 9 GiB free can still fail; the failing host passed
both checks at 4.3 GiB and 7 percent free.

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

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.

4 participants