Repository navigation
Conversation
Fast test (arm_darwin) fails a few times a day, on unrelated PRs, with Permission denied on ci/tmp/clickhouse. The binary is the self-extracting bundle and it destroys itself: unlink(self) succeeds, the Darwin-only std::filesystem::copy_file(tmp -> self) then fails EEXIST, and the error return happens before the chmod that restores the executable bit, so the process exits having removed its own binary. Every later invocation of that path is Permission denied. The decompressor's progress dots appear exactly once in the failing log, immediately followed by File exists, which is that copy_file's message. Why the destination exists after a successful unlink is not established and could not be reproduced: this is macOS-only and no macOS host was available. Two mechanisms remain possible, path resolution through _NSGetExecutablePath/realpath/APFS naming a different directory entry than unlink removed, or a symlink-following source-destination equivalence match, and the current bare File exists carries no label and no path, so it cannot tell them apart. Rather than guess at a fix, report the destination's identity at the abort and keep the failure closed. Both lstat and the symlink-following stat are emitted for destination and source, because they answer different questions: lstat gives the directory entry, while libc++ compares the FOLLOWED pair before returning EEXIST (operations.cpp stat_equivalent), so the equivalence flag is computed from the followed stats. An lstat-only comparison would report "not equivalent" in exactly the case libc++ reports as EEXIST. The original wrapper's dev/inode is included so a path-resolution divergence shows up as a mismatch against what unlink was expected to have removed. Two candidate fixes were dropped on measurement rather than opinion. copy_options::overwrite_existing is a no-op against the equivalence case, since libc++ short-circuits before consulting options, and it truncates an unknown object otherwise. Making the staged temp file executable before the copy would publish a partially copied executable, inverting the deliberate publish-executable-last ordering of the final chmod. Behaviour is unchanged everywhere: the edit lives inside the existing failure branch or in an OS_DARWIN-only helper, and the compiled Linux .text is byte-identical to before. Validated by an oracle harness that compiles this code verbatim over three destination shapes whose reports must differ (they collapse to the same bare message without the change), a -DOS_DARWIN type-check with an injected-error control, and a standalone self-extracting round trip that behaves identically before and after. Co-Authored-By: Claude Fable 5 <[email protected]>
Internal second-model review (independent cold review + second-model gate, 0 blockers)Before publishing I reviewed this diff cold, without reading the authoring
Second-model gate (independent engine, full scope): 0 findings. Its coverage Two things I checked specifically because they would have made the change wrong
I also confirmed the root cause from the job log rather than from the authoring No test can redden on revert here, by construction: the path is macOS-only and |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20260818-015500 |
|
Workflow [PR], commit [51208e7] AI ReviewSummaryThis PR adds Darwin-only diagnostics around the self-extracting Missing context / blind spots
Final Verdict✅ No inline findings on the current diff. The code change itself looks safe; the remaining question is whether the PR is still needed operationally. |
|
cc @thevar1able @azat, could you review this? On the arm_darwin runner the self-extracting wrapper deletes itself: |
|
Flagging this before it costs anyone a review: I think the defect this PR diagnoses has been The user-facing report is already closed. Issue #75921 describes this exact symptom, that The CI signal is gone as well. SELECT toDate(check_start_time) AS d,
countIf(check_name = 'Build (arm_darwin)') AS build_rows,
countIf(check_name = 'Fast test (arm_darwin)') AS fast_test_rows
FROM default.checks WHERE check_start_time > now() - INTERVAL 10 DAY GROUP BY d ORDER BY d DESCConsistent with that, the three completed PR workflow runs from today that I sampled (170 jobs each) So the failure branch this PR instruments is currently unreachable in CI, and the report it adds One code fact worth recording either way, since it was not in the original description. The |
|
@groeneai so let's close this if it is not necessary anymore? |
|
Yes, please go ahead and close it. I re-measured before answering. One pointer worth keeping if the macOS fast test comes back, from my comment above: the decompressor's whole concurrency protection (the |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Fast test (arm_darwin)fails a few times a day on unrelated PRs withPermission deniedonci/tmp/clickhouse:job 95461613722
(report),
also jobs
95537845886,95306463154,95222719292, across three unrelated PRs.The binary is the self-extracting bundle and it destroys itself. In
decompressor.cppunlink(self)succeeds, the Darwin-onlystd::filesystem::copy_file(tmp -> self)then failsEEXIST, and the errorreturn happens before the
chmodrestoring the executable bit, so the processexits having removed its own binary. The progress dots appear exactly once in
the log, immediately followed by that
copy_file'sFile exists.Why the destination exists after a successful
unlinkis not established, and Icould not reproduce it: this is macOS-only and I have no macOS host. Two
mechanisms remain possible (path resolution through
_NSGetExecutablePath/realpath/APFS naming a different entry thanunlinkremoved, or a symlink-following equivalence match); an unlabelled
File existscannot tell them apart.
So instead of guessing at a fix, this reports the destination's identity and
keeps the failure closed:
lstatand symlink-followingstatfor destinationand source, the equivalence flag from the followed pair (what libc++ compares
before returning
EEXIST), and the original wrapper's dev/inode. It is confinedto that failure branch plus an
OS_DARWIN-only helper; one real occurrenceidentifies the mechanism.
Two candidate fixes were dropped on measurement:
copy_options::overwrite_existingis a no-op against the equivalence case and truncates an unknown object
otherwise; staging the temp file executable would publish a partial executable.
Validated by an oracle harness compiling this code verbatim over three
destination shapes that must differ (they collapse without the change), a
-DOS_DARWINtype-check with an injected-error control, byte-identical Linux.text, and a standalone self-extracting round trip unchanged before and after.A green
Fast test (arm_darwin)here is not evidence the diagnostic works, sinceit only fires on failure: this makes the next occurrence diagnosable, not rarer.
Workflow [PR]
Sync PR [sync-upstream/pr/115236]