Skip to content

Fix a hang on Darwin after SIGTSTP in isCFICheckTrap - #133270

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
Algunenano:darwin-05042-hang
Nov 20, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
Algunenano:darwin-05042-hang

Conversation

@Algunenano

@Algunenano Algunenano commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

isCFICheckTrap read the signal context before checking the signal. The signal listener thread gets the context as a pointer into the stack of the signaled thread, and for SIGTSTP the handler has already returned, so the pointer dangles. On macOS uc_mcontext is a pointer, so reading the program counter through it faulted in the listener thread. The listener then waited for itself to print the fatal error, so the process hung for about 5 minutes. On Linux the read was of stale but mapped memory and did not fault.

With the binary from the failing CI run, 16 of 16 parallel loops of the 05042_crash_handler_without_global_context steps hung; with this change, 640 of 640 iterations exited.

Closes: #133246
Caused by: #132527

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Version info

  • Merged into: 26.12.1.95-master (included in 26.12 and later)

@Algunenano
Algunenano enabled auto-merge November 20, 2026 17:18
@Algunenano Algunenano changed the title Do not read the signal context of SIGTSTP in isCFICheckTrap Fix a hang on Darwin after SIGTSTP in isCFICheckTrap Nov 20, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d33580f]

Summary: ✅


AI Review

Summary

PR #133270 fixes the Darwin hang by checking the signal before isCFICheckTrap reads its context, avoiding the expired context of SIGTSTP. No actionable findings at head d33580fe9a5126696c2441c333a9dedbab7ffc95. The existing 05042_crash_handler_without_global_context regression test passes in Fast test; the author reports 640 successful iterations with the fix versus 16/16 hanging loops before it.

Missing context / blind spots
  • ⚠️ Darwin execution was not independently reproduced locally: this checkout has no configured build, and the retrieved Darwin CI report contains no individual test results. Validation on the affected platform relies on the author's reported reproduction and repeated successful runs.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Nov 20, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing d33580fe9 with master 7acf3f872 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

7 translation units recompiled, 6 s compile time in total, 7 of them have a recent master baseline.

Job report

@clickhouse-gh clickhouse-gh Bot added the comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). label Nov 20, 2026
@Algunenano
Algunenano added this pull request to the merge queue Nov 20, 2026
Merged via the queue into ClickHouse:master with commit 62d1c26 Nov 20, 2026
199 checks passed
@Algunenano
Algunenano deleted the darwin-05042-hang branch November 20, 2026 19:43
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). pr-not-for-changelog This PR should not be mentioned in the changelog 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.

Darwin: Flaky test: 05042_crash_handler_without_global_context

2 participants