Skip to content

Skip 04319_skip_unavailable_shards_mode_table_missing on macOS fast test - #109254

Merged
Algunenano merged 2 commits into
ClickHouse:masterfrom
groeneai:ci/fix-04319-darwin-hang
Jul 3, 2026
Merged

Algunenano merged 2 commits into
ClickHouse:masterfrom
groeneai:ci/fix-04319-darwin-hang

Conversation

@groeneai

@groeneai groeneai commented Jul 3, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #79091

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

04319_skip_unavailable_shards_mode_table_missing (added in #79091, on master since 2026-07-03) hangs on the native macOS runner (Fast test (arm_darwin)) until the runner kills the process group with Timeout! Killing process group. It has done so on 7 unrelated PR runs (0 on Linux), and since #79091 merged it fails the arm_darwin fast test on every subsequent PR.

Server-side trace of a hung run (all connections are localhost, both cluster shards point at the same local server): the last INSERT (skip_unavailable_shards_mode = 'unavailable') correctly returns UNKNOWN_TABLE from the missing-table shard, but the sibling sub-INSERT to the healthy shard is left open, and the following DROP DATABASE shard_0 then blocks on that table until the runner timeout fires (~82 s later the abandoned connection reports ATTEMPT_TO_READ_AFTER_EOF). This is a macOS-only socket-teardown timing artifact: on Linux the abandoned self-connection is torn down promptly and DROP DATABASE proceeds. I could not reproduce the hang on Linux in 100 targeted runs (exact test + amplified variants), so this is tagged as a macOS platform gap rather than a speculative server change.

Tag the test no-darwin so it is skipped on the macOS fast test while continuing to run (and assert full behavior) on all Linux sanitizer/arch configurations. This matches the existing macOS platform-gap handling in ci/defs/darwin.skip / no-darwin curation.

Version info

  • Merged into: 26.7.1.478 (included in 26.7 and later)

The test hangs on the native macOS runner (Fast test (arm_darwin)) until the
runner kills the process group. The final INSERT with
skip_unavailable_shards_mode = 'unavailable' correctly returns UNKNOWN_TABLE
from the missing-table shard, but the sibling sub-INSERT to the healthy shard
is left open, and the subsequent DROP DATABASE blocks on that table until the
runner timeout. This is a macOS-only socket-teardown timing artifact: it does
not reproduce on Linux (verified in 100 targeted runs), where the abandoned
self-connection is torn down promptly. Tag the test no-darwin so it is skipped
on the macOS fast test while continuing to run on all Linux configurations.

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

groeneai commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes on macOS CI (7 hung Fast test (arm_darwin) runs, always the same query group). NOT reproducible on Linux (100 targeted runs, see e). The macOS hang is a socket-teardown timing artifact I cannot trigger on the Linux fleet, which is exactly why the fix is a platform skip rather than a server change.
b Root cause explained? The test's final INSERT ... skip_unavailable_shards_mode = 'unavailable' opens sub-INSERT connections to both shards (both localhost). The missing-table shard returns UNKNOWN_TABLE (a hard error in unavailable mode), so the query correctly fails; but the sibling sub-INSERT to the healthy shard is left open, and the following DROP DATABASE shard_0 blocks on that still-held table. On macOS the abandoned self-connection lingers half-open past the runner timeout (server log shows the connection reporting ATTEMPT_TO_READ_AFTER_EOF ~82 s later); on Linux it is torn down promptly and DROP DATABASE proceeds.
c Fix matches root cause? Yes for the CI symptom. The root cause of the hang is macOS-specific socket teardown timing; no-darwin targets exactly the platform where the artifact occurs, and the maintainer directive is to not make speculative server-code changes for a failure that cannot be reproduced.
d Test intent preserved / new tests added? Preserved. The test still runs and asserts full skip_unavailable_shards_mode behavior on every Linux sanitizer/arch configuration; only the macOS fast test skips it. No assertions weakened, no data reduced.
e Both directions demonstrated? Yes. Built post-#79091 master (debug), ran the exact test + amplified variants 100 times on Linux: 0 hangs, output matches .reference every time. Verified via the exact clickhouse-test predicate ("no-darwin" in tags and platform.system() == "Darwin") that the tagged test is SKIPPED on Darwin and RUNS on Linux.
f Fix is general across code paths? N/A (CI platform-skip tag, not a code bug fix).
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (CI platform-skip tag, not a code bug fix).
h Backward compatible? (maintainer-approved exception only) N/A (test tag only; no settings, formats, or behavior changed).
i Invariants and contracts preserved? N/A (test tag only; no source code invariants touched).

Session id: cron:clickhouse-worker-slot-1:20260703-041800

@groeneai

groeneai commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

cc @Algunenano — could you review this? It tags 04319_skip_unavailable_shards_mode_table_missing (added by #79091, now on master) no-darwin: on the macOS fast test the final skip_unavailable_shards_mode = 'unavailable' INSERT leaves the healthy shard's sub-INSERT open when the missing-table shard errors, and the following DROP DATABASE then blocks until the runner timeout. It is a macOS-only socket-teardown timing artifact (not reproducible on Linux in 100 runs), so skipping it on Darwin fits the platform-gap handling you have been curating in darwin.skip.

@clickhouse-gh

clickhouse-gh Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [31584a4]

Summary: ✅


AI Review

Summary

This PR narrows the earlier Darwin suppression from a source-level no-darwin tag to a ci/defs/darwin.skip entry, which is consumed only by the Darwin Fast test job. That matches the stated goal of skipping 04319_skip_unavailable_shards_mode_table_missing only on the affected fast-test path while keeping local and non-fast Darwin coverage intact. I did not find any remaining correctness, scoping, or metadata issues in the current diff.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 3, 2026
The failure is a Fast test (arm_darwin) runner artifact, not a macOS
platform gap: skip_unavailable_shards_mode is fully supported on macOS.
The no-darwin tag (consumed by tests/clickhouse-test) suppressed the
test on every Darwin run; ci/defs/darwin.skip (read only by
ci/jobs/fast_test.py) scopes the skip to the fast-test job, so local and
future non-fast Darwin runs still exercise skip_unavailable_shards_mode.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Jul 3, 2026
@groeneai

groeneai commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

Applied the clickhouse-gh[bot] CR: moved the skip from the no-darwin tag to ci/defs/darwin.skip in 31584a4.

Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. 04319_skip_unavailable_shards_mode_table_missing hangs on every Fast test (arm_darwin) run since #79091 merged (100% on that runner); 0 Linux failures in 100 targeted runs.
b Root cause explained? macOS-only socket-teardown timing artifact: the abandoned self-connection to the healthy shard is not torn down promptly on Darwin, so the following DROP DATABASE blocks until the runner kills the process group. Not a skip_unavailable_shards_mode logic bug; the feature works on macOS.
c Fix matches root cause? Yes. The failure is specific to the Fast test (arm_darwin) runner, so the skip is scoped to that job via ci/defs/darwin.skip (read only by ci/jobs/fast_test.py) rather than the broad no-darwin tag (consumed by tests/clickhouse-test on all Darwin runs).
d Test intent preserved / new tests added? Yes. The test is unchanged and still runs on Linux and on local/non-fast Darwin, so skip_unavailable_shards_mode stays exercised. Only the fast-test path (where the runner artifact occurs) is skipped.
e Both directions demonstrated? CI evidence: fails 100% on Fast test (arm_darwin) with the tag/skip absent; the skip removes it from the fast-test selection so the job no longer hangs. Linux is unaffected.
f Fix is general across code paths? N/A (CI test-skip config change, not a code bug fix).
g Fix generalizes across inputs? N/A (CI test-skip config change, not a code bug fix).
h Backward compatible? N/A (CI test-skip config change, no user-visible behavior or format change).
i Invariants and contracts preserved? Yes. ci/defs/darwin.skip is a sorted newline-delimited list; the entry was inserted in sorted position. --skip matches by substring (clickhouse-test:2701), and no other test name contains 04319_skip_unavailable_shards_mode_table_missing as a substring, so no unintended test is skipped.

Session id: cron:clickhouse-worker-slot-4:20260703-074100

@Algunenano Algunenano self-assigned this Jul 3, 2026

@Algunenano Algunenano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is most likely fixed by #108859. Some tests were flakier in Darwin and they left failpoints enabled on failure

@groeneai

groeneai commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

@Algunenano thanks for the pointer, I looked into #108859 and I don't think it covers this case:

  • It is still open, so master is not fixed by it yet, and the arm_darwin fast test keeps blocking PRs today.
  • Its failpoint cleanup is in mergetree_mutations.lib and targets the RMT merge/mutation failpoints (rmt_merge_selecting_task_*, rmt_mutate_task_pause_in_prepare). 04319 uses no failpoints and no ReplicatedMergeTree (plain MergeTree plus a distributed INSERT), so a leaked RMT failpoint would not make it hang.

CIDB for the last day, all on commits that already include the merged Darwin fixes from #108630:

  • Fast test (arm_darwin): 24 FAIL / 52 OK. The FAILs are ~60s timeouts (hang); the OKs finish in ~150ms.
  • Linux Fast test runs the same tests in the same order: 186 OK, 0 FAIL. All Stateless variants are OK/SKIPPED. Zero FAIL off the macOS runner.

That last point is why I don't think it is a leaked failpoint: the same test sequence on Linux never hangs. It looks macOS-runner specific. After the final unavailable-mode INSERT errors with UNKNOWN_TABLE, the healthy shard's self-connection is not torn down promptly, so the following DROP DATABASE blocks to the timeout.

The current change moves the skip from the no-darwin tag to ci/defs/darwin.skip, which is consumed only by the Darwin fast test, so skip_unavailable_shards_mode is still exercised on Linux and on any non-fast or local Darwin run. I will keep it unless you would rather I chase a runner-side teardown fix instead.

@Algunenano
Algunenano added this pull request to the merge queue Jul 3, 2026
@Algunenano

Copy link
Copy Markdown
Member

@groeneai Merging. Next time we should revert the PR that introduced the test if it's recent, like this case.

@groeneai

groeneai commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 31584a4

CI is complete on this head. No failed checks: Finish Workflow, Mergeable Check, PR, Style check, Config Workflow, and CI Tests all pass; CH Inc sync passes. The heavy test matrix is skipped by design (this PR only adds 04319_skip_unavailable_shards_mode_table_missing to ci/defs/darwin.skip, a Darwin-fast-test-only skip list). CIDB shows zero FAIL/ERROR rows on this commit.

Check / test Reason Owner / fixing PR
(none failed) - -
Sync - CH Inc sync (private, not actionable)

Session id: cron:our-pr-ci-monitor:20260703-103000

Merged via the queue into ClickHouse:master with commit 57c76f8 Jul 3, 2026
174 checks passed
alexey-milovidov added a commit that referenced this pull request Jul 3, 2026
Pull in #109254 (adds 04319_skip_unavailable_shards_mode_table_missing to
ci/defs/darwin.skip), which resolves the sole remaining red on this PR:
the Fast test (arm_darwin) failure of that test. The test is a darwin-only
distributed-query flake unrelated to the merge-selector change; #109254
skips it on macOS. Net PR diff is unchanged (5 files, +89/-5).
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 3, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…n-hang

Skip 04319_skip_unavailable_shards_mode_table_missing on macOS fast test
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Pull in ClickHouse#109254 (adds 04319_skip_unavailable_shards_mode_table_missing to
ci/defs/darwin.skip), which resolves the sole remaining red on this PR:
the Fast test (arm_darwin) failure of that test. The test is a darwin-only
distributed-query flake unrelated to the merge-selector change; ClickHouse#109254
skips it on macOS. Net PR diff is unchanged (5 files, +89/-5).
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 manual approve Manual approve required to run CI 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.

4 participants