Repository navigation
Do not dereference a null logs_queue in OwnSplitChannel::log - #123336
Algunenano merged 2 commits into
Conversation
The early return of the synchronous split channel read `channels.empty() && (logs_queue == nullptr && !logs_queue->isNeeded(...))`, so it called `InternalTextLogsQueue::isNeeded` exactly when the thread had no queue. The guard was `||` until the async-logging rewrite turned it into `&&`. Return early only when no sink would take the message: no channel, no `text_log`, and no client queue that wants it. This mirrors `OwnAsyncSplitChannel::log`, which also keeps a no-channel record for `text_log`. The extra atomic load runs only when there are no channels. Reachable with `logger.async = 0`, no log destination and a raised `logger.levels` entry, e.g. `clickhouse local --query "SELECT 1" -- --logger.async=0 --logger.levels.Application=trace` (SIGSEGV in a debug build before this change). Closes ClickHouse#123306 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test now also covers a logger with no destination delivering client logs requested with `send_logs_level`. 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; 2 rounds, 2 findings) plus my own review (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261001-201800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20261001-185500 |
|
Workflow [PR], commit [11a47dd] Summary: ✅
AI ReviewSummaryThis PR fixes the synchronous logger's early-return guard in Final Verdict
LLVM Coverage ReportMeasured on commit 11a47dd.
Changed lines: Changed C/C++ lines covered: 6/6 (100.00%) · Uncovered code |
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, 7 s compile time in total, 7 of them have a recent master baseline. |
Backport #123336 to 26.7: Do not dereference a null `logs_queue` in `OwnSplitChannel::log`
Backport #123336 to 26.9: Do not dereference a null `logs_queue` in `OwnSplitChannel::log`
Backport #123336 to 26.3: Do not dereference a null `logs_queue` in `OwnSplitChannel::log`
Backport #123336 to 26.8: Do not dereference a null `logs_queue` in `OwnSplitChannel::log`
…ueue` in `OwnSplitChannel::log`
…ueue` in `OwnSplitChannel::log`
…ueue` in `OwnSplitChannel::log`
…ueue` in `OwnSplitChannel::log`
Closes: #123306
Related: #115102
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
The synchronous logger (
logger.async = 0) returned early inOwnSplitChannel::logunderchannels.empty() && (logs_queue == nullptr && !logs_queue->isNeeded(...)), so it calledisNeededon a nulllogs_queue. The inner&&was||until the async-logging rewrite.The early return now means that no sink takes the message: no channel, no
text_log, and no client queue that wants it. This is the conditionOwnAsyncSplitChannel::logalready uses. Thetext_logterm is why this is not a plain&&to||: that would drop a no-channel record that reachessystem.text_logtoday. The extra load runs only when there are no channels.The branch is reached with no log destination and an explicitly raised logger level. On a master debug build this segfaults in
InternalTextLogsQueue::isNeeded(this=0x0), called fromOwnSplitChannel::log:The new test runs that command and also checks that client logs requested with
send_logs_levelstill arrive. It fails on the master debug build (its first command segfaults) and passes with the fix: 50/50 sequential, 50/50 parallel, and 50/50 parallel with the thread fuzzer on.The same hunk is part of #115102. It is split out here so it can land on its own.
Workflow [PR]
Sync PR [sync-upstream/pr/123336]
Version info
26.10.1.1272-master(included in26.10and later)26.9.9.20,26.8.16.24,26.7.20.14,26.3.39.10