Repository navigation
Fix flaky test_executable_udf_profile_events peak-memory tests under Thread Sanitizer - #108559
Conversation
…e_events under TSAN The four peak-memory tests (test_peak_memory_is_max_not_sum, test_peak_memory_reflects_udf_not_server, test_peak_memory_byte_seconds, test_reaped_child_memory_rolls_up) are flaky exclusively on Thread Sanitizer. PeakMemoryByteSeconds is sampled from /proc/<pid>/VmHWM across the UDF subtree on a best-effort ~5 ms throttle (UDFProcessSubtreeSampler). Under TSAN the scheduling skew and sanitizer memory bloat make that sampling non-deterministic over the test's one-row window, producing both directions of failure: an implied peak below the floor (children never sampled) and an inflated reading above the max-not-sum ratio. The metric is correct on every non-sanitizer build, where the assertions remain fully active and still catch a UDF that reports only the parent's memory. Skip only these assertions under Thread Sanitizer, matching the existing pattern in other memory/timing integration tests (test_fetch_memory_usage, test_hedged_requests). MSAN is already skipped. Requested by alexey-milovidov in PR ClickHouse#108192. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-4:20260625-221400 |
|
cc @vitlibar — could you review this? Test-only change: it skips the four |
|
Workflow [PR], commit [5c0ea15] Summary: ✅ AI ReviewSummaryThis PR adds Final VerdictStatus: ✅ Approve |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 733 line(s), 55 function(s) across 173 file(s) · Details Top files
|
…eak-memory-sampling-flaky Fix flaky test_executable_udf_profile_events peak-memory tests under Thread Sanitizer
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Requested by @alexey-milovidov in #108192 (comment): fix the flaky
test_executable_udf_profile_events.The recurring flakiness is confined to four
/proc-VmHWMpeak-memory tests, and only on Thread Sanitizer:test_peak_memory_is_max_not_sum,test_peak_memory_reflects_udf_not_server,test_peak_memory_byte_seconds,test_reaped_child_memory_rolls_up. Over 30 days they fail across many unrelated PRs, all onamd_tsan, in both directions:concurrent implied peak 10.1 MiB < 60 MiB floor(children never sampled) andconcurrent peak 933523455 ... > 1.6x sequential(inflated reading). Example report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108248&sha=ca87a98980ffe3ce7777c05d576fad48532eaccf&name_0=PR&name_1=Integration%20tests%20%28amd_tsan%2C%203%2F6%29 . The suite's other tests (invocations, bytes, elapsed, CPU) are stable.Root cause:
PeakMemoryByteSecondsis sampled from/proc/<pid>/VmHWMacross the UDF subtree on a best-effort ~5 ms throttle (UDFProcessSubtreeSampler). Under Thread Sanitizer the scheduling skew and sanitizer memory bloat make that sampling non-deterministic over the test's one-row window, so the tight implied-peak bounds are unreliable there. The metric is correct on every non-sanitizer build (verified locally: stable ~107 MiB; the assertions still pass and still catch a deliberately broken UDF that reports parent-only memory).Fix: skip only the
/proc-VmHWMpeak-memory assertions under Thread Sanitizer, matching the existing pattern in other memory/timing integration tests (test_fetch_memory_usage,test_hedged_requests). All assertions stay active on every non-sanitizer build, so the metric keeps full regression coverage.The TSAN-specific timing artifact is not reproducible without a TSAN integration build; the change targets the best-effort sampling fragility the sampler's own documentation already calls out.
Version info
26.7.1.163(included in26.7and later)