Repository navigation
Disable the sampling query profiler under Memory Sanitizer - #113107
Conversation
Every `MemorySanitizer` report produced in CI since 2026-05-28 is truncated
to a single line:
==117==WARNING: MemorySanitizer: use-of-uninitialized-value
MemorySanitizer: nested bug in the same thread, aborting.
There is no stack trace, no `SUMMARY` and no origin, so the underlying bug
cannot be located. In the CI database, `msan` checks recorded 1009 reports
with a usable stack in 2026-04 and 0 in 2026-07; `asan`, `tsan` and `ubsan`
reports are unaffected and still carry full stacks.
The regression window matches #100242 (merged 2026-05-28), which enabled the
sampling query profiler for sanitizer builds. Printing an MSan report takes
the sanitizer runtime seconds, because it symbolizes every frame through an
`llvm-symbolizer` subprocess, and it holds `ScopedErrorReportLock` for the
whole time. A profiler signal delivered to that thread meanwhile runs
instrumented code in the handler and trips a second MSan check; compiler-rt
treats a same-thread re-entry into the report lock as unrecoverable, writes
`nested bug in the same thread, aborting.` with `CatastrophicErrorWrite` and
calls `internal__exit`, so the report that was already being written to
`MSAN_OPTIONS=log_path` stops after its header line.
Reproduced with the `arm_msan` binary from master `3885f7b7bbf1`, running the
same query against the same server three times and forcing a sanitizer report
with `max_allocation_size_mb=32 allocator_may_return_null=0`:
- profiler on (default `global_profiler_real_time_period_ns`): `nested bug in
the same thread, aborting.`, 1-line report;
- `<trace_log remove="1"/>` (no profiler at all): full 31-line report;
- `trace_log` on but `global_profiler_*_period_ns = 0` and the per-query
profiler off: full 31-line report.
So it is the profiler timer signals, not the trace collector.
Turn `QUERY_PROFILER_SUPPORTED` off under MSan, next to the existing
TSan-on-macOS exclusion. The trace collector stays enabled: the memory
profiler, `trace_profile_events` and `SYSTEM INSTRUMENT` all feed it from
ordinary code rather than from a signal handler, and other sanitizers keep the
profiler because their checks fire only on genuinely invalid accesses, which
the handler does not perform.
`00974_query_profiler` and `01569_query_profiler_big_query_id` assert that
samples reach `system.trace_log`, so they get `no-msan` back.
This does not fix the uninitialized read that the `BuzzHouse (amd_msan)` run
below hit - that one is unidentifiable as reported. It makes the next
occurrence diagnosable.
CI report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=3885f7b7bbf1b8791021e1c97ca2e4eea132de04&name_0=MasterCI&name_1=BuzzHouse%20%28amd_msan%29
Related: #100242
Related: #106591
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Workflow [PR], commit [e279910] Summary: ✅
AI ReviewSummaryThis PR disables the sampling query profiler under Tests
Final VerdictLLVM Coverage ReportMeasured on commit e279910.
Changed lines: Changed C/C++ lines covered: 87/88 (98.86%) · Uncovered code |
With `QUERY_PROFILER_SUPPORTED` compiled out under Memory Sanitizer, tests that rely on profiler signals to exercise their regression pass vacuously on MSan instead of testing anything: - `02466_distributed_query_profiler` needs the signals to hit the `EINTR` path in `MultiplexedConnections::getReplicaForReading()`. - `04507_mysql_connect_timeout_under_profiler` needs them to interrupt `poll` so `MYSQL_OPT_CONNECT_TIMEOUT` deadline handling is exercised. - `01091_query_profiler_does_not_hang` guards against a hang under a profiler signal storm, which is never produced without the profiler. Tag them `no-msan` so the MSan matrix reports them as skipped rather than as green tests that no longer cover their bug. Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=8f0f86485d192241fd2ed5bc0f5cb0b7630d244c&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29 and provide a fix in a separate PR. If the fix is already in progress, link it here.
|
|
Acknowledged - investigating why |
|
Fixing PR: #113365 The sleep time is not lost and not misattributed to a pool thread. In that failure The 4th assertion is a coupled oracle instead. The bytes counter is incremented unconditionally The fixture had no margin left. No source change: the throttler behaved correctly at every arrival rate I measured. |
…bandwidth The headroom fix lowered both byte checks from `> 8e6` to `> 1.5e6` along with the payload, but 2e5 `UInt64` rows are 1.6e6 raw bytes, so `> 1.5e6` left 100600 measured bytes of slack. That is a real loss of contract: the two byte columns exist to prove the whole scan went through the local-read throttler, and a regression letting about 100 KB bypass it would still have printed `1 1 1 1`. Measured on the fixture (all three read methods, warm and cold mark cache): `ReadBufferFromFileDescriptorReadBytes` and `QueryLocalReadThrottlerBytes` are both 1600600 warm and 1600777 cold, deterministic over 9 runs. `CODEC(NONE)` makes the compressed file the raw payload plus a 25-byte header per compressed block, so the counter is always strictly above 1.6e6. Raising both checks back to `> 1.6e6` restores the same relative margin the pre-fix fixture had against `> 8e6` (0.0375% versus 0.0381%). Verified the tightened threshold is not vacuous by shrinking the payload: at 187500 rows (the 100 KB bypass the reviewer described) the counter is 1500746, which passes `> 1.5e6` and fails `> 1.6e6`; even 199900 rows, 800 bytes short, is caught. The sleep oracle this PR fixes is unaffected: the test passes three times with no injection and twice under a rate injection at 1.05x of its own cap, which is the arm that reproduces a loaded runner. CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=8f0f86485d192241fd2ed5bc0f5cb0b7630d244c&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29 Related: ClickHouse#113107
…profiler # Conflicts: # src/Common/QueryProfiler.h
…iler The flaky check on amd_asan_ubsan failed 4 of 144 runs of this test: the first sub-test samples `sleep(0.5)` with a 100ms real-time profiler period, which gives only ~5 signals, and under a loaded sanitizer server all of them can be lost, leaving 0 rows in `system.trace_log`. Use a 10ms period (~50 chances), matching the hardening already applied to the `numbers_mt` sub-test. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=fa49e4387e79325101ddf6f0c937fa99a3130e8b&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20flaky%20check%29 PR: #113107
|
🕵 Status update:
|
Corrected narrative for the fix in a2a3a41, which restores the throttler rate headroom in `02703_max_local_read_bandwidth`, plus the reference to the pull request that surfaced the flake appended to the test's leading comment. The executable content of the test is byte-identical to a2a3a41. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=8f0f86485d192241fd2ed5bc0f5cb0b7630d244c&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29 Related: ClickHouse#113107 The test intermittently failed on `pread_threadpool` with only its 4th column wrong (`1 1 1 0`): the query was demonstrably slow and all bytes had passed the throttler, but `QueryLocalReadThrottlerSleepMicroseconds` came out 0. The 4th assertion is a coupled oracle. `Throttler::throttle` increments the bytes counter unconditionally (`Throttler.cpp:63-64`), but the sleep counter only inside `if (block)` (`:78-82`), and `block` requires `tokens_value < 0` (`:70`). The token bucket (`:110-125`) only goes negative while bytes arrive faster than the cap, so once a loaded runner's read rate falls to about the cap the throttler correctly does not sleep and the assertion fails. The fixture had no margin to lose. `M` is the decimal suffix in `readTextWithSizeSuffix` (the binary form needs a trailing `i`, as `01039_test_setting_parse` pins), so the old cap was 1 MB/s = 1e6 B/s and the 8 MB payload owed exactly (8e6 - 1e6) / 1e6 = 7.0 s. That is exactly what the `query_duration_ms >= 7e3` column also demands, so column 1 was passing on unrelated overhead, and column 4 had only 2.0x over its 3.5 s threshold. The pre-existing comment `(8-1)/1=7 seconds` was right; the fixture's problem was the absent margin, not the arithmetic. The sleep time is not lost or misattributed to a pool thread. In the reported failure `QueryLocalReadThrottlerBytes` exceeded 8e6 while its sibling sleep counter was 0, and both are charged through the same `CurrentThread::getProfileEvents` a few lines apart in `Throttler::throttle`, so a thread detached from the query would have lost both; the bytes recorded, therefore the thread was attached and the sleep branch simply never ran. Structurally there is also no pool thread to lose it on: for `pread_threadpool` the throttle call runs on the consuming pipeline thread in `AsynchronousReadBufferFromFileDescriptor::nextImpl`, and `ThreadPoolReader` never throttles. The change co-reduces the payload (1e6 -> 2e5 rows) and the cap (1e6 -> 160000 B/s), which raises the owed sleep from 7.0 s to 9.0 s at comparable wall clock: 1.29x over the duration floor, 2.57x over the sleep threshold, and the read rate must degrade 6.25x further before the token bucket stops going negative. The two byte thresholds drop 8e6 -> 1.5e6, which still requires 93.75% of the nominal payload to pass through the throttler. All four assertions, both time thresholds and the reference file are unchanged. This is the same fix that was merged for the sibling `04103_user_network_bandwidth_throttler` in ClickHouse#106680 (issue ClickHouse#103422). Reproduced deterministically by capping the arrival rate with `max_execution_speed_bytes` and `max_threads=1`: the unmodified test prints `1 1 1 0` on all three read methods, and `1 1 1 1` with the injection absent. The modified test stays green under the same injection, and also at arrival rates below its own cap. 50/50 clean local runs; runtime 23.9 s -> 28.3 s. No source change: the throttler behaved correctly at every arrival rate measured, so there is no product defect here. Co-Authored-By: Claude Fable 5 <[email protected]>
The flaky check (amd_asan_ubsan) still failed 3/144 runs after shortening the profiler period to 10 ms, so the loss is not per-signal chance. Profiler samples are sent to the trace pipe with WriteBufferFromFileDescriptorDiscardOnFailure over a non-blocking pipe: when a concurrent sample-heavy query (e.g. the numbers_mt sub-tests of another instance of this test in the flaky check) keeps the pipe full, samples are silently dropped. The single sleeping thread produces only ~50 samples, so all of them can be lost at once, while the sample-heavy numbers_mt sub-tests passed in the same failing runs. Sleep in 16 threads (one single-row block per thread via numbers_mt(16) with max_block_size = 1) instead of one: an order of magnitude more samples, and the sub-test also survives a single thread failing to create its profiler timer. The reference output is unchanged. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=d0770a05d6c86a28d969b630d928dc4899eb8a35&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20flaky%20check%29 PR: #113107 Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 Status update:
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units10 translation units recompiled, 54 s compile time in total, 10 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.06 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
The flaky check (amd_asan_ubsan) failed 3 runs of `00974_query_profiler` even after shortening the profiler period to 10 ms: the `sleep(0.5)` sub-test got 0 `FunctionSleep` samples with `trace_type = 'Real'`. Profiler samples are sent to the trace pipe with `WriteBufferFromFileDescriptorDiscardOnFailure` over a non-blocking pipe: when a concurrent sample-heavy query (e.g. another instance of this test in the flaky check, or the suite-wide memory sample profiler this PR enables) keeps the pipe full, samples are silently dropped, and the single sleeping thread produces so few of them that all can be lost at once, while the sample-heavy `numbers_mt` sub-tests passed in the same failing runs. Sleep in 16 threads (one single-row block per thread via `numbers_mt(16)` with `max_block_size = 1`) instead of one: an order of magnitude more samples, and the sub-test also survives a single thread failing to create its profiler timer. The reference output is unchanged. Same fix as in ClickHouse#113107 (verified there locally 10/10 and 8/8 under a synthetic trace-pipe flood). CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=88405&sha=f5c9438a6df42a63494bba778b56fbe1a3191f10&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20flaky%20check%29 PR: ClickHouse#88405 Co-Authored-By: Claude Fable 5 <[email protected]>
…974_query_profiler The sleep sub-test kept failing in the flaky check even after running the sleep in 16 threads: profiler samples travel over a lossy channel by design. The signal handler drops samples beyond 100 concurrent invocations (`QueryProfilerConcurrencyOverruns`) and on timer overruns (`QueryProfilerSignalOverruns`), and `TraceSender` writes to the trace pipe with `WriteBufferFromFileDescriptorDiscardOnFailure`, which silently discards samples when concurrent sample-heavy queries keep the pipe full. Under the flaky check load, all samples of a short mostly-idle query can legitimately be lost, so no amount of extra sleeping threads makes the `system.trace_log` assertion reliable. Assert on the query's ProfileEvents from `system.query_log` instead: every delivered profiler signal increments exactly one of `QueryProfilerRuns`, `QueryProfilerSignalOverruns` or `QueryProfilerConcurrencyOverruns` in the signal handler itself, so their sum proves the real time profiler fires for an off-CPU (sleeping) query regardless of trace delivery. End-to-end delivery to `system.trace_log` and symbolization remain covered by the CPU-bound sub-tests. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=19ca09a8b440370782fc8ed177db305cecbd6b6c&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20flaky%20check%29 PR: #113107 Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 Status update:
|
…de profiler The stateless test harness enables a serverwide profiler with a 1 second period (serverwide_trace_collector.xml), and the `QueryProfilerRuns` / `QueryProfilerSignalOverruns` / `QueryProfilerConcurrencyOverruns` counters are shared between it and the per-query profiler, so the previous `> 0` assertion could pass even if the per-query profiler never started. Require `> 64` instead: the serverwide profiler contributes at most ~1 real time tick per thread over the 0.5 second query (measured 7-10 locally with the per-query profiler disabled), while the 10ms per-query profiler delivers ~800 signals across the 16 sleeping threads. Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 Status update:
|
…iler
The merge queue run of this pull request was rejected by
`Stateless tests (amd_binary, flaky check)`: 2 of 54 runs of
`00974_query_profiler` failed with
Code: 159. DB::Exception: Timeout exceeded (180 s) while flushing
system log 'DB::SystemLogQueue<DB::TraceLogElement>'.
The test left the sampling profiler enabled for its own `SYSTEM FLUSH LOGS`
and `system.trace_log` verification queries. That is a runaway loop:
`symbolize` defaults to true and `TraceLogElement::appendToBlock` resolves
every frame of every sample through DWARF inside the flush, which costs about
1 ms per row in CI, so every sample those queries take of themselves is
another row the next flush has to symbolize, which makes the flush slower,
which lets the flush query collect even more samples of itself.
`tests/config/config.d/trace_log_no_symbolize.xml` already describes this
failure mode, but it is installed only for sanitizer builds, and the flaky
check that rejected the merge ran on `amd_binary`.
In the report below the two verification queries and the two
`SYSTEM FLUSH LOGS` queries were the four heaviest sampled queries of the
whole job: one verification query ran for 81 seconds and collected 243778
samples of itself, one `SYSTEM FLUSH LOGS` collected 96283, and together they
accounted for 561732 of the 691265 query-attributed samples (81%), while the
queries actually under test contributed about 27000 each. Over the job the
flush thread had to symbolize 1163416 rows at about 1.2 ms each - more
wall-clock time than the job lasted - so the backlog only ever grew, and a
single flush reached 369503 entries.
Switch the profiler off right after each query under test, next to the
existing `SET log_queries = 0`, so the flush and verification queries run
unprofiled. The reset before the CPU time sub-test becomes redundant and is
removed. Nothing about what the test asserts changes.
Verified against a local non-sanitizer server (`symbolize` on, serverwide
profiler at 1 second, `system.trace_log` pre-grown to 520960 rows) with the
`sleep_in_logs_flush` failpoint enabled to make the flush as slow as it is in
CI: samples collected by the flush and verification queries drop from 33341
to 149 (224x), samples of the queries under test are unchanged (1663 vs
1639), and the output still matches the reference in both cases.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=gh-readonly-queue/master/pr-113107-6cde32de1a2463c37780b7c5f9f2cc1417b2809c&sha=73f6bf32f8c91a845e16e7c4997791911be07d3a&name_0=MergeQueueCI&name_1=Stateless%20tests%20%28amd_binary%2C%20flaky%20check%29
Pull request: #113107
Co-Authored-By: Claude Fable 5 <[email protected]>
…on MSan The flaky check runs dozens of concurrent copies of 00974_query_profiler against one server, so everything the test asserts on goes over a single shared lossy channel (the trace pipe, one SystemLogQueue, one flush thread with a 180 second waitFlush deadline). Under that saturation either all samples of a sub-test are legitimately dropped (the trace_log oracles read 0 - Stateless tests (amd_asan_ubsan, flaky check)) or the final SYSTEM FLUSH LOGS times out (Timeout exceeded (180 s) while flushing system log 'DB::SystemLogQueue<DB::TraceLogElement>' - Stateless tests (amd_binary, flaky check)), even after the sample budget was cut to ~600 rows per run. Tag it no-flaky-check, like 04411_memory_profiler_sample_probability_sql_settings. Also address the AI review: drop the no-msan tags from 02497_trace_events_stress_long and 03532_crash_in_aggregation_because_of_lost_exception. Under Memory Sanitizer the query_profiler_* settings are silently ignored (ThreadStatus::initQueryProfiler is compiled out), while trace_profile_events and the memory profiler stay fully supported, so both tests keep their coverage there. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=1b3ecc6ce3f361b240c6592541820f74c5b223c1&name_0=PR PR: #113107 Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 Pushed CI on
|
…san` Both set `query_profiler_real_time_period_ns` / `query_profiler_cpu_time_period_ns` to a non-zero value, which this branch now rejects with `NOT_IMPLEMENTED` under MemorySanitizer. `02497_trace_events_stress_long` failed outright: the setting is passed in the `SETTINGS` clause of the query it runs in a loop, so every iteration errors out. It is the only remaining red test on the pull request, in `Stateless tests (amd_msan, WasmEdge, sequential, 1/2)` and in `Stateless tests (amd_msan, flaky check)` (5/5 reruns). https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=74837efd9fe147cc4d6bde050091ca9bc0fb01b6&name_0=PR&name_1=Stateless%20tests%20%28amd_msan%2C%20WasmEdge%2C%20sequential%2C%201%2F2%29 `03532_crash_in_aggregation_because_of_lost_exception` did not fail, because it sends its queries with `curl` and discards both streams, but it silently stopped exercising anything: all 20 requests now fail on the rejected setting instead of reproducing the lost exception. It is better skipped than vacuously green. Co-Authored-By: Claude Fable 5 <[email protected]>
The test failed in `Stateless tests (amd_binary, flaky check)` with `Timeout exceeded (180 s) while flushing system log 'DB::SystemLogQueue<DB::TraceLogElement>'` (`TIMEOUT_EXCEEDED`) printed by the client that runs `SYSTEM FLUSH LOGS trace_log` in a loop. The test deliberately floods `system.trace_log`: four threads run queries with a 10 ms real-time and CPU profiler period, `trace_profile_events`, and a memory profiler sample probability of 0.9, while a fifth thread forces a flush in a tight loop. The flaky check repeats it back to back a few dozen times on one server, so the flush thread - which symbolizes every row on a non-sanitizer build - falls behind and one flush exceeds the 180 s `waitFlush` deadline. Because the harness fails the test on any client stderr, that single message is enough. It only enters the flaky check at all because this branch adds a `no-msan` tag to it, and it is stable in ordinary runs where a single copy runs among diverse tests. Same treatment as `00974_query_profiler` in this branch and `04411_memory_profiler_sample_probability_sql_settings`.
Address the AI review verdict: both tests were tagged `no-msan` because this branch rejects a non-zero `query_profiler_real_time_period_ns` / `query_profiler_cpu_time_period_ns` with `NOT_IMPLEMENTED` under `MemorySanitizer`, so under MSan `02497` failed on every iteration and `02497`'s and `03532`'s requests stopped testing anything. But the sampler is not what either test is about, so instead of skipping them, only those two settings are now dropped in a MemorySanitizer build, detected through `system.build_options`. `02497_trace_events_stress_long` keeps stressing `trace_profile_events` and the memory profiler, which feed `TraceCollector` from ordinary code and remain supported under MSan. `03532_crash_in_aggregation_because_of_lost_exception` keeps its reproducer, which is driven by `memory_tracker_fault_probability` and `throwIf`; its `query_profiler_*` entries are incidental leftovers of a fuzzed settings list. Verified locally against a server built from this branch: with the settings present, both tests pass and match their reference; with the MemorySanitizer branch forced, `02497` runs 451 queries that all reach `QueryFinish`, and `03532`'s requests run with the memory tracker fault injected as intended, with no `NOT_IMPLEMENTED` and no syntax error from the removal.
|
🕵 Pushed CI on
@groeneai, could you take a look at that last one: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113107&sha=042214fb020b7f3cebd78bd022d2d6cccd341c2b&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 - a Docker-in-Docker freeze in |
|
No open issue exists for this. I searched open and closed issues for The fix is merged rather than in progress: #112984, 2026-08-29T13:24:30Z. The tree you link, First a correction I owe you. On #116591 I said sustained memory stall was the one thing separating these hangs from healthy nodes. That comparison was confounded by load, and I withdraw it. Your own previous commit here, What the artifacts do show is the inner dockerd ceasing to be scheduled. 12 containers get 690 lines follow the gap, so this is not a truncated upload. Those timers were due at 11:50:50, so the daemon overshot its own deadline by 121 minutes; that is dockerd's own account of the stall, so it needs no external control. Cheap discriminator for the next occurrence: compare the last timestamp in The outer inactivity bound I offered on #116591 is still waiting on your call. It would have cut these runs short rather than prevented them. If this class appears on a tree that already carries #112984, that is the recurrence you asked me to fix and I will take it. |
|
🕵 Pushed CI on
AI Review on @groeneai, the |
| # profiler, both of which feed `TraceCollector` from ordinary code - stays supported there, so drop | ||
| # only these two settings on that build instead of skipping the test. | ||
| QUERY_PROFILER_SETTINGS="query_profiler_real_time_period_ns = 10000000, query_profiler_cpu_time_period_ns = 10000000," | ||
| if [ "$($CLICKHOUSE_LOCAL -q "SELECT value LIKE '%-fsanitize=memory%' FROM system.build_options WHERE name = 'CXX_FLAGS'")" = "1" ]; then |
There was a problem hiding this comment.
This keeps the supported trace_profile_events / memory-profiler coverage on MemorySanitizer, but I still do not see a focused regression test for the new user-visible contract in SettingsImpl::set: a positive query_profiler_* period should now fail with NOT_IMPLEMENTED on MSan instead of being silently ignored.
As written, the updated MSan-covered stateless cases (02497, 03532) now route around that path by stripping the settings, and the profiler-specific tests are tagged no-msan. If the guard in src/Core/Settings.cpp regresses later, CI will likely stay green while the silent no-op surface comes back.
Please add the smallest build-conditional stateless check that sends a positive query_profiler_real_time_period_ns / query_profiler_cpu_time_period_ns (plain SET or per-query SETTINGS) and expects NOT_IMPLEMENTED on MSan.
| try: | ||
| cluster.start() | ||
|
|
||
| if node1.is_built_with_memory_sanitizer(): |
There was a problem hiding this comment.
This fixture now starts from global_profiler_* = 0 and skips on MemorySanitizer before proving the new ServerSettingsImpl::set contract: a positive global profiler period should fail with NOT_IMPLEMENTED on MSan instead of being accepted and silently doing nothing.
With tests/config/install.sh also dropping serverwide_trace_collector.xml on MSan, I do not see anything left that would fail if the guard in src/Core/ServerSettings.cpp regressed later. The integration suites would keep starting from zero and the old silent no-op surface would return unnoticed.
Please add the smallest focused check here (or an equivalent config-load test) that a non-zero global_profiler_real_time_period_ns / global_profiler_cpu_time_period_ns is rejected on MSan.
|
It does not close the guard on its own. Two runs whose tree carries #117412 still tripped it. Fix presence read from each job's own environment (
Both finished The budget cannot regulate itself on this carrier. The runner reports On #115785: it does not cover this, and it is still a draft last touched 2026-08-26. What it proposes, sizing workers from the enforced limit instead of host RAM, is already on master in a tighter form. No open issue tracks the guard by name, confirmed: I am investigating the residual on that shard and will follow up here with a separate pull request. |
|
Opened #117564. It is a container leak, not capacity. Proof it is those two modules and not the shard's general load: over one job's 1348 containers the lifetime median is 0.7 minutes and p90 is 4.6, with 18 outliers at 93.5-106.9 minutes, all stopped inside a 12-second window at session end and matching the two session-scoped compose projects container for container. 189 compose projects ran; exactly those 2 leaked. I am not claiming it closes the guard on its own. The shutdown |
|
📊 Cloud Performance Report ✅ AI verdict: This PR disables the sampling query profiler in MemorySanitizer builds (QUERY_PROFILER_SUPPORTED) and rejects non-zero profiler periods there, plus related settings-validation and test-config edits. None of that touches the query-execution path exercised by a regular benchmark build, so the flagged -34.7% improvement on tpch_adapted_1_official Q17 cannot plausibly be attributed to the diff. The query's own history is noisy and the base measurements were highly variable, consistent with run-to-run variance rather than a real PR effect, so this row is downgraded to not-sure. clickbench🟢 No significant changes tpch_adapted_1_officialFlagged queries (1 of 22)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. Debug info
|
The validation loop swaps in the master-HEAD binary for each remaining build type without reinstalling the config tree, which was installed for `build_types[0]`, always `*_asan_ubsan`. Since ClickHouse#113107 an msan server rejects a non-zero `global_profiler_real_time_period_ns` while parsing its own settings, so the tree's leftover `serverwide_trace_collector.xml` aborts startup with `Code: 48 NOT_IMPLEMENTED` on the `*_msan` swap. That turns both `Bugfix validation (functional tests, amd64|aarch64)` legs red, and because the loop breaks there, `*_msan` and `*_debug` can no longer supply a reproduction for a labelled bug-fix PR whose test does not reproduce on `*_asan_ubsan`. The `*_debug` swap has the mirror problem: `trace_log_no_symbolize.xml`, linked for the sanitizer binary, stays behind and silently leaves in-flush symbolization off, unlike the ordinary `Stateless tests (debug)` job. It was unreachable so far only because the loop breaks at `*_msan` first. Call `install_build_type_configs` after the swap, beside the existing `set_memory_ratio`/`reset_memory_ratio` re-derivation, which is there for the same reason: the config tree outlives the binary it was installed for.
Related: #100242
Related: #106591
Every
MemorySanitizerreport produced in CI since 2026-05-28 is truncated to a single line:No stack trace, no
SUMMARY, no origin — so no MSan failure can be located. In the CI database,msanchecks recorded 1009 reports with a usable stack in 2026-04 and 0 in 2026-07, whileasan,tsanandubsanreports are unaffected and still carry full stacks.The regression window matches #100242 (merged 2026-05-28), which enabled the sampling query profiler for sanitizer builds. Printing an MSan report takes the sanitizer runtime seconds, because it symbolizes every frame through an
llvm-symbolizersubprocess, and it holdsScopedErrorReportLockfor the whole time. A profiler signal delivered to that thread meanwhile runs instrumented code in the handler and trips a second MSan check; compiler-rt treats a same-thread re-entry into the report lock as unrecoverable, writesnested bug in the same thread, aborting.withCatastrophicErrorWriteand callsinternal__exit, so the report that was already being written toMSAN_OPTIONS=log_pathstops after its header line.Reproduced with the
arm_msanbinary built from master3885f7b7bbf1, running the same query against the same server three times and forcing a sanitizer report withmax_allocation_size_mb=32 allocator_may_return_null=0:global_profiler_real_time_period_ns)nested bug in the same thread, aborting., 1-line report<trace_log remove="1"/>(no profiler at all)trace_logon,global_profiler_*_period_ns = 0, per-query profiler offSo it is the profiler timer signals, not the trace collector.
This turns
QUERY_PROFILER_SUPPORTEDoff under MSan, next to the existing TSan-on-macOS exclusion. The trace collector stays enabled: the memory profiler,trace_profile_eventsandSYSTEM INSTRUMENTall feed it from ordinary code rather than from a signal handler. Other sanitizers keep the profiler, because their checks fire only on genuinely invalid accesses, which the handler does not perform.00974_query_profilerand01569_query_profiler_big_query_idassert that samples reachsystem.trace_log, so they getno-msanback. The other profiler andtrace_logtests either already carryno-msan, exercise the memory profiler /trace_profile_events/SYSTEM INSTRUMENT(unaffected), or make no assertion on sample counts.This does not fix the uninitialized read that the
BuzzHouse (amd_msan)run below hit — that one is unidentifiable as reported. It makes the next occurrence diagnosable.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=3885f7b7bbf1b8791021e1c97ca2e4eea132de04&name_0=MasterCI&name_1=BuzzHouse%20%28amd_msan%29
Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/113107]
Version info
26.9.1.811(included in26.9and later)