Repository navigation
Keep the crash-report channel of clickhouse-local reachable - #115102
Conversation
Internal second-model review (click to expand)Five review rounds, each with an independent cold code review plus a second-model gate whose ❌ Blockers fixed (r1-r4)
💡 Refuted with evidence, not prose
Every fix is mutation-tested: each reverted individually, rebuilt with the Build ID verified to Session id: cron:clickhouse-review-slot-10:20260817-082200 |
|
Workflow [PR], commit [d02424d] Summary: ✅
AI ReviewSummaryThis PR correctly fixes the Findings
Tests
Final Verdict
LLVM Coverage ReportMeasured on commit d02424d.
Changed lines: Changed C/C++ lines covered: 14/14 (100.00%) · Uncovered code |
Pre-PR validation gate (click to expand)
Coverage is mutation-tested, not asserted. Each mutation was built (build RC checked and Build ID verified to change) and run through the real runner; each reddens exactly one arm and leaves the others green: remove the additive fold -> Session id: cron:clickhouse-impl-slot-5:20260817-014600 |
|
cc @Algunenano @yakov-olkhovskiy, could you review this? |
CI finish ledger - b112165Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
The build predates the fix: #115087 merged at 10:03Z and is not an ancestor of the previous head, and The Session id: cron:our-pr-ci-monitor:20260817-103000 |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units24 translation units recompiled, 156 s compile time in total, 24 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.05 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
|
Pushed The deadlock. Measured on a TSan build: logger-mutex frames in captured hangs 18 -> 0, and 25/25 runs pass at 81-86 s. The second commit detaches the faulting query's log queue on the way out. Hoisting the
The tag is inert under Session id: cron:clickhouse-maint-slot-13:20260818-025100 |
Poco loggers are shared by name: createLogger and getLogger both resolve
through one name-keyed registry, so the object created as "ClientBase" for
the signal listener is the same object ClientBase::initAIProvider later
resolves with getLogger("ClientBase").
Rebinding that object to the crash-report channel at fatal severity after
buildLoggers therefore reconfigured an ordinary consumer as well, and its
LOG_DEBUG on an AI initialization failure was dropped instead of following
the configured sinks. logger.levels.ClientBase stopped taking effect for the
same reason, as did the listener's own non-fatal records.
Measured on three binaries, with the reachability of the consumer confirmed
first through a differently-named logger on the same code path: the record is
present without the restore, absent with it, and present again once the crash
logger has its own name. BaseDaemon and DisksApp already give their listeners
a dedicated logger.
Reported by clickhouse-gh[bot] on ClickHouse#115102.
CI finish ledger - 8ff55c0Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Notes on the one line above: #108855 "Fix wrong results for duplicate-ALIAS GROUP BY on a Distributed table under two-level Not caused by this PR. The diff is the crash-report channel of Session id: cron:our-pr-ci-monitor:20260818-123000 |
`Stateless tests (amd_debug, flaky check)` failed 2 of 5 runs of `04916_local_fatal_signal_report`, with `plain stderr report 0` and `clientlog_unwritable stderr signal 0`, and a third run passed only after a 300 s stall. Of the stateless jobs only the flaky check runs with the thread fuzzer (`enable_thread_fuzzer_config`), and `clickhouse-local` reads it from the environment too: every mutex lock and unlock migrates the thread and sometimes sleeps while the mutex is held, and `SIGPROF` sleeps at random points. An asynchronous `SIGABRT` can then land while the main thread holds a lock, which it keeps for as long as `signalHandler` waits for the report, up to 300 s. The report is written by the signal listener thread, which needs some of the same locks. Reproduced locally with the flaky check's variables, the gdb stacks of the stalled processes show three ways: - `pushExtendedMessageToInternalTCPTextLogQueue` constructs `DNSResolver` on its first use, and its logger lookup waits for the logger registry mutex, held by the main thread in `getLogger`; - the push waits for the query's logs queue mutex, held by the main thread inside a fuzzer sleep in `pthread_mutex_unlock`; - with a fuzzer `SIGPROF` pending on the main thread, the kernel delivers the `SIGABRT` to the listener thread itself, which then prints nothing. None of these depend on the channel wiring the test checks. Stopping the fuzzer in the aborted processes, as `03212_thousand_exceptions` does, removes them: with the flaky check's environment the plain arm stalled in 6 of 200 aborts before and in 0 of 400 after, and the whole test went from 1 failure and 2 stalls in 10 runs (150-448 s) to 20 passes in 20 runs (87-90 s). With the master binary the test still fails on the same 13 lines. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=115102&sha=26a16543cd87a8ffdf08ace8235ecd57311a0d72&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29 ClickHouse#115102 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
| #endif | ||
| } | ||
|
|
||
| void ClientApplicationBase::restoreFatalLogChannel(bool configured_channel_reports_to_stderr) |
There was a problem hiding this comment.
This is very odd, let's instead tell buildLoggers not to reconfigure ClientApplicationBase, and this should significantly simplify the patch, and please remove all unnesessarry code form it, and also squash everything into one commit, do not write too verbose descriptions/comments/commits.
There was a problem hiding this comment.
Done in d02424d, squashed into one commit on current master: buildLoggers now takes a list of loggers to keep, and clickhouse-local keeps the crash report logger, so restoreFatalLogChannel and the console helpers are gone. I also dropped the signal listener and text log queue changes, they only matter when the signal arrives while the faulting thread holds the logger registry lock or is inside the first DateLUT initialization, and the test now signals an idle process. The OwnSplitChannel fix is already in master (#123336).
One behaviour change: the report no longer goes to a configured --logger.log file, only to stderr and --client_logs_file. Keeping it there too would need a step after buildLoggers again, so I left it out; tell me if you want it.
…ckhouse-local` `buildLoggers` re-channels every existing logger, including the one the signal listener reports to, so when neither stdin nor stderr is a terminal a fatal signal printed nothing, and `--client_logs_file` was not written. CI example: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108078&sha=a84b136d9ac4980b5ff9457eba8f3dbd3b1d09de&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20parallel%29 PR: ClickHouse#108078 Co-Authored-By: Claude Opus 5.5 <[email protected]>
901a59e to
d02424d
Compare
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed missing crash reports of
clickhouse-localwhen neither stdin nor stderr is a terminal: a fatal signal printed nothing, and--client_logs_filewas not written.Description
On 26.8,
clickhouse-localwith neither stdin nor stderr on a terminal exits 134 on a fatal signal with empty stderr, and--client_logs_fileis not written.ClientApplicationBase::initbinds the signal listener's logger to a channel over stderr and--client_logs_file, thenbuildLoggersre-channels every existing logger to the configured channels, which have no console in that case.buildLoggersnow leaves the loggers it is told to keep, andclickhouse-localkeeps the listener's logger. It is renamed fromClientBase, so the otherClientBaselogging still follows the configuration. The report no longer goes to a--logger.logfile.In CI this made aborts undiagnosable, e.g. PR 108078.
Test
04916_local_fatal_signal_reportfails on master (no report, no client log file).Workflow [PR]
Sync PR [sync-upstream/pr/115102]
Version info
26.10.1.1548-master(included in26.10and later)