Repository navigation
Fix "No space left on device" in the Install packages job - #111960
Conversation
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]>
|
Workflow [PR], commit [a5e8dec] Summary: ✅
AI ReviewSummaryThis PR reduces disk pressure in the Findings❌ Blockers
Final Verdict❌ Changes requested. |
…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]>
|
Both failures in the coverage jobs are unrelated to this packaging change and are known:
Merged |
|
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.
|
Addressed both AI review findings in
@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 |
…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`.
|
Addressed the remaining AI review Major in The rename fast path is now taken only for destinations whose inode does not have to survive the installation.
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 Also merged The remaining red - @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. |
|
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 It is the same race, caught one statement later. #110773's matcher pins ENOENT exactly via the 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. |
|
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 What actually happens is that one process holds two 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: Reproduced deterministically on master with one Still not caused by your change. |
…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]>
|
Addressed both remaining AI review findings in
Also fixed the red Verified against a fake root in both variants (with and without The remaining red, Also merged |
| 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" |
There was a problem hiding this comment.
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?
|
The last unresolved review finding (write-through of a dangling symlink creating the target with the installation Fixed in the follow-up #112766: a dangling destination is now renamed into the resolved link target and gets |
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.
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
`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]>
The
Install server tgztest of theInstall packages (amd_release)job fails on master from time to time withCI report (also 2026-07-23 and 2026-07-25, roughly one master run in twenty).
The
doinst.shscript generated for the tgz packages copies the unpacked files to their destinations, so both copies are on the disk at the same time. Forclickhouse-common-static-dbgthat 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.shmoves the unpacked files instead of copying them. Measured on the packages of33b1529393521883bad6dcd397d81251be0800c7, 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 withETXTBSY. 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.docker run --rmreclaims the writable layer asynchronously, while the next test, which writes several more gigabytes, starts right away../packageswas 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):
Version info
26.8.1.527(included in26.8and later)