Repository navigation
Revert "Revert "Build the symbol index in the background at server startup"" - #131638
Conversation
|
Workflow [PR], commit [068c834] Summary: ✅
AI ReviewSummaryThis PR restores background construction of Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units42 translation units recompiled, 268 s compile time in total, 42 of them have a recent master baseline. |
…to the main thread Now that the daemon reads its build id without the symbol index, the first build of the index happens in `SignalListener::run`. When it throws (for example, `CANNOT_PARSE_ELF` on a non-ELF `clickhouse.debug` next to the executable), the exception left the listener thread and reached `KillingErrorHandler`, which hung the startup for 300 s and then aborted the server (or, with `ServerErrorHandler`, left it without signal processing). Catch the exception in the listener, log it, keep processing signals, and hand it to the main thread: `SignalListener::waitForTerminationRequest` wakes up and rethrows it, so the server shuts down and exits with the original error code, as it did when the index was built eagerly at initialization. Checked with a non-ELF `clickhouse.debug`: the server exits with code 208 (`CANNOT_PARSE_ELF`) after 1 s, with the error in the log. Related: #131548 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on ELF On non-ELF platforms such as macOS, `SymbolIndex::getSelfBuildIDHex` has no way to read the build id without the index and calls `SymbolIndex::instance`, so the assertion in `SymbolIndexDeathTest.BuildIDWithoutTheIndex` always failed there. The build id equality checks still run on every platform. Related: #131638 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Adding support for Darwin too, since it should be trivial |
`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]>
Reverts #131562
Workflow [PR]
Sync PR [sync-upstream/pr/131638]
Version info
26.11.1.2627-master(included in26.11and later)