Skip to content

Detect MemorySanitizer and UndefinedBehaviorSanitizer reports in integration tests - #132826

Merged
fm4v merged 1 commit into
masterfrom
integration-detect-msan-ubsan
Nov 19, 2026
Merged

fm4v merged 1 commit into
masterfrom
integration-detect-msan-ubsan

Conversation

@fm4v

@fm4v fm4v commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

ClickHouseCluster.shutdown detected sanitizer reports in the server stderr.log (and in docker.log and the Keeper logs) 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 amd_msan and amd_asan_ubsan integration 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: ), as ci/jobs/scripts/log_parser.py does for functional tests. The sanitizer name alone is not matched, because AddressSanitizer may print AddressSanitizer: failed to intercept ... at startup. docker.log does not match runtime error, since Go services such as MinIO print panic: runtime error:. I checked the patterns against the real output of all four sanitizers (clang 21) and a clean log.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

Version info

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

…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).
@clickhouse-gh

clickhouse-gh Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [acadb40]

Summary: ❌

job_name test_name status info comment
Integration tests (arm_binary, distributed plan, targeted) FAIL
test_grpc_protocol/test.py::test_ipv6_select_one FAIL cidb IGNORED

AI Review

Summary

Extends sanitizer detection in ClickHouseCluster.shutdown to recognize MSan and UBSan reports in server and Keeper stderr and sanitizer report markers in Docker logs. No actionable findings at commit acadb40d25e16fa69ef18583c8ad235c9d08e005. Focused local verification passed 126 assertions using the actual shutdown and log-reading methods, with external services mocked; a live cluster was not run.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Nov 18, 2026
@fm4v
fm4v enabled auto-merge November 18, 2026 23:37
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Nov 19, 2026
@fm4v
fm4v added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 0a1face Nov 19, 2026
194 of 196 checks passed
@fm4v
fm4v deleted the integration-detect-msan-ubsan branch November 19, 2026 12:14
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 19, 2026
@azat

azat commented Nov 20, 2026

Copy link
Copy Markdown
Member

@fm4v This broke private CI (the checks were failing in this PR). Please be careful.

@azat

azat commented Nov 20, 2026

Copy link
Copy Markdown
Member

Can be resubmitted once this two will be merged:

And let's resubmit with ci-force-all label

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-testing Test content only (no production code). 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.

3 participants