Repository navigation
Detect MemorySanitizer and UndefinedBehaviorSanitizer reports in integration tests - #132826
Merged
Merged
Conversation
…gration tests `ClickHouseCluster.shutdown` looked for sanitizer reports only by `SANITIZER_SIGN`, a line of `=`. AddressSanitizer and ThreadSanitizer print such a line, but MemorySanitizer (`==PID==WARNING: MemorySanitizer: ...`) and UndefinedBehaviorSanitizer (`file:line:column: runtime error: ...`, `SUMMARY: UndefinedBehaviorSanitizer: ...`) do not, and the server logs no `<Fatal>` when a sanitizer kills it. So a report on the MSan and ASan+UBSan lanes left the test green. Match the report lines as well, in `stderr.log` of the instances and Keeper, and in `docker.log` (without `runtime error`, which Go services also print).
Contributor
|
Workflow [PR], commit [acadb40] Summary: ❌
AI ReviewSummaryExtends sanitizer detection in Final VerdictStatus: ✅ Approve |
fm4v
enabled auto-merge
November 18, 2026 23:37
This was referenced Nov 19, 2026
Merged
Member
|
@fm4v This broke private CI (the checks were failing in this PR). Please be careful. |
Member
|
Can be resubmitted once this two will be merged:
And let's resubmit with |
nihalzp
pushed a commit
to nihalzp/ClickHouse
that referenced
this pull request
Nov 20, 2026
`SymbolIndex::instance()` kept the index in a function-local static. Static destructors run in reverse order of construction completion, and the index is built after `HandledSignals::instance()` (by the signal listener thread or by the first stack trace), so `~SymbolIndex` ran before `~HandledSignals`. When `~HandledSignals` logs an exception (`test_shutdown_static_destructor_failure` does this with the `lazy_pipe_fds_fail_close` failpoint), `tryLogCurrentException` formats the stack trace, `StackTrace::forEachFrame` calls `SymbolIndex::instance()`, and the guard returns the already destroyed object. MemorySanitizer reports the read of its destroyed `data.objects` (use-after-dtor, `poison_in_dtor=1`). Without MSan libc++'s `~vector` leaves `begin == end`, so nothing is read and no other sanitizer sees it. Leak the index instead, as `ErrorRegistry::get()` and `DateLUT::getInstance()` already do: every static destructor that symbolizes a stack trace during shutdown now reads a live index, whatever the construction order. This also covers `instanceIfInitialized()`, which could hand out a dangling pointer after `~SymbolIndex`. The report is old: it reproduces on the CI MSan binary of 4d1c0cd (glibc, before the background index build of ClickHouse#131638 and before the static musl build of ClickHouse#109239). It became visible on master only when ClickHouse#132826 taught the integration harness to detect MemorySanitizer reports; with this fix that detector can stay. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ClickHouseCluster.shutdowndetected sanitizer reports in the serverstderr.log(and indocker.logand the Keeper logs) only bySANITIZER_SIGN, a line of=. AddressSanitizer and ThreadSanitizer print such a line, but MemorySanitizer (==PID==WARNING: MemorySanitizer: ...) and UndefinedBehaviorSanitizer (file:line:column: runtime error: ...,SUMMARY: UndefinedBehaviorSanitizer: ...) do not, and the server logs no<Fatal>when a sanitizer kills it. So a report on theamd_msanandamd_asan_ubsanintegration lanes left the test green, unless it broke later queries.The check now also matches the report lines (
ERROR:/WARNING:/SUMMARY: ...Sanitizer:,Sanitizer: CHECK failed,: runtime error:), asci/jobs/scripts/log_parser.pydoes for functional tests. The sanitizer name alone is not matched, because AddressSanitizer may printAddressSanitizer: failed to intercept ...at startup.docker.logdoes not matchruntime error, since Go services such as MinIO printpanic: runtime error:. I checked the patterns against the real output of all four sanitizers (clang 21) and a clean log.Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/132826]
Version info
26.11.1.2837-master(included in26.11and later)