Skip to content

Do not dereference the global context in the crash handler - #116245

Merged
Avogar merged 7 commits into
ClickHouse:masterfrom
groeneai:fix-crash-handler-null-global-context
Sep 15, 2026
Merged

Avogar merged 7 commits into
ClickHouse:masterfrom
groeneai:fix-crash-handler-null-global-context

Conversation

@groeneai

@groeneai groeneai commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #110105

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fixed a crash inside the crash handler itself when a fatal signal arrives during startup of clickhouse-server, clickhouse-keeper or clickhouse-local. The handler dereferenced the global context, which does not exist yet at that point, so right after logging the stack trace it took a second fault, hung for about five minutes, and never sent the configured crash report.

Description

The deadly signal handlers and the signal listener are installed before the global context is created (BaseDaemon.cpp:473/:492 before Server.cpp:1549 and Keeper.cpp:433, and the same order in clickhouse-local), so a fatal signal arriving in between reaches the crash handler with no global context.

Two places on that path used it unconditionally. SignalHandlers.cpp:750 called Context::handleCrash(), whose first action takes a lock on a non-static member, so a null this is a mutex operation on a wild address instead of the no-op that function's own !shared check gives. On a daemon the report path then reached ServerUUID::get() from CrashWriter.cpp:121, which asks the context for the application type.

The tree already guards this path at the point of use in ProxyConfigurationResolverProvider.cpp:152 and DateLUT.cpp:183; these two were the omissions. The first now tests the pointer the same way. The second uses a non-throwing accessor that reads the stored value and needs no context, which suits a report that already omits the UUID when unset, and also covers the span where the context exists but the UUID is not loaded. ServerUUID::get() is unchanged, keeping its initialization-order assertion for its 22 other callers.

Each window gets a test that parks a process in it using only documented options, and fails without its fix.

Reported for SignalHandlers.cpp:750 by Stateless tests (arm_asan_ubsan, targeted). What delivered the signal there is not established: that test ran in 1.47 s so the harness timeout path was not involved, and the job's logs show no crash. This rests on the ordering above, not on that run. The context pointer and the stored UUID are both read here without synchronization; both pre-date this change, which takes the UUID read from two to one, and neither is addressed.


Workflow [PR]
Sync PR [sync-upstream/pr/116245]

Version info

  • Merged into: 26.9.1.1537 (included in 26.9 and later)

groeneai and others added 6 commits August 24, 2026 09:57
…exists

SignalListener::onFault called Context::getGlobalContextInstance()->handleCrash()
without checking the result. The deadly signal handlers and the signal listener are
installed before the global context is created, so a fault or a SIGTSTP arriving in
that window reaches this call with a null pointer:

  clickhouse-server  BaseDaemon.cpp:473/:492  ->  Server.cpp:1549
  clickhouse-keeper  BaseDaemon.cpp:473/:492  ->  Keeper.cpp:433
  clickhouse-local   ClientApplicationBase.cpp:258-281 -> LocalServer.cpp:1363

Context::handleCrash() takes a lock on mutex_shared_context, a non-static member,
so the first action on a null this is a mutex operation on a wild address rather
than the intended no-op that the !shared check at Context.cpp:6736 provides. On a
sanitizer build UBSan reports the member call on the null pointer and aborts.

The added test parks clickhouse-local in that window by pointing --logger.log at a
FIFO nobody reads, then sends SIGTSTP, which the handler treats as non-crashing so
the manner of the exit is the oracle. Without the guard the process dies from a
signal and, on a sanitizer build, prints the null dereference; with it the handler
returns.

Reported for src/Common/SignalHandlers.cpp:750 by the arm_asan_ubsan targeted
stateless check.
…aded

The crash handler builds a crash report from a daemon, and the report includes the server
UUID, which it reads with ServerUUID::get(). That accessor asks the global context for the
application type, so it cannot be used from a caller that runs before the global context
exists:

  clickhouse-server  BaseDaemon.cpp:473/:492  ->  Server.cpp:1549
  clickhouse-keeper  BaseDaemon.cpp:473/:492  ->  Keeper.cpp:433

The signal listener is running across those spans, so a fault arriving there reaches the
report with a null global context, and the two dereferences inside the condition are member
calls on a null pointer. The dereferences are also reached with the UUID still unset but the
context already up, between Server.cpp:1549 and Server.cpp:1930, where get() throws
instead and sendError discards the report along with the exception.

