Repository navigation
Keep the stack when an async signal arrives during an MSan report - #112008
Conversation
Bump contrib/llvm-project to pick up a compiler-rt fix for MSan reports that
arrive with no stack at all:
==117==WARNING: MemorySanitizer: use-of-uninitialized-value
MemorySanitizer: nested bug in the same thread, aborting.
LLVM ERROR: IO failure on output stream: Broken pipe
Printing a report is slow, because it round-trips to the out-of-process
llvm-symbolizer. QueryProfiler arms a per-thread timer on every query thread, so
an async SIGUSR1/SIGUSR2 regularly lands in that window; if the handler touches
uninitialized memory, ScopedErrorReportLock sees same-thread reentrancy and
calls internal__exit without printing anything. The report that mattered is
gone, and CIDB buckets every such failure under the synthetic test name
"MemorySanitizer: use-of-uninitialized-value (STID: None)".
The runtime change blocks asynchronous signals for the duration of the report
funnel, keeping the synchronous signals deliverable so a real crash while
reporting still aborts.
This is an observability fix: it does not fix any of the uninitialized reads,
it makes them diagnosable. 11 of these landed in the last 30 days on x86_64
alone, none with a usable stack.
Internal second-model review (click to expand)An independent model reviewed this change cold against the ClickHouse review skill, and a
Checked and found correct, so noted rather than changed: the mask covers every UMR report |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20260727-021900 |
|
cc @thevar1able @rschu1ze - could you review this? It bumps |
|
Workflow [PR], commit [9140a42] Summary: ✅
AI ReviewSummaryThis PR advances Missing context / blind spots
Findings
Tests
Final Verdict
|
CI finish ledger — bc44d00Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Not PR-caused: this PR's diff is a single Session id: cron:our-pr-ci-monitor:20260727-120000 |
|
Fixing PR for The counters are incremented on whichever replica reads the granule, and remote ProfileEvents are not merged into the initiator's |
|
@copilot resolve the merge conflicts in this pull request |
|
Dear @thevar1able, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
…m-project#118 The only conflict was the contrib/llvm-project gitlink: this branch pinned the head of ClickHouse/llvm-project#118 (2e96bd5b722e), master moved its pin to daf4510ca312. ClickHouse#118 is now merged on ClickHouse/release-22.x as fa3910d62714, which contains both, so the gitlink is resolved to it. Relative to master's pin this brings in ClickHouse#118 (compiler-rt/lib/msan) and ClickHouse#140 (libc++ `_LIBCPP_DISALLOW_PRINTING_POINTERS`, a no-op unless the macro is defined). Co-Authored-By: Claude Opus 5.5 <[email protected]>
| @@ -1 +1 @@ | |||
| Subproject commit daf4510ca312fc47275c01813424b2e7362acf56 | |||
| Subproject commit fa3910d62714b59592f64dfd33e9e3d0dc5926e4 | |||
There was a problem hiding this comment.
[P2] Restore the original signal mask in the symbolizer child
The new ScopedBlockSignals also covers the lazy startup of the external symbolizer: ReportUMR calls stack->Print, which can reach SymbolizerProcess::StartSymbolizerSubprocess. At this pin, StartSubprocess uses internal_fork followed by internal_execve without restoring the child’s signal mask. Both operations preserve the mask, so llvm-symbolizer starts with SIGINT and SIGTERM blocked. Restoring the mask in the reporting thread does not restore it in that child.
Consequently, the temporary report protection becomes permanent in the symbolizer, preventing normal interruption/termination of slow or stuck symbolization and forcing timeout cleanup to escalate to SIGKILL. Please preserve the pre-report mask and restore it in the symbolizer child before executing it, while keeping the reporting thread protected. Add a focused startup regression that checks the child’s mask; the current in-report SIGUSR1 test does not exercise this boundary.
CI finish ledger - 43fe907Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261027-043011 |
|
@copilot resolve the merge conflicts in this pull request |
The only conflict was the contrib/llvm-project gitlink: master moved its pin to 140ad525c086, this branch pins fa3910d62714 (the merge of ClickHouse/llvm-project#118), whose first parent is 140ad525c086. The resolution keeps fa3910d62714, which contains both sides. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Resolved the conflict in 9140a42: |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
Move `contrib/llvm-project` to a cherry-pick of llvm/llvm-project#175849 directly on top of the previous pin `daf4510ca312`, so this change no longer pulls in the `ClickHouse/release-22.x` commits that master does not pin yet. Those stay with ClickHouse#112008. Related: ClickHouse#127601
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Bumped
contrib/llvm-projectso MemorySanitizer reports keep their stack trace when an asynchronous signal is delivered while the report is being printed. Affects MSan builds only.Description
When an asynchronous signal lands on a thread that is printing a MemorySanitizer report, and its handler trips a second MSan check, the runtime prints
MemorySanitizer: nested bug in the same thread, aborting.and exits. The report keeps only its header line: no stack, no origin, noSUMMARY. CIDB buckets these asMemorySanitizer: use-of-uninitialized-value (STID: None).ScopedErrorReportLockis held for the whole report, which takes seconds because each frame is symbolized through anllvm-symbolizersubprocess. ClickHouse/llvm-project#118 (merged) blocks asynchronous signals for the duration of the report inPrintWarningWithOrigin, so the handler runs after the report instead of inside it. Synchronous signals stay unblocked, so a crash while reporting still aborts.This PR points
contrib/llvm-projectatfa3910d6, the merge of ClickHouse/llvm-project#118 onClickHouse/release-22.x. Its first parent is master's pin140ad525, so the bump adds only #118 (msan.cppand its lit test).The main source of such signals was the sampling query profiler. #113107 compiled it out under MSan for this reason (
src/Common/QueryProfiler.h). Since then the bucket has one row, on 26.7, which does not have #113107: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=26.7&sha=44b97ab05c6aa7cfe2f72588d9f6dc8651508b9a&name_0=ReleaseBranchCI&name_1=Stress%20test%20%28amd_msan%29. With this runtime the re-entry described in that comment cannot happen.Validation: the in-tree
clang_rt_msanbuilt from this tree with clang-22, against #118's lit test (compiler-rt/test/msan/Linux/nested_report_async_signal.cpp, which raises the signal from inside the report). With this runtime 30/30 runs pass FileCheck with a full stack and no nested abort; with the unpatched clang-22 runtime 30/30 abort with no frames. ClickHouse CI does not run that lit suite; this PR's CI shows the runtime builds and MSan jobs run with it.Workflow [PR]
Sync PR [sync-upstream/pr/112008]
Version info
26.11.1.1379-master(included in26.11and later)