Skip to content

Skip 05397_clickhouse_local_locked_path_untouched on macOS - #128088

Merged
devcrafter merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-05397-no-flock-darwin
Oct 29, 2026
Merged

devcrafter merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-05397-no-flock-darwin

Conversation

@groeneai

@groeneai groeneai commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #116042

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

05397_clickhouse_local_locked_path_untouched is skipped on macOS, where the util-linux flock command it uses is not available.

Description

05397_clickhouse_local_locked_path_untouched (added by #116042) fails in Fast test (arm_darwin) on every PR whose merge commit contains it (150 FAIL rows in 24 hours, all in that check), e.g. #113173. It passes on every Linux check.

The test holds the status lock with flock(1), a util-linux command that macOS does not have, so on darwin clickhouse local never starts and the expected Another server instance in same directory is already running line is missing.

As requested in review, the test is now tagged no-darwin; its body is unchanged from master. tests/clickhouse-test parses the tag ({'no-darwin'}; none on the master file) and skips such tests on Darwin: the existing no-darwin tests are SKIPPED in 230 of 230 Fast test (arm_darwin) runs over the last 24 hours.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.889-master (included in 26.11 and later)

macOS has the flock(2) system call but not the util-linux flock(1)
command. On the darwin runner the test's `flock -x <status> clickhouse
local ...` failed with "flock: command not found", the second
clickhouse-local never started, and `2>&1 | grep` hid the error, so
`Fast test (arm_darwin)` failed on every PR that contains the test
(added by ClickHouse#116042) with only the "Another server instance ..." line
missing.

Hold the lock with a python3 `fcntl.flock` holder instead. It is the
same flock(2) call StatusFile uses, the lock is held while the child
runs, the child does not inherit the lock fd, and the exit code is the
child's, as with flock(1). ci/jobs/scripts/clickhouse_proc.py already
probes this lock with fcntl.flock.

Validated on Linux: with a fake flock that exits 127 first in PATH the
old test fails with exactly the darwin diff and the new one passes;
with the lock line removed the new test fails; 50/50 randomized runs
pass.

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;
bounded: 1 full pass + 1 fix round + 1 delta recheck).

No findings were raised on this change, so nothing was adjudicated.

Session id: cron:clickhouse-review-slot-8:20261028-203500

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes: a fake flock that exits 127 first in PATH makes the old test fail every run with exactly the darwin diff (only the Another server instance ... line missing).
b Root cause explained? The test held the lock with util-linux flock(1), which macOS lacks; the error is hidden by 2>&1 | grep, so the second clickhouse local never runs.
c Fix matches root cause? Yes: the lock is taken with Python's fcntl.flock, the same flock(2) call StatusFile uses. No skip tag, oracle unchanged.
d Test intent preserved / new tests added? Yes: the second instance still meets a held exclusive lock; with the lock line removed the test fails (the directory gets cleaned). No new test, the test is the change.
e Both directions demonstrated? Old test FAIL / new test OK with the fake flock; negative control FAIL; both OK with the real flock on Linux; 50/50 randomized runs OK.
f Fix is general across code paths? The only other flock(1) user is with_lock() in shell_config.sh, used only by a no-fasttest test, so it never runs on darwin.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only change).
h Backward compatible? (maintainer-approved exception only) N/A (test-only change).
i Invariants and contracts preserved? The holder keeps the lock for the child's whole run, the child does not inherit the lock fd, and the exit code is the child's, as with flock(1).

Session id: cron:clickhouse-impl-slot-4:20261028-202200

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @yakov-olkhovskiy, could you review this and add the can be tested label so CI runs? The new 05397 test held the status lock with util-linux flock(1), which the macOS runner does not have, so Fast test (arm_darwin) fails on every PR; the lock is now held by a python3 fcntl.flock holder, the same flock(2) call StatusFile uses.

@clickhouse-gh

clickhouse-gh Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [59f220c]

Summary: ✅


AI Review

Summary

PR #128088 adds no-darwin to 05397_clickhouse_local_locked_path_untouched, which depends on the unavailable util-linux flock command on macOS. The existing runner implements this skip, and the test body is unchanged. No actionable findings at head 59f220cb81878d374a5f9cf9b4d2f6504b4d90b4.

Missing context / blind spots
  • ⚠️ The current Darwin CI report contains no test results, so native execution of the skip is unconfirmed. A completed report showing this test as SKIPPED would close this gap; the skip behavior is established by the runner code.
Final Verdict

Status: ✅ Approve. No changes requested.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - e48ed37

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (arm_binary, parallel) / 05055_format_schema_source_query_background_access flaky, not from this PR (its diff changes only 05397): a randomized session_timezone ahead of the server date makes the text_log filter miss the row (69 PRs in 14 days). The tested merge tree predates the fix #127797 (mine, merged)
Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) / 05055_format_schema_source_query_background_access same failure as the row above, same tested tree #127797 (mine, merged)
Mergeable Check, PR praktika rollups of the rows above #127797 (the owner of the rows above)

The changed test passed on Fast test (arm_darwin), where it failed before, and 50 of 50 runs in each flaky check. CH Inc sync is green. The earlier Config Workflow failure was the attempt before the can be tested label.

Session id: cron:our-pr-ci-monitor:20261029-003003

@rienath rienath 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.

Just add 05397_clickhouse_local_locked_path_untouched to blacklist s.t. it doesn't run on darwin

@rienath rienath self-assigned this Oct 29, 2026

@rienath rienath 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.

@groeneai please prioritise this, CI is red everywhere

Per review: instead of replacing flock(1), tag the test no-darwin. It
holds the status lock with util-linux flock(1), which the macOS runner
does not have, so the locked-path check never runs there. The test body
is restored to master's version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Do not use flock(1) in 05397_clickhouse_local_locked_path_untouched, macOS does not have it Skip 05397_clickhouse_local_locked_path_untouched on macOS Oct 29, 2026
This was referenced Oct 30, 2026
@clickhouse-gh clickhouse-gh Bot added comp-local clickhouse-local / embedded modes (incl. local file processing). and removed comp-testing Test content only (no production code). labels Nov 22, 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-local clickhouse-local / embedded modes (incl. local file processing). 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.

6 participants