The condition exists to assert initialization order for the callers that require a UUID, so
it stays as it is. The crash handler is not one of those callers: it already omits the field
when the value is Nil. Give it a non-throwing accessor that reads the stored value and needs
no context at all, so the report no longer depends on initialization order in either
direction. The remaining 22 callers of get() are unchanged.

The added test parks keeper before its global context exists by pointing the UUID path at a
FIFO nobody writes to, and answers the crash report from a local listener so the report is
built rather than abandoned while connecting.

Found by widening the startup window and faulting inside it, after the guard added for
src/Common/SignalHandlers.cpp:750 made this second site reachable.
The test could pass with the crash-report fix reverted on any build without a
sanitizer runtime: nothing read the process exit, the readiness probe never
asserted the endpoint came up, and the report check was satisfied by a log line
that precedes the connect, so all three oracles were reachable without the
report path ever completing.

The endpoint now publishes its kernel-assigned port by rename and records that a
request arrived, and the test fails if either does not happen, so the report
check means the report reached the endpoint rather than that one was about to be
attempted. Termination is now read as well, which is the part of the outcome
every build reports.

The keeper client port is omitted and the raft port is left to the kernel, since
the test never connects to the keeper and the previously derived ports covered
most of the ephemeral range. The test now skips instead of failing on a build
configured without the keeper mode.

The tryGet() comment claimed the UUID is loaded after the global context is
created. Keeper loads it before, so the comment is replaced with the property it
was there to state.
…line

The test separated a handler that survives the absent global context from one
that faults inside it by how long the process took to die: a surviving handler
exits in about a second, a faulting one sits for about 300s waiting for a report
that can no longer arrive.

Both paths are bounded by the same wait, though. SignalHandlers.cpp waits 300x1s
for fatal_error_printed, which is set at the very end of onFault, after the crash
report, so the healthy time is however long symbolization takes plus 3s. That was
measured at 4.1s idle and 27.1s under load against a 30s deadline, and the comment
on that loop records 101s for symbolization under MemorySanitizer. No constant
separates the two.

The report itself carries an exact signal instead. It is sent with chunked
transfer encoding, and the zero-length chunk that terminates the body is written
only when the writer finalizes, which is downstream of the part under test, so its
presence means the report was written in full rather than abandoned inside it. The
sink now records that chunk and the test asserts it, with no deadline involved.

Two details worth recording. The terminator is matched against the body rather
than the whole request because the header block ends in a digit followed by two
CRLF pairs of its own, so matching the whole request marks every run that merely
opened the connection as complete, including the runs this is meant to catch. And
the sink is now launched in a subshell, like the keeper already was: it is killed
at the end of every run, and a shell reports the death of its own background job
on its own stderr, which the runner reads as a failure. That was an 8% failure
rate on a correct build under load.

The remaining wait only has to outlast the handler's own, since a run that
reports leaves on the marker and a run that faults leaves when the process dies.

Co-Authored-By: Claude Opus 5 <[email protected]>
The crash report reads the server UUID through a non-throwing accessor, which
returns Nil until the UUID has been loaded, and the report omits the field for
Nil. Every test in this change parks the process before that load, so all of
them necessarily see Nil and none of them can tell a working accessor from one
that always returns Nil - which would silently drop the field that identifies
the crashing instance from every normal crash report.

test_send_crash_reports already receives a real report from a fully started
server, and already decoded the request body only to throw it away. Keep the
body, and assert the reported UUID equals what serverUUID() returns before the
crash. Verified live by making the accessor return a constant Nil: the test
then fails on that assertion while the report is still delivered.

The body is written before the file the test polls on, so a reader that sees
the completion marker is guaranteed a complete payload.
The report is built without a UUID to name in two states, and the test covered
one of them. A keeper reads its UUID before it creates the global context, so
the state it parks in is "no context". A server reads it after, so it also has
a state the keeper never has: the context exists and the UUID is still unset.

That second state is the one where the accessor this change replaced threw,
which the report path catches and then abandons the whole report in, so an
implementation that only tested the context pointer would pass every existing
arm while sending nothing for the length of the server's own startup. Parking a
server in it is the same fixture as the keeper arm, pointed at the other daemon.

A server not attached to a terminal keeps running as the child of a watchdog
that does not forward this signal, so the arm disables that fork to make the
process it starts the process that parks.

The state is bounded by the status file, which is written after the context is
created and immediately before the UUID is read, rather than by the line the
same code logs: logging is asynchronous, so that line can still be queued once
the process is already parked, and waiting for it loses the race and reports a
state the process has left.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Aug 25, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review

An independent cold review plus a second model reviewed this change over four rounds before it
was opened. Twenty findings: seventeen accepted and fixed, three rejected with evidence.

Accepted and fixed (the substantive ones)

  • ❌ 05043 could pass on a reverted tree on any non-sanitizer build: with the guard removed
    the sender logs its intent before it connects, and the null dereference is silent without a
    sanitizer runtime. Replaced by a content oracle - the terminating chunk of the report's own
    chunked body, which is written only when the writer finalizes, downstream of everything the
    body is built from.
  • ❌ Two oracles failed open: the endpoint readiness probe retried and then continued
    regardless, and the first marker matched the request header block rather than the body. Both
    now assert, and the terminator is matched against the body remainder.
  • ❌ A deadline cannot separate the two paths at all: fatal_error_printed is set as the last
    statement of onFault, so healthy and broken share one 300 s bound, and the in-tree comment
    on that loop records 101 s of symbolization under MSan. The residual wait is now a harness
    guard that decides no outcome.
  • ⚠️ The report path has three input states, not two, and only the extremes were covered. The
    middle one - global context created, server UUID not yet loaded - is reachable only from
    clickhouse-server, since Keeper loads the UUID before creating its context. It has its own
    arm now, and a mutation that would pass every other arm fails on exactly that one.
  • ⚠️ The changelog entry claimed diagnostics that are not in fact lost: the stack trace is
    logged 74 lines earlier, and system.crash_log is unreachable from Keeper. Rewritten to the
    measured difference.
  • ⚠️ Three fixed ports overlapped the kernel's ephemeral range (61%, 61%, 80%). Now
    OS-assigned. A witness read from the log was racy because logging is asynchronous; it now
    reads the status file, which is written synchronously before the read under test.
  • ⚠️ The Related: line sat inside the leading HTML comment, which GitHub does not render, and
    a header comment asserted an initialization order that holds for the server but not Keeper.
    Both corrected.

Rejected, with evidence

  • ⚠️ Two findings asked this change to additionally synchronize the publication of the global
    context pointer and of the stored UUID. Both reads pre-date it and neither is made worse: at
    the same site the previous code read the pointer unsynchronized and then called through it
    unconditionally, and for the UUID this change reads the static once where the previous call
    read it twice plus two context dereferences. The proposed remedy redesigns shared machinery
    this change does not touch. Neither race appears in the CI database over 90 days, against a
    control of 446 data race rows in the same window. Both are stated in the description.
  • 💡 One finding of my own, that deliberately signalling a process might attach a core artifact
    or trip the fatal-log scan, was refuted by measurement: cores are collected only when the run
    has already failed, and that scan globs a different directory and filename.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, on demand, using only documented options. Keeper::main reads its UUID at Keeper.cpp:376, before makeGlobalContext() at :433, and that read blocks when the path is a FIFO with no writer, so a FIFO there parks a real keeper inside the window with the listener live. Both committed tests use this shape; no source instrument.
b Root cause explained? Yes. The handlers and the listener are installed before the global context is created, so onFault can run with it still null. SignalHandlers.cpp:750 called handleCrash(), whose first action locks a non-static member, so a null this is a mutex operation on a wild address (measured under gdb: handleCrash(this=0x0) then std::mutex::lock(this=0xd38), a 303.6 s stall on a non-sanitizer build losing the stack, the system.crash_log row and the settings dump). On a daemon the report path then reached ServerUUID::get() from CrashWriter.cpp:121, which asks the context for the application type. The second site was masked until the first was fixed, because -fno-sanitize-recover=all aborts at the first report.
c Fix matches root cause? Yes. The first site tests the pointer at the point of use; the second removes the dependency rather than guarding it, since the report already treats the UUID as optional. Not a defensive check over an upstream bug: the absent context is the legitimate state of a process that has not finished starting. A sanitizer suppression was considered and rejected.
d Test intent preserved / new tests added? Two new stateless tests: 05042 (local, covers the first site) and 05043, which covers the report path that local cannot reach because it has no daemon. 05043 has two arms, because the two daemons read the UUID on opposite sides of creating the context, so neither can stand in for the other: a keeper arm for "context absent" and a server arm for "context present, UUID not loaded". Plus test_send_crash_reports is extended to cover the accessor's non-Nil path, which no stateless arm can reach: both park the process before the UUID is loaded, so they only ever observe Nil, and the existing integration test decoded the report body and discarded it. It now keeps the body and asserts server_uuid equals SELECT serverUUID() read before the crash. No existing test weakened or removed, and nothing added beside the existing one.
e Both directions demonstrated? Yes, three trees. 05043's keeper arm: fails on plain master (crash report not attempted, it aborts at the first site), fails with only the first fix (null global context dereferenced), passes with both. 05042 likewise fails without its fix on both a sanitizer and a debug build. Site-keyed oracles throughout, plus a no-signal control (0 reports, handler not reached) and a control that signals after startup completes on the unfixed binary (0 reports, handler reached) so the arms measure the window rather than any signal. The server arm is shown live by the narrowest mutation that would defeat it, context ? get() : Nil: it fails on exactly server: crash report not completed while the keeper arm and the integration test stay green, so it measures its own window and not the other one. The new integration assertion is shown the same way: with the accessor temporarily returning a constant Nil, the test fails on exactly that assertion while the report is still sent, and passes once reverted.
f Fix is general across code paths? Yes. Sweeping the transitive callees of onFault finds four places that touch the global context: the two fixed here, and ProxyConfigurationResolverProvider.cpp:152 and DateLUT.cpp:183, which already guard it in the same shape (the former's own comment names this caller). So this makes the path consistent with an existing contract rather than introducing one. Everything else on the path was checked and does not touch the context; collectCrashLog goes through a null-safe weak_ptr.
g Fix generalizes across inputs (params/datatypes/wrappers)? No datatypes or settings are involved; the equivalent axis is process and window, and both are enumerated. Server, keeper and local have a window and are covered; client, disks and the unit-test binary create the context before installing the listener, and are order-independent now regardless. Three distinct degraded states per daemon: context absent, context present with its shared part destroyed (handled by handleCrash's own !shared check), and context present with the UUID not yet loaded, where get() threw and the report was silently discarded. The non-throwing accessor covers the last one in both orders, since keeper loads the UUID before its context and the server after.
h Backward compatible? Yes. The accessor is additive and ServerUUID::get() is byte-for-byte unchanged, so its 22 other callers keep the initialization-order assertion they rely on. Nil is already a legitimate return, and CrashWriter.cpp:122 already omits the field for it. No setting, no default change, no serialization change, so no SettingsChangesHistory.cpp entry.
i Invariants and contracts preserved? Yes. The assertion inside get() is deliberate (added in 01ece1403520af8, narrowed to server and keeper in 8a49c1614e9bef2) and is left intact rather than weakened for one caller that treats the value as optional. Nothing is added to the signal path: the accessor is a plain static read, with no allocation, lock or reentrancy. It reads the stored UUID once where the previous call read it twice on this same path. The report's own catch is no longer used to swallow an initialization-order error.

Session id: cron:clickhouse-review-slot-11:20260825-040800

@clickhouse-gh

clickhouse-gh Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a29752d]

Summary: ✅


AI Review

Summary

This PR fixes the startup crash path in two places: SignalListener::onFault() now skips Context::handleCrash() until the global context exists, and CrashWriter reads the server UUID through a non-throwing accessor so reports can still be built before ServerUUID::load() finishes. The added stateless and integration coverage matches that contract. One diagnostics bug in the same touched path still remains.

Findings

⚠️ Majors

  • [src/Common/SignalHandlers.cpp:736, src/Common/SignalHandlers.cpp:757, src/Common/SignalHandlers.cpp:793] [dismissed by author -- https://github.com/Do not dereference the global context in the crash handler #116245#discussion_r3849891247] SIGTSTP is explicitly treated as non-fatal in signalHandler() (is_crashed is not set and the 300-second wait is skipped), but onFault() still runs the fatal-only epilogue: it writes system.crash_log, sends a crash report, and permanently sets fatal_error_printed. After one debug stack dump, the next real fatal signal breaks out of the wait loop at src/Common/SignalHandlers.cpp immediately, so slow symbolization or CrashWriter work can be truncated after only the unconditional 3-second tail sleep. Suggested fix: return early for SIGTSTP once the stack trace has been logged, before collectCrashLog, CrashWriter::onSignal, and fatal_error_printed.test_and_set().
Final Verdict

⚠️ Needs changes. The null-context and unloaded-UUID fixes look correct, but the touched crash path still treats the debugging SIGTSTP signal as a fatal crash once it reaches onFault().

LLVM Coverage Report

Measured on commit a29752d.

Metric Baseline Current Δ
Lines 89.10% 89.10% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 81.50% 81.50% +0.00%

Changed lines: Changed C/C++ lines covered: 13/13 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 25, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

One adjacent thing I left alone. SIGTSTP is documented as a debugging aid and signalHandler twice treats it as non-crashing (SignalHandlers.cpp:144, :168), yet onFault still writes system.crash_log, sends a crash report, and sets fatal_error_printed at :793, which nothing in the tree ever clears, so one SIGTSTP makes a later real fault skip its wait loop at :175. Should that path skip the crash-only epilogue? I did not change it here because it is a separate behaviour question, not part of this fix.

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @pamarcos @vitlibar, could you review this? The deadly signal handlers are installed before the global context exists, so a fatal signal during startup ran Context::handleCrash() on a null pointer, and on a daemon the report path then asked ServerUUID::get() for the application type through the same missing context; this guards the first at the point of use and gives the second a non-throwing accessor, which also covers the span where the context exists but the UUID is not loaded yet.

if (daemon)
daemon->flushTextLogs();
Context::getGlobalContextInstance()->handleCrash();
/// These handlers are installed before the global context is created, so it can still be absent during startup.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SIGTSTP is intentionally the one handled signal that returns to the process, but onFault still runs the crash-only epilogue for it and sets fatal_error_printed at the end. After one debug stack dump, the next real fatal signal enters signalHandler() with that flag already set and skips the 300 s wait at line 175, so slow stack symbolization or CrashWriter work can be cut off after the unconditional 3-second tail sleep. It also still inserts system.crash_log rows and sends crash reports for a non-crashing debugging signal.

Can we branch out of the crash-only part (collectCrashLog, CrashWriter::onSignal, fatal_error_printed) for SIGTSTP once the stack trace has been logged?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed. onFault (SignalHandlers.cpp:579-793) has no SIGTSTP branch, so collectCrashLog (:736), CrashWriter::onSignal (:757), thread_ptr->onFatalError() (:791) and fatal_error_printed.test_and_set() (:793) all run for it. That flag has exactly two references in the tree, set at :793 and read at :175, and nothing clears it, so one debug dump does leave a later real fault with only the unconditional 3 s tail at :183.

I am not changing it in this PR. This is a two-line null check on the crash path, asked for as a separate minimal fix, and branching the epilogue changes documented behaviour: SIGTSTP would stop producing system.crash_log rows and stop sending crash reports. I have no observed case of that hurting anyone, so I cannot size the risk, and I do not want an unverified behaviour change riding on a mechanical fix. That is why I raised it as a question in the PR rather than as a diff. If a reviewer wants it, it belongs in its own PR with its own test.

@clickhouse-gh

clickhouse-gh Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing a29752dbd with master de1224b14 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 28fd75867; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

30 translation units recompiled, 190 s compile time in total, 30 of them have a recent master baseline.

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - c700ab4

CI is fully finished on this head. Every failure below has an owner.

Check / test Reason Owner / fixing PR
BuzzHouse (amd_debug) job-level ERROR: OOM in dmesg: whole-host global_oom killed the server at ~50.8 GiB anon-RSS, so the job reports no fuzzer result at all a fix task is created (investigating at full effort - fixing-PR link to follow on this PR)

Not caused by this PR. The diff touches the crash handler, ServerUUID and CrashWriter plus
tests, and reaches no allocation or memory-accounting path a fuzzer workload can drive to tens of
GiB. The signature is trunk-wide: 16 rows across 15 distinct PRs on this arm in 30 days, plus 5
rows on non-PR runs, and the sibling arm_asan_ubsan, amd_tsan and amd_msan BuzzHouse arms on
this same head all finished green.

I checked the nearest recorded owner before opening a new one and it does not apply. That earlier
investigation attributed the same OOM in dmesg reporting surface on the AST fuzzer amd_debug
family to unbounded background-merge memory, addressed in flight by #109433. On this job that
explanation is measurably wrong: of the 47 MEMORY_LIMIT_EXCEEDED errors in this head's
server.log, zero are attributed to background merges (the AST fuzzer case was 81 percent),
and all 47 are SystemLog::flushImpl failures, which are victims of the shortage rather than the
consumer. Linking #109433 here would have named the wrong owner, so it is deliberately not linked.

Worth recording for whoever picks this up: the memory tracker was already rejecting allocations
with would use 72.59 GiB (attempt to allocate chunk of 4.17 MiB), current RSS: 34.43 GiB, maximum: 44.41 GiB, so it believed roughly twice the resident set was in use and was refusing
4 MiB system-log flushes, while the process still grew to 50.8 GiB before the kernel killed it.

The two Bugfix validation (integration tests, aarch64/amd64) rows visible in CIDB for
test_send_crash_reports/test.py::test_send_segfault are not failures: they carry
test_status = FAIL with check_status = skipped, which is the arch-not-applicable arm, meaning
the bug does not reproduce on that arch and the test itself passed. They owe no owner.

Config Workflow, Style check and Finish Workflow are all green, and 155 of 175 praktika
nodes are OK with 18 SKIPPED and none dropped. A CIDB query at this commit returns exactly the
rows discussed above against a control of 307,132 rows at the same commit, so those counts are a
real filtered subset rather than an empty query.

Session id: cron:our-pr-ci-monitor:20260825-103000

@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the BuzzHouse (amd_debug) OOM-in-dmesg job failure: #116359

@clickhouse-gh clickhouse-gh Bot added the comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). label Sep 4, 2026
@Avogar Avogar self-assigned this Sep 11, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 39 queries analysed

This PR only changes crash-handler startup safety (ServerUUID::tryGet, a null-guarded global context in the signal handler) plus crash-report tests; none of it runs on the query-execution hot path. The two flagged ClickBench queries (Q28 -5.7%, Q34 -5.6%) were correctly suppressed as within-baseline-envelope: both deltas fall inside master's current-era variance band, and CPU time is essentially unchanged (Q28 15632.7 vs 15554.6 ms, Q34 16770.2 vs 16703.3 ms), consistent with run-to-run variance rather than any PR effect. No action needed; the deterministic verdicts are sound.

clickbench

🟢 No significant changes

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 8d1c70b9-17b3-4605-ac07-0c7b870710e0
  • MIRAI run: 7c7977d3-1982-444c-b840-a3b70112e2c2
  • PR check IDs:
    • clickbench_306794_1789484477
    • clickbench_306800_1789484476
    • clickbench_306806_1789484476
    • tpch_adapted_1_official_306816_1789484476
    • tpch_adapted_1_official_306828_1789484476
    • tpch_adapted_1_official_306864_1789484476

@Avogar
Avogar added this pull request to the merge queue Sep 15, 2026
Merged via the queue into ClickHouse:master with commit e66b37c Sep 15, 2026
177 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 15, 2026
KangXin4J pushed a commit to KangXin4J/ClickHouse that referenced this pull request Sep 30, 2026
…reports

test_send_segfault kills the server with SIGSEGV and then reads the fake
Sentry server's result and payload files with `docker exec`. The node has
no stay_alive, so its container exits together with the server, and a read
that lands after that fails with `container ... is not running`.

When the server dies follows from the signal handler: starting at the
signal, it checks once per second whether the crash report has been
handled, then sleeps 3 s and re-raises the signal. In the failing amd_cfi
run the report was written 6.30 s after the signal, the fourth poll
(+10.17 s) still read OK, the payload read started at +10.25 s and the
container stopped at +10.26 s. A report that lands just after a poll can
make the poll itself hit a stopped container in the same way.

The fake server now writes both files into /var/log/clickhouse-server,
which every instance mounts from the host, and the test reads them from
node.logs_dir, so nothing is read through the container after the crash.
stay_alive=True would also keep the container up, but it runs the server
with --daemon, which chdirs to <path>/cores, so the SIGSEGV core would land
in the host-mounted database directory that CI uploads in logs.tar.gz when
the suite fails.

With CI's amd_cfi binary, waiting for the container to stop before the
payload read (or before the first poll) fails the old test with the CI
error and passes with this change.

Failing job: https://github.com/ClickHouse/ClickHouse/actions/runs/36373749054/job/108786682402

Related: ClickHouse#116245

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-logging Logging/monitoring/observability (logs, metrics, tracing, instrumentation). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants