Repository navigation
Do not instrument the stack trace symbolizer in the LLVM coverage build - #125305
Conversation
`Common/{Elf,Dwarf,MachO,SymbolIndex,ThreadFuzzer}.cpp` are compiled without
coverage instrumentation because it slows down stack trace printing too much
(ClickHouse#44569, 70e3dd8). Since b88d0a2 ("Don't apply O2 on release
builds") the whole block is gated on `CMAKE_BUILD_TYPE=Debug`, so the exclusion
no longer applies to the CI `amd_llvm_coverage` build, which is
`CMAKE_BUILD_TYPE=None` (RelWithDebInfo) with `WITH_COVERAGE=ON`.
There `Dwarf::findDebugInfoOffset`, a linear scan of `.debug_aranges` (1.4 M
entries, ~20 M entries read per 32-frame stack trace), increments
process-global profile counters on every iteration. When several server
threads symbolize at once, the counter cache lines bounce between cores and a
single stack trace costs ~10 s instead of tens of ms. On master 4ddbbbd,
04907 failed this way in two coverage jobs and 05029 in one of them: the query
was cancelled within 100 ms, then spent ~20 s symbolizing the two stack traces
of its exception (every trace_log sample of the query is in
`findDebugInfoOffset`).
Keep `-O2` Debug-only, and for every other `WITH_COVERAGE` build append
`-fno-profile-instr-generate -fno-coverage-mapping` to these files through
`COMPILE_OPTIONS`, so that `ThreadFuzzer.cpp` keeps its
`-fomit-frame-pointer -momit-leaf-frame-pointer` `COMPILE_FLAGS`. Builds
without coverage, and Debug builds, get identical compile commands.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261012-025700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261012-000200 |
|
Workflow [PR], commit [b4de31c] Summary: ✅
AI ReviewSummaryPR #125305, reviewed at Final Verdict✅ Approve |
Build profile diff (arm_release)Commit See the job log for details. |
|
@groeneai pull master |
…entation-for-symbolizer Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 01cc0edEvery 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:20261013-033012 |
|
@groeneai please merge latest master |
…entation-for-symbolizer
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The stack trace symbolizer (
Common/Dwarf.cpp,Elf.cpp,SymbolIndex.cpp, ...) is no longer instrumented in the LLVM coverage build, so concurrent stack trace symbolization there takes milliseconds instead of tens of seconds.Description
04907_url_function_no_retry_after_canceland05029_url_function_schema_inference_hard_timeout_during_backofffail on theamd_llvm_coveragejobs: master 4ddbbbd (ParallelReplicas, AsyncInsert) and ae0dac4.The query is cancelled within 100 ms; the remaining ~20 s go to symbolizing the stack traces of its exception, with every CPU sample in
Dwarf::findDebugInfoOffset, a linear scan of.debug_aranges. In the coverage build that loop increments profile counters on every iteration, so when several threads symbolize at once the counter cache lines bounce between cores and one trace takes ~10 s instead of tens of ms.Common/{Elf,Dwarf,MachO,SymbolIndex,ThreadFuzzer}.cppare meant to be built without coverage (#44569), but b88d0a2 moved that block underCMAKE_BUILD_TYPE=Debug, and the CI coverage build is RelWithDebInfo. This PR keeps-O2Debug-only and appends-fno-profile-instr-generate -fno-coverage-mappingto these five files in every otherWITH_COVERAGEbuild; all other builds get identical compile commands. The five files drop out of the coverage reports and of the per-test coverage used for test selection, as in Debug coverage builds.Validation on a local build with the CI coverage flags: of 30 different failing queries started at once, the slowest takes 149 s before and 97 ms after. Under 16 concurrent
addressToLineloops, 04907 and 05029 fail 10/10 before with the CI messages and pass 10/10 after. PR CI does not run the coverage jobs. #121512 and #121874 worked around the same cost in other tests.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125305]
Version info
26.10.1.2389-master(included in26.10and later)