Repository navigation
Do not lose the watchdog's log line about how the server process ended - #132409
Conversation
…ous logger The watchdog closes the `OwnAsyncSplitChannel` before `fork` and reopened it in both processes. With `logger.async` (the default) its messages were therefore queued for a consumer thread that polls every 10 ms, and after the child ends it logs `Child process was terminated by signal N`, `exited normally with code N` or `no longer exists` and calls `_exit` on the next line, which drops the queued message. A server killed by the OOM killer or by any signal left no trace in its log, although keeping that trace is why the systemd unit enables the watchdog. Reopen the channel only in the child. A closed channel delivers synchronously, so every line of the watchdog reaches the log, including the last one. The watchdog logs a handful of lines in its whole life and needs no logging thread. In the restart loop the second `closeAndJoinThreads` is a no-op on the closed channel. Related: ClickHouse#100185 (comment) 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-11:20261117-154600 |
|
cc @azat, could you review this? The watchdog closed the async log channel before fork and reopened it in both processes, so its last line about how the child ended was queued and then dropped by the _exit right after it; the channel is now reopened only in the child, so the watchdog logs synchronously. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261117-151908 |
|
Workflow [PR], commit [2a4d4bb] Summary: ✅
AI ReviewSummaryThe watchdog keeps its logging channel synchronous after 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 units7 translation units recompiled, 9 s compile time in total, 7 of them have a recent master baseline. |
a052453
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The watchdog now writes
Child process was terminated by signal ...(orexited normally with code ...) to the server log before it exits. With the asynchronous logger, the default, this line was lost, so a server killed by the OOM killer or by a signal left no trace of it in the log.Description
Since 2026-11-15, six
Performance Comparison (arm_release, ...)jobs lost a server that died with nothing in its log, both the PR and the master reference server (1, 2, reported in #100185 (comment)). The one line that would name the signal is the watchdog's, and it is never written, although the systemd unit keeps the watchdog enabled for exactly this ("to be able to see OOM/SIGKILL traces in clickhouse-server.log files").The watchdog closes the
OwnAsyncSplitChannelbeforeforkand reopened it in both processes, so its messages went to a queue drained by a thread polling every 10 ms. After the child ends it logs how and calls_exiton the next line, which drops the queued message. This PR reopens the channel only in the child: a closed channel already delivers synchronously, so every watchdog line reaches the log.Validation: the new test passes 0 of 20 runs on master and 20 of 20 with the fix (50 of 50 in parallel); with
<async>false</async>both pass. A started server killed with SIGKILL, SIGSEGV or stopped with SIGTERM now gets the watchdog's line, also withCLICKHOUSE_WATCHDOG_RESTART.CI jobs that read this line (
stress_job.py, the AST fuzzer) now see it on asynchronous-logger runs too; #128778 stops the stress harness's own kill from being read as an OOM.The cause of these server deaths on aarch64 is still open: the next one will name its signal.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/132409]
Version info
26.11.1.2870-master(included in26.11and later)