Skip to content

Bound each docker-library test run in the Docker image jobs - #128093

Open
groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:groeneai/bound-docker-library-test-runs
Open

groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:groeneai/bound-docker-library-test-runs

Conversation

@groeneai

@groeneai groeneai commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

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

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

Docker server image on #124125 printed nothing for 4h43m inside the head-distroless-amd64 docker-library tests,
then died on the 18000s job cap with an empty ERROR: https://github.com/ClickHouse/ClickHouse/actions/runs/40687127725/job/122900647059
(report).
#113869 bounded the buildx loop; its review noted this tail phase was still unbounded.

docker_library.py runs test/run.sh with no timeout, both per image (test_docker_library) and per test
(validate_bugfix_tests). One docker run that never returns therefore holds the whole job. A GNU timeout is not
enough: in the distroless image clickhouse-client is PID 1 with no SIGTERM handler, so a sig-proxying docker run
survives SIGTERM and keeps the output pipe open.

Both calls now go through Shell.run(timeout=600). It sends SIGTERM to the whole process group, then SIGKILL after
100s. The slowest healthy run in 90 days took 157s. On expiry the image result is FAIL, and its info names the hung
test and carries praktika's timeout warnings. In bugfix validation, a killed run is an ERROR "did not finish",
never "fails on master as expected".

Validated locally (no tests for test infrastructure) with two scratch tests that hang: a client that never returns,
and a docker run that survives SIGTERM. Without the change both were still running at 900s. With a 60s bound they
fail at 62s and 160s; with the shipped 600s the first fails at 601s. On the head, head-alpine and
head-distroless images, runs with and without the change give the same results.


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

`test_docker_library` and `validate_bugfix_tests` ran the official-images
`test/run.sh` with no timeout. A test is a chain of `docker run` calls, so
one that never returns held `Docker server image` until the 18000s job cap,
which then reported an empty ERROR. That happened on PR ClickHouse#124125: the
`head-distroless-amd64` test `clickhouse-distroless-custom-user` printed
nothing for 4h43m (job 122900647059). ClickHouse#113869 bounded the buildx loop only.

Run both through praktika `Shell.run(timeout=RUN_SH_TIMEOUT)`, which sends
SIGTERM to the whole process group and SIGKILL 100s later. A GNU `timeout`
around `run.sh` would not do: in the distroless image `clickhouse-client` is
PID 1 with no SIGTERM handler, so a sig-proxying `docker run` survives
SIGTERM and keeps the output pipe open.

600s is 3.8x the slowest healthy run in 90 days (157s, no run over 300s).
`test_docker_library` passes `Shell.check` as the callable of
`from_commands_run`, so the image's info keeps the test output and gains
praktika's timeout warnings and the partial line that names the hung test.
In `validate_bugfix_tests` a run killed by a signal is an ERROR "did not
finish", never "fails on master as expected": `run.sh` prints the test
marker before it runs the test, so a killed run's output contains it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (1 nit).

# Sev Finding Verdict Evidence / action
1 💡 validate_bugfix_tests: when a changed test times out on every image, the per-test summary says "runs on none of" (docker_library.py:225-227) AGREE, not blocking Status is ERROR, never a false OK; the per-image row above it says "did not finish ... within 600s"

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Two scratch docker-library tests that hang on every run: a client whose query never ends, and a docker run whose PID 1 drops SIGTERM. Without the change, both were still running when a 900s guard fired.
b Root cause explained? docker_library.py runs test/run.sh with no timeout in test_docker_library and in validate_bugfix_tests, so one docker run that never returns holds the job until the 18000s cap, which reports an empty ERROR.
c Fix matches root cause? Yes. Both call sites now use praktika Shell.run(timeout=600): SIGTERM to the process group, then SIGKILL after 100s. That also reaches a docker run that survives SIGTERM. No test is weakened.
d Test intent preserved / new tests added? Test-infrastructure change, so no repo test. Existing docker-library tests are untouched and give the same results on the head, head-alpine and head-distroless images before and after.
e Both directions demonstrated? Yes. Base: still running at 900s for both hangs. Patched: FAIL at 62s and 160s with a 60s bound, and at 601s with the shipped 600s. Bugfix validation: a killed run is ERROR; with the exit_code > 0 guard removed it is falsely OK.
f Fix is general across code paths? Both run.sh call sites are bounded; Docker keeper image uses the same functions. git clone and docker pull are left as they are (network, retried).
g Fix generalizes across inputs (params/datatypes/wrappers)? Ubuntu, alpine and distroless images; the exit-code classes 0, >0 with and without the test marker, and <0 (killed) were all exercised.
h Backward compatible? (maintainer-approved exception only) Yes. Healthy runs (157s max over 90 days) are unchanged; only a run over 600s changes, from hanging to FAIL/ERROR.
i Invariants and contracts preserved? from_commands_run gets a bool from Shell.check, so the captured output stays the info. The 3-way bugfix classification is kept, with the killed case moved out of "fails as expected".

Session id: cron:clickhouse-impl-slot-6:20261028-212700

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @Felixoid, could you review this and add the can be tested label so CI runs? It bounds each docker-library run.sh call in docker_library.py with Shell.run(timeout=600) (process-group SIGTERM, then SIGKILL), so one hung docker run fails that image instead of holding the job until the 18000s cap.

@clickhouse-gh

clickhouse-gh Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3b1b7ee]

Summary: ✅


AI Review

Summary

PR #128093 bounds both docker-library execution paths with a 600-second watchdog, distinguishes signaled bugfix-validation runs from expected test failures, and supports checkout reuse and invocation-specific readiness retries. Reviewed the complete diff and current code at 3b1b7eecf8dc8d0d4880eb540f34c10f4c7e7aa5, including prior discussion. The earlier watchdog finding is addressed; no outstanding findings remain.

Missing context / blind spots
  • ⚠️ Current CI reports contain no Docker server/keeper image test results. Runtime evidence comes from the scratch runs documented in the PR; completed image jobs would provide independent confirmation. No local tests were run in this review job.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). labels Oct 28, 2026
@Felixoid Felixoid added the can be tested Allows running workflows for external contributors label Oct 29, 2026
@Felixoid Felixoid self-assigned this Oct 29, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Nov 24, 2026
clickhouse-gh[bot]
clickhouse-gh Bot previously approved these changes Nov 24, 2026
@clickhouse-gh
clickhouse-gh Bot dismissed their stale review November 24, 2026 14:00

AI review of a later commit does not approve the PR, see the AI Review comment.

@Felixoid
Felixoid force-pushed the groeneai/bound-docker-library-test-runs branch from 5dc530e to 0f910dc Compare November 24, 2026 14:06
test_docker_library also takes a test_tries override, passed to
run.sh as CLICKHOUSE_TEST_TRIES, and reuses an existing
official-images checkout. Both come from clickhouse-private,
so the function is the same in both repos.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). manual approve Manual approve required to run CI pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants