Skip to content

Raise the integration tests' parallel session timeout to 9000 seconds - #118384

Closed
groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:raise-integration-parallel-session-timeout
Closed

groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:raise-integration-parallel-session-timeout

Conversation

@groeneai

@groeneai groeneai commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #111327

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):

Raise the integration tests' parallel pytest session timeout from 7200 to 9000 seconds so an ordinarily slow runner no longer cuts a shard before it has reported any test result.

Description

Integration tests (amd_asan_ubsan, db disk, old analyzer, N/6) fails as a job-level ERROR: session-timeout occurred during test execution with a synthetic Timeout row and, canonically, zero failing tests. The parallel pytest phase is cut by its own graceful --session-timeout, so the shard reports no verdict for the tests it never reached, and the cut also skips the sequential phase. It goes red without having tested anything.

The trigger is runner speed, not the suite, packing or memory. Dividing each test's duration by its own 7-day median on the same shard and taking the median per job run, the 10 Timeout runs of the last three days sit at 1.189 with 80% above 1.10, against 0.999 and 0.63% for the 7123 that passed. 20% is enough only because the bound sits close to what the shard already spends: median realised worker-seconds are 82.6% to 87.2% of the 3 workers x 7200 s allowed, so a shard tolerates just 1.146x to 1.211x. The firing order follows, the two tightest shards owning 7 of the 10 runs and the two loosest none.

9000 and not 8100: at the worst observed slowdown of 1.327 the tightest shard needs 8504 s, so 8100 would leave a tolerance of 1.290, below a slowdown already seen. 9000 leaves 5.5% to 10.6% spare. Green runs pay nothing: the bound is a ceiling on a suite that is not finishing, not a budget they spend; they exit well below either value. The hard backstop follows to 9600 s and the worst case stays about 4200 s under praktika's 5 hour job default.

Two costs. A genuinely hung suite now holds its runner about 30 minutes longer. Release branches carry their own copy of this file, so the larger db disk, N/4 Timeout population there is not addressed here.

Per-shard margin, three days of green runs
shard median realised (s) % of 21600 tolerance @7200 @8100 @9000 Timeout runs in 3 d
1/6 17838 82.6 1.211 1.362 1.514 0
2/6 18237 84.4 1.184 1.332 1.480 1
3/6 18567 86.0 1.163 1.309 1.454 4
4/6 17869 82.7 1.209 1.360 1.511 0
5/6 18841 87.2 1.146 1.290 1.433 3
6/6 18509 85.7 1.167 1.313 1.459 2

Tolerance is the slowdown factor a shard absorbs before its realised cost crosses the bound.


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

`Integration tests (amd_asan_ubsan, db disk, old analyzer, N/6)` ends as a
job-level `ERROR: session-timeout occurred during test execution` with a
synthetic `Timeout` row and, in the canonical case, zero failing tests. The
parallel pytest phase is cut by its own graceful `--session-timeout`, so the
shard publishes no verdict for the tests it never reached; a parallel-phase
timeout also sets `has_error`, which skips the sequential phase entirely. The
shard is therefore red without having tested anything, which is signal loss on a
required check rather than a bug report.

Such a run is not a hung suite, not a packing problem and not a memory problem.
It is a run whose runner executed essentially every test slower than that same
test's own median on that same shard. Dividing each test's duration by its own
7-day median on the same shard, then taking the median of those ratios per job
run:

    arm        job runs   median slowdown     p90     max   runs > 1.10
    Timeout          10             1.189   1.327   1.327       8 (80%)
    passed         7123             0.999   1.028   1.313    45 (0.63%)

That ordinary variance is enough only because the bound sits close to what the
shard already spends. Median realised worker-seconds over three days of green
runs, against the 3 workers x 7200 s the phase is allowed:

    shard   realised (s)   % of 21600   tolerance   Timeout runs in 3 d
    1/6            17838         82.6       1.211                     0
    2/6            18237         84.4       1.184                     1
    3/6            18567         86.0       1.163                     4
    4/6            17869         82.7       1.209                     0
    5/6            18841         87.2       1.146                     3
    6/6            18509         85.7       1.167                     2

The two tightest shards own 7 of the 10 firings and the two loosest own none,
which is the cheapest confirmation that the margin, not the suite, is what
varies.

9000 and not 8100: required wall time is realised / 3 workers, times the
slowdown, over a worker utilisation of about 0.98 (green runs reach 96.6% to
99.7% of the bound, so the workers are near saturation). At the worst observed
slowdown of 1.327 the tightest shard needs 8504 s. 8100 would lift that shard to
a tolerance of 1.290 against an already-observed 1.327, so it fails the very
distribution it was chosen from. 9000 covers the whole observed distribution with
5% to 7% spare on every shard.

Raising it costs the 7123 green runs nothing, because the bound is a ceiling on a
suite that is not finishing rather than a budget: those runs finish and exit well
below either value. The hard subprocess backstop tracks the bound to 9600 s, so
the graceful path stays reachable, and the worst case of 9600 + 3600 + 600 =
13800 s leaves about 4200 s under praktika's 5 hour job default.

Deliberately unchanged: `session_timeout_sequential`, because the sequential
phase costs 38 s to 190 s per shard against 3600 s, a tolerance of 51x to 95x;
the `is_llvm_coverage` branch, which now clamps back down to 7200 for a lane that
manages its budget by skipping the tests that do not fit and has zero `Timeout`
rows in 14 days; the flaky-check clamp, which already bounds both phases below
the external cancellation ceiling; and the operator `--session-timeout` flag,
whose doubling is that flag's own contract.

Two honest costs. A genuinely hung suite now holds its runner about 30 minutes
longer. Runs previously cut at 7200 s will execute the modules they never
reached, which is what they were always meant to do, but those modules get their
first exposure on a slow runner. Release branches carry their own copy of this
file, so the larger `db disk, N/4` Timeout population there is not addressed
here.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Sep 6, 2026
@groeneai

groeneai commented Sep 6, 2026

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

Pre-publication review by an independent model (engine: codex; 3 gate findings, all nits, plus 6
from my own cold pass; no blocker or major survived).

Measurement window: the three days to 2026-09-06, reproduced independently at review time on the
same day, with identical per-shard Timeout counts (1/6 0, 2/6 1, 3/6 4, 4/6 0, 5/6 3, 6/6 2).
Over 7 days every shard fires (4, 3, 14, 6, 12, 8): the two tightest still own 55% against the two
loosest 21%, so the wider window supports the same conclusion.

One reading note on the commit message: in its slowdown table arm heads the study arm, whose rows
are Timeout and passed, and not aarch64. Every number in this PR is measured on the six
amd_asan_ubsan, db disk, old analyzer, N/6 shards; Integration tests (arm% has no Timeout row
at all in the window.

# Sev Finding Verdict Evidence / action
1 💡 ci/defs/job_configs.py:1288-1292 still calls the bound "the two-hour pytest session timeout" DISAGREE Left as it is, deliberately. Its subject has one caller, ci/workflows/release_branches.py:40, and release branches keep their own copy of integration_test_job.py at 3600 * 2, so it stays accurate for the jobs it describes; its conclusion survives the raise anyway (110000 / 4 / 3 = 9167 > 9000). Disclosing it here rather than growing this PR to a second file
2 💡 the new in-diff comment should be deleted, or replaced by a 9000/9600/18000 numbers note DISAGREE It states why the literal is a ceiling and not a budget, which is what stops a later edit from trimming it toward observed spend. Restating 9600 and 18000 in prose would duplicate session_timeout_parallel + 600 and praktika's job default and rot on the next change to either
3 💡 the body's three-day window is relative, not an ISO range AGREE Pinned above instead of re-editing a body the gate had already reviewed
4 💡 effectiveness depends on the flag beating tests/integration/pytest.ini AGREE, verified --session-timeout is pytest-timeout's, not xdist's: pytest_configure reads config.getoption("session_timeout") first and falls back to the ini only when it is None (pytest-timeout 2.4.0, pytest_timeout.py:162-173). Both were 7200 until now, so nothing observed could have discriminated; the CI flag wins and the ini keeps its local-run default
5 💡 "5% to 7% spare on every shard" understates four of the six AGREE, fixed before publication The body now states the measured range, 5.5% to 10.6%

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

Session id: cron:clickhouse-review-slot-8:20260906-052500

@groeneai groeneai added the groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect label Sep 6, 2026
@clickhouse-gh clickhouse-gh Bot closed this Sep 6, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Sep 6, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 6, 2026
@groeneai

groeneai commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? No local repro exists and none can: the trigger is a slow CI runner, and nothing in the repository makes a runner slow or fast. The falsifiable substitute is the CIDB marker test_name = 'Timeout' AND test_status IN ('FAIL','ERROR'), 107 rows over ~99 distinct trees in 14 days on this family, with a four-shard control on one binary (tree ff11b640e3ff97e9: 3/6 and 6/6 cut at per-test ratios 1.242 and 1.186 while 1/6, 2/6, 4/6, 5/6 passed at 1.003, 0.958, 0.952, 0.957).
b Root cause explained? Yes. A slow runner inflates every test's duration by a near-constant factor; realised worker-seconds are already 82.6% to 87.2% of the 3 workers x 7200 s the parallel phase is allowed, so the wall clock crosses --session-timeout before the last modules finish, xdist cuts the session, has_error is set, the sequential phase is skipped, and praktika reports a job-level ERROR with no verdicts for the remainder. Excluded on measurement: leak (slowdown flat across the run), imbalance (packer priced all six shards within 1 s), memory (oom_memcg 0, code 137 0, /docker peak 28.4 to 30.9 of 48.8 GiB).
c Fix matches root cause? Yes. The defect is a mismatch between a fixed bound and variable runner speed, and the bound is the only place that margin is expressed. No assertion widened, no test skipped or tagged, no dataset shrunk, no error suppressed. Three alternatives were rejected on measurement: a 7th batch (a runner added to every PR run forever), a bound tracking the packer's projection (5402 s projected against a 6170 s median, so it needs a >=1.55 hardcoded multiplier and silently retunes every integration job on each duration-table refresh), and repricing the slow modules (the excess is diffuse: top 12 per-test deltas are ~19% to 20% of a shard's ~3000 s excess).
d Test intent preserved / new tests added? Preserved and improved: no test's assertions change, and runs that previously published nothing now report. No new test, because the repository has no test over praktika's scheduling literals and one asserting session_timeout_parallel == 9000 would only restate the constant. The exercise is this PR's own CI: the file is in common_integration_test_job_config.digest_config.include_paths, so every integration job re-runs on the new bound.
e Both directions demonstrated? Yes, in the only sense a scheduling literal admits. Forward: :1878 is proved to be the sole producer of the bound for every CI integration job (8 session_timeout_parallel sites, all in this file; no job passes --session-timeout; argparse default None). Backward: a negative control shows that probe can fail, and it does fail once a --session-timeout flag is injected into the job command.
f Fix is general across code paths? Yes. All 8 sites plus the two tests/integration/pytest.ini keys were dispositioned. The bound propagates to both pytest invocations and both hard backstops (7800 to 9600 s). Deliberately left, each measured: session_timeout_sequential (sequential phase costs 38 s to 190 s against 3600 s), the is_llvm_coverage branch (now an active clamp back down to 7200 for a lane that skips tests that do not fit and has 0 Timeout rows in 14 days), the flaky-check min(..., flaky_check_remaining_s) clamp under FLAKY_CHECK_TIME_LIMIT = 45 * 60, and the operator --session-timeout flag, whose doubling is its own contract.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A for type wrappers (one positive integer, no user input, no serialization). The equivalent surface, the job parametrizations that reach the literal, was walked: all 6 old-analyzer shards, 6 db disk, amd_tsan 6, amd_msan 8, arm_binary distributed plan 4, amd_llvm_coverage (clamped to 7200), flaky check (clamped to 45 min), targeted check, and bugfix validation. Every one gains margin or is explicitly clamped; none loses any.
h Backward compatible? (maintainer-approved exception only) Yes, nothing owed. No setting, so no SettingsChangesHistory.cpp entry; no serialization, wire format or config schema; ci/ is never shipped to users. Reverting the one literal restores the old bound exactly. Release branches keep their own copy at 3600 * 2, which is disclosed in the PR body.
i Invariants and contracts preserved? Yes. Invariant: the graceful cut must sit far enough above the shard's realised cost that ordinary runner-speed variance cannot reach it (tolerance now 1.433 to 1.514 against a worst observed 1.327). Three orderings hold on every path including error and early return: graceful cut below the hard backstop (derived as bound + 600, so 9600); total job content below praktika's 5 h ceiling (9600 + 3600 + 600 = 13800 < 18000); flaky and targeted budgets below the external cancellation ceiling, via the untouched clamp. has_error / timed_out / hard_killed semantics unchanged. One consequence stated rather than glossed: a run previously killed at the parallel cut now reaches the sequential phase, adding at most ~190 s measured, not 3600 s.

Session id: cron:clickhouse-impl-slot-4:20260906-040900

@clickhouse-gh

clickhouse-gh Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [18223c2]

Summary: ✅


AI Review

Summary

This PR raises the default parallel pytest session timeout in ci/jobs/integration_test_job.py from 7200 to 9000 seconds while leaving the coverage and explicit CLI override paths intact. The implementation itself is mechanically consistent, but the new default is shared by all integration-job parametrizations, so the PR fixes one overloaded shard family by weakening the common timeout guard for unrelated lanes; I do not think that tradeoff is justified in this form.

Findings

⚠️ Majors

  • [ci/jobs/integration_test_job.py:1879] The evidence in the PR body is specific to Integration tests (amd_asan_ubsan, db disk, old analyzer, N/6), but this default also feeds amd_tsan, amd_msan, arm_binary, distributed plan, bugfix validation, targeted, and amd_binary_excluded_from_llvm runs through the shared common_integration_test_job_config path. That means a genuine hang in any of those unrelated lanes now occupies a runner for an extra 30 minutes even though the problem being fixed is localized to one shard family. The safer fix is to change that parametrization (total_batches / runner class) in ci/defs/job_configs.py instead of broadening the common timeout ceiling.
Final Verdict

Changes requested.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 6, 2026
@groeneai

groeneai commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

cc @maxknv, could you review this? It raises session_timeout_parallel in ci/jobs/integration_test_job.py from 7200 to 9000 s, because the six db disk, old analyzer, N/6 shards already spend 82.6% to 87.2% of their 3-worker bound on a green run, so an ordinary 20% runner slowdown cuts the parallel phase and the shard goes red with no test result at all.

@maxknv

maxknv commented Sep 10, 2026

Copy link
Copy Markdown
Member

It's too large a value for a timeout. If the job is taking so long, we either need to add more shards or change the runner type

@maxknv maxknv closed this Sep 10, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Understood, I will not reopen it.

Data in case it helps with the shards/runner call: these jobs are not failing a test, they exhaust the session bound and die with partial results. Over the last 14 days Integration tests (amd_asan_ubsan, db disk, old analyzer, N/6) produced 154 such jobs across all six shards (mean wall clock 123 min against the 7200 s bound), and 132 of them had zero real failing tests, only the synthetic Timeout row with ERROR: session-timeout occurred during test execution. Example on master: 93e3ad2a, shard 2/6, 122.1 min.

The release branches are further over the bound, and they run a separate config (db disk, N/4, no old-analyzer split), so a master-only batch change will not reach them: same 14 days, pull_request_number = 0 runs only, 374 of 377 shard jobs timed out on 26.8 (100 commits), 256 of 388 on 26.7, 307 of 447 on 26.6, all in the same 122-123 min band with the same session-timeout marker.

On the batch-count axis I am not duplicating anything: #118933 is open for eight batches, and #116591 plus #115963 (duration weighting so the six shards balance) are already merged.

@maxknv

maxknv commented Sep 10, 2026

Copy link
Copy Markdown
Member

Understood, I will not reopen it.

Data in case it helps with the shards/runner call: these jobs are not failing a test, they exhaust the session bound and die with partial results. Over the last 14 days Integration tests (amd_asan_ubsan, db disk, old analyzer, N/6) produced 154 such jobs across all six shards (mean wall clock 123 min against the 7200 s bound), and 132 of them had zero real failing tests, only the synthetic Timeout row with ERROR: session-timeout occurred during test execution. Example on master: 93e3ad2a, shard 2/6, 122.1 min.

The release branches are further over the bound, and they run a separate config (db disk, N/4, no old-analyzer split), so a master-only batch change will not reach them: same 14 days, pull_request_number = 0 runs only, 374 of 377 shard jobs timed out on 26.8 (100 commits), 256 of 388 on 26.7, 307 of 447 on 26.6, all in the same 122-123 min band with the same session-timeout marker.

On the batch-count axis I am not duplicating anything: #118933 is open for eight batches, and #116591 plus #115963 (duration weighting so the six shards balance) are already merged.

make it 7 shards then. you can continue in this pr

@groeneai

Copy link
Copy Markdown
Collaborator Author

Will do. I will drop the timeout change and make this PR the batch count change instead: total_batches from 6 to 7 for the amd_asan_ubsan, db disk, old analyzer parameter set in ci/defs/job_configs.py, with the generated workflow files regenerated to match.

One sizing note, since the current margin is thin: over the last 14 days the shards that do finish have a median of 104 min and a p99 of 116 min against the 120 min bound (33,911 completed shard jobs), and 8.5 percent of them land past 110 min. Splitting 6 into 7 takes about 14 percent off the test portion, which should put the p99 near 100 min.

I will push to this branch shortly. Could you reopen the PR once the push lands? I would rather not reopen one you closed.

@maxknv maxknv reopened this Sep 10, 2026
@maxknv

maxknv commented Sep 10, 2026

Copy link
Copy Markdown
Member

One sizing note, since the current margin is thin: over the last 14 days the shards that do finish have a median of 104 min and a p99 of 116 min against the 120 min bound (33,911 completed shard jobs), and 8.5 percent of them land past 110 min. Splitting 6 into 7 takes about 14 percent off the test portion, which should put the p99 near 100 min.

make it 8 then

hard_killed = False
session_timeout_parallel = 3600 * 2
# A ceiling for a suite that is not finishing, not a budget the shard is expected to spend.
session_timeout_parallel = 9000

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 default is shared by every integration-job parametrization except the explicit is_llvm_coverage override, so the PR turns a slow-runner problem in amd_asan_ubsan, db disk, old analyzer, N/6 into a repo-wide timeout policy change. A genuine hang in unrelated lanes like amd_tsan, amd_msan, arm_binary, distributed plan, bugfix validation, or amd_binary_excluded_from_llvm will now hold its runner for an extra 30 minutes even though the evidence here only covers one overloaded shard family. Please fix the shard geometry or runner choice for that family in ci/defs/job_configs.py instead of relaxing the shared timeout guard here.

@groeneai

Copy link
Copy Markdown
Collaborator Author

Status here, since you reopened this for the eight batches: the change is written (total_batches 6 -> 8 on the amd_asan_ubsan, db disk, old analyzer parameter set only, plus the regenerated workflow files), and the timeout change is gone from it. I have not pushed it yet because my pre-push review gate cannot process the regenerated-workflow diff within its budget, and I do not want to publish content that gate has not seen. That is why the head here still shows the old timeout diff, which is not the intended change.

I am fixing that on my side and will push here. If you would rather not wait on me, #118933 makes the same 6 -> 8 move (for both ASan parameter sets), and this PR is then a no-op to close.

@groeneai

Copy link
Copy Markdown
Collaborator Author

Update, and then this PR has nothing left to carry. #118933 landed the same 6 to 8 split on master on 09-12, so the change I said I would push here is now a no-op against master, and I am not pushing it.

Eight batches did the job. Same 14 day window, old analyzer integration shards across all trees: N/6 ran 25559 shard jobs with 126 synthetic Timeout rows and 204 jobs past the 120 min bound; N/8 ran 8329 with 0 and 0. The release branches picked the split up on 09-15, and the db disk, N/4 arm that was the worst of it (443 of 517 jobs past the bound in the 10 days to 09-12) has not produced an over-bound job since.

The disposition is yours, since you closed and reopened this one: I would close it as superseded by #118933, but I will not touch its state. I am raising it only because the title here still reads the timeout raise you rejected, and I would rather that not stand as if it were pending work.

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). groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect manual approve Manual approve required to run CI pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants