Skip to content

Do not run fixed-address integration modules concurrently in targeted and flaky checks - #123750

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/targeted-integration-fixed-address-modules-sequential
Oct 11, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/targeted-integration-fixed-address-modules-sequential

Conversation

@groeneai

@groeneai groeneai commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #123699

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

Failing job: Integration tests (amd_asan_ubsan, db disk, targeted) on #123699. All 6 test_http_failover tests errored at setup (started_cluster did not yield a value); the job log has the cause, Could not acquire the lock /tmp/docker_net.lock within 10 minutes. The job's own -n 1 rerun passed them in 72 s, but the job stays red.

A cluster that pins a container address uses the one subnet of docker_compose_net.yml, so it holds the host-wide /tmp/docker_net.lock from start() to shutdown(), and a waiter gives up after 600 s. Since the targeted check runs -n 3 --dist=loadfile, nothing keeps such modules apart, and xdist starts the largest modules first. Here test_dns_cache (held 515 s), test_distributed_frozen_replica (163 s) and test_http_failover started together, so the third needed 678 s. In other targeted jobs the second holder routinely waits 400-541 s.

Change: in targeted and flaky checks at most one such module stays in the parallel phase, and the others move to the sequential -n 1 phase, which starts after the parallel one exits. Targeted keeps the one with the largest TEST_DURATIONS; flaky (--dist=each) moves all of them. The modules are detected from their source (a non-None ipv4_address=/ipv6_address= keyword, 11 modules today), which replaces the test_dns_cache special case. Normal batches are unchanged.

Cost: only targeted jobs with 2+ such modules change (about 2.6%); they add the moved modules' serial time (about 7 min here), partly offset by the lock waits that disappear.

Validation: a replay of this job's selection keeps test_dns_cache and the 4 non-holders parallel and moves the other 4 holders; on master all 9 are parallel.

Alternative: all such modules on one xdist worker via a custom scheduler in tests/integration/conftest.py, which keeps the overlap but changes scheduling for every integration run.


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

Version info

  • Merged into: 26.10.1.2088-master (included in 26.10 and later)

… and flaky checks

A cluster that pins a container address (`add_instance(ipv4_address=...` or
`ipv6_address=...)`) is placed on the single subnet of `docker_compose_net.yml`, so
`ClickHouseCluster.start()` takes the host-wide `/tmp/docker_net.lock` and holds it until
`shutdown()`; a waiter gives up after 10 minutes.

Since the PR workflow became targeted-only (7859137), the targeted check runs its
selection with `-n 3 --dist=loadfile` and nothing routes such modules apart. xdist starts the
units with the most tests first, which in a DNS-heavy selection are the fixed-address modules.
On ClickHouse#123699 `test_dns_cache` (held 515 s), `test_distributed_frozen_replica` (163 s) and
`test_http_failover` started together; the third needed 678 s, hit the 600 s lock timeout, and
all 6 of its tests errored at setup. In other targeted jobs the second holder routinely waits
400-541 s of its budget.

In the targeted and flaky checks, keep at most one such module in the parallel phase and move
the others to the sequential `-n 1` phase, which starts after the parallel pytest exits:
- targeted (`--dist=loadfile`): the module with the largest `TEST_DURATIONS` entry stays parallel;
- flaky (`--dist=each`): every worker runs every module, so all of them move, together with the
  existing `dist_each_sequential` modules.

The modules are detected from their source: a non-None `ipv4_address=`/`ipv6_address=` keyword,
which is what makes `add_instance` set `with_net_trics` (11 modules today, equal to an AST census
of `add_instance` calls). A suite (`test_x`) or extensionless (`test_x/test`) selector is resolved
to its module files first, for this check and for the `dist_each_sequential` prefixes. This
replaces the `test_dns_cache` special case of the flaky check.
Normal batches, bugfix validation and the retry phase are unchanged.

Related: ClickHouse#123699

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 Oct 3, 2026
@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)
Finding Verdict
⚠️ Suite (test_x) and extensionless (test_x/test) selectors of a local flaky run were not resolved, so a fixed-address or dist_each_sequential module could stay in the --dist=each phase AGREE, fixed: both checks resolve the selector to its module files first
💡 The sequential phase is skipped when the parallel phase already has 5+ failures, so moved modules do not run on such a run Noted: existing semantics; the job is already red
💡 Worst case adds about 10 min of serial time when all 11 fixed-address modules are selected Noted: design cost, partly offset by the removed lock waits

@clickhouse-gh

clickhouse-gh Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [99259a2]

Summary: ✅


AI Review

Summary

This PR replaces the hard-coded test_dns_cache special case with source-based detection of integration modules that pin ipv4_address/ipv6_address, and applies the same exclusivity rule to targeted runs so at most one /tmp/docker_net.lock holder stays in the parallel phase. I did not find a correctness or contract issue in the current diff: the detector matches the current fixed-address modules in-tree, the existing flaky-only dist_each_sequential behavior is preserved, and targeted jobs still execute the moved modules because their PR variants combine the former parallel and sequential flavors into one job.

Final Verdict

✅ No new findings.

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Replaying the failing job's 9-module selection through the job's routing puts all 9 modules, 5 of them holding /tmp/docker_net.lock, in the -n 3 parallel phase on master, every run.
b Root cause explained? A fixed-address cluster holds the host-wide /tmp/docker_net.lock from start() to shutdown() and a waiter gives up after 600 s; the targeted -n 3 run started three holders together, so the third needed 678 s.
c Fix matches root cause? Yes. The lock already serializes these modules; the fix keeps at most one of them in the parallel phase and runs the rest in the sequential phase, so nobody waits on the lock. Not a timeout increase.
d Test intent preserved / new tests added? No test changes. CI-script changes are checked with throwaway probes, not committed tests (in-tree rule).
e Both directions demonstrated? Yes. Master: all 9 parallel. Fix: test_dns_cache + 4 non-holders parallel, the other 4 holders sequential. Deletion mutations of the job condition, the detector and the keep-one rule each redden a probe.
f Fix is general across code paths? Targeted and flaky checks use one rule for all 11 fixed-address modules; the test_dns_cache special case of the flaky check is gone. Normal batches, bugfix validation and the retry phase are unchanged (no lock timeouts there in 30 days).
g Fix generalizes across inputs (params/datatypes/wrappers)? Module, module.py::case, suite and extensionless selectors; empty and duplicate inputs, modules missing from TEST_DURATIONS, all 11 holders, both schedules. The detector equals an AST census over 1141 modules.
h Backward compatible? (maintainer-approved exception only) CI only. No server, setting or format change; the renamed function had one caller.
i Invariants and contracts preserved? Bucket order is preserved and every entry of a module lands in one bucket. The sequential phase starts only after the parallel pytest exits, so the one parallel holder never overlaps a sequential one.

Session id: cron:clickhouse-impl-slot-4:20261003-183400

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 3, 2026
@groeneai
groeneai requested a review from maxknv October 3, 2026 20:03
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Oct 3, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 10, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 10, 2026
Merged via the queue into ClickHouse:master with commit 7eaa625 Oct 11, 2026
160 of 161 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 11, 2026
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 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.

3 participants