Skip to content

Backport #108977 to 25.8: Fix out-of-bounds crash in ObjectStorageQueueSource::FileIterator::next - #112982

Merged
kssenii merged 3 commits into
25.8from
backport/25.8/108977
Aug 4, 2026
Merged

kssenii merged 3 commits into
25.8from
backport/25.8/108977

Conversation

@robot-clickhouse-ci-1

@robot-clickhouse-ci-1 robot-clickhouse-ci-1 commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #108977
Cherry-pick pull-request #112834

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 25.8.29.49

@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-critical-bugfix labels Aug 2, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [934bc90]

The backport commit accidentally carried three leftover files from a local
test run: `tests/queries/0_stateless/default_04665_nested.parquet` (7.5 MB),
`err_04665.txt` and `out_04665.txt`. They are unrelated to the
`ObjectStorageQueueSource::FileIterator::next` fix and do not exist on
`master` or `25.8`.
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 The robot's backport commit 6b0c9630 accidentally carried three leftover files from a local test run — tests/queries/0_stateless/default_04665_nested.parquet (7.5 MB), err_04665.txt and out_04665.txt. They are unrelated to the ObjectStorageQueueSource::FileIterator::next fix and exist neither on master nor on 25.8. Removed them in a follow-up commit and merged 25.8 (the branch was 7 commits behind).

The diff against 25.8 is now exactly the intended four files (FailPoint.cpp, ObjectStorageQueueIFileMetadata.cpp, ObjectStorageQueueSource.cpp, test_parallel_inserts.py, +143/-2).

Note: the 7.5 MB blob still exists in this branch's history, so please squash-merge this pull request to keep it out of the 25.8 history.

@kssenii
kssenii merged commit 857a62e into 25.8 Aug 4, 2026
34 checks passed
@kssenii
kssenii deleted the backport/25.8/108977 branch August 4, 2026 09:41
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-backport Changes, backported to release branch. Do not use manually - automated use only! pr-critical-bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants