Repository navigation
Conversation
`AST fuzzer (amd_debug*)` jobs report `Server unresponsive: memory limit
exceeded` when the job's own container memory cgroup runs out of memory, not the
server. `run-fuzzer.sh` keeps two resident `gdb -batch` processes inside that
cgroup for the whole job: one attached to `clickhouse-server`, and one attached
to the fuzzer `clickhouse-client`. Both parse the debug info of the same debug
binary, so each holds several GiB of anonymous memory from attach time onward.
From the `dmesg.log` of one such job (memcg limit 57740840960 = 53.78 GiB):
clickhouse-serv pid 3238 rss_anon 44.47 GiB
gdb pid 3540 rss_anon 4.198 GiB (server)
gdb pid 4295 rss_anon 4.233 GiB (fuzzer client)
clickhouse-clie pid 4290 rss_anon 113 MiB
ClickHouseWatch pid 3229 rss_anon 45 MiB
`total_rss` 53.03 GiB + `cache` 489 MiB + `kmem` 271 MiB = 53.79 GiB against the
53.78 GiB limit, so the accounting closes with no unexplained term, and
`failcnt` was already 136495. The two debuggers are 15.7% of the whole budget
and no budget in the job accounts for them: the server's own hard limit is
derived from the cgroup limit as if it were the only tenant
(`max_server_memory_usage_to_ram_ratio` 0.75, giving `maximum: 40.33 GiB`).
gdb tripped the charge (`gdb invoked oom-killer`,
`oom-kill:constraint=CONSTRAINT_MEMCG`, so the container cap bound and not the
host), and the kernel picked the server as the victim because a debug build
raises its own OOM score to 555 (`getDefaultOomScore()`,
`src/Core/ServerSettings.cpp`, `#if defined(OS_LINUX) && !defined(NDEBUG)`).
The diagnostic collection kills the server it attached to collect from, and the
rest of the fuzzing budget is lost.
The client-side attach has been redundant since 72ac59f ("add signal
handlers in client and local", 2024-03-08), which landed seven days after the
attach was added in 361ec17. `ClientApplicationBase::init` installs the
deadly-signal handlers for {SIGABRT, SIGSEGV, SIGILL, SIGBUS, SIGSYS, SIGFPE,
SIGTRAP} (`src/Common/SignalHandlers.cpp:881`) plus a `SignalListener` that
writes the symbolized trace to the client's stderr, which `run-fuzzer.sh`
redirects into `fuzzer.log`. That file is uploaded and parsed by
`FuzzerLogParser`, whereas gdb's output only ever reached `job.log`, which
nothing parses. Measured locally on a debug build: killing a client with
SIGSEGV and with SIGABRT while no debugger is attached (`TracerPid: 0`) prints
`Received signal ...` plus the full symbolized frame list, on stderr and not on
stdout. In the job above, and in three other occurrences on unrelated pull
requests, the client gdb emitted only `script.gdb:13: Error in sourced command
file: No stack.` after holding its memory for 26 to 55 minutes.
The gdb attached to the server is kept unchanged: it adds locals, registers and
disassembly over the trace `BaseDaemon` prints by itself, and a single debugger
fits the budget with about 7.5% of margin.
Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own cold review of
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20260906-014800 |
|
Workflow [PR], commit [d4cd19e] Summary: ❌
AI ReviewSummaryThis PR removes the long-lived Findings
Tests
Final Verdict |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20260906-010800 |
|
cc @leshikus, could you review this? The AST fuzzer and BuzzHouse jobs keep two resident |
| @@ -288,31 +288,6 @@ function fuzz | |||
| fuzzer_pid=$! | |||
There was a problem hiding this comment.
The client-side attach is not redundant yet. clickhouse-client's own handlers only preserve the plain fatal stack trace (src/Client/ClientApplicationBase.cpp:257-281), while the deleted gdb was the only attached artifact that still carried backtrace full, registers, and disassembly for client-origin failures. job.log is uploaded on every run (ci/praktika/runner.py:857), so that information was still available even if nothing parsed it automatically.
There is also no core-dump fallback today: run-fuzzer.sh rewrites any core.* into core.zst at the end, but ClickHouseService.collect_cores only uploads raw core.* files and explicitly skips .zst (ci/jobs/scripts/clickhouse_service.py:225-256). After this deletion, a client crash loses the only rich postmortem artifact we attach. Please either keep an on-failure client-side postmortem path or fix core upload in the same change before dropping this attach.
There was a problem hiding this comment.
I checked both claims at the cited lines.
The core-upload gap does not exist. zstd keeps its input unless --rm is passed, so run-fuzzer.sh:409-412 leaves the raw core next to the compressed copy it makes:
$ ls; if test -f core.*; then zstd --threads=0 core.*; mv core.*.zst core.zst; fi; ls
core.clickhouse-clie.4290
core.clickhouse-clie.4290
core.zst
What collect_cores skips is therefore that duplicate, not the core. It is called on every failing run (ci/jobs/ast_fuzzer_job.py:585) over WORKSPACE_PATH, which is the directory run-fuzzer.sh runs in (cd /workspace, :21, bind-mounted from WORKSPACE_PATH) and where the runners' relative kernel.core_pattern puts a core, and Result.set_files appends (ci/praktika/result.py:293), so the log attachment after it does not displace the core.
Observed rather than inferred: an AST fuzzer (amd_debug, targeted, old_compatibility) run yesterday that reported Received signal 6 attached both the core and its key.
That is the core.<comm>.<pid>.zst.enc form ci/decrypt-cores.md documents for this job, and the name is exactly the runners' core.%e.%p-%P. Nothing reads core.zst: its only occurrence in the tree is the mv that creates it.
On the attach itself, I agree about the artifact difference and not about the conclusion. script.gdb does add backtrace full, info registers, disassemble /s and all-thread traces over the client's own symbolized frame list, and job.log is uploaded. That asymmetry is why I keep the server attach, and the description says so. What does not survive is the cost:
- The output only exists if the client is the process that faults. In the run this PR is built on, the client attach printed
[Inferior 1 (process 1148) exited with code 0322]and thenscript.gdb:13: ... No stack.after holding 4.233 GiB for 55 minutes.0322octal is 210, the client's ownNETWORK_ERRORexit: it did not fault, it lost the server. Three other runs I checked (Handle query cancellation in S3 reads and part recovery #116257c2e91fee, Move AI functions to the end of PREWHERE #117802589b9eb6, Don't merge clauses withFUNCTION_UNKNOWNinConditionSelectivityEstimator#118137bf2e8f6c) also printed onlyNo stack. - For the case where the client does fault, the core is a superset of a live
-batchsnapshot: all threads, full memory, locals, registers, disassembly, decryptable perci/decrypt-cores.md. Whether a client core is written at all is set by the ambientRLIMIT_CORE, since the client does not raise its own the way the server does, and this change does not touch that either way. - The two attaches together were 15.7% of the container budget, and
gdb invoked oom-killerwithconstraint=CONSTRAINT_MEMCGis what killed the server. Paying that for a fault that did not happen costs the job the server the fuzzer was testing.
So I am keeping the deletion, and not adding a core-upload change, because that path is intact.
CI finish ledger - d4cd19eEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose
One measurement from this run that is relevant to reviewing the change itself: the Session id: cron:our-pr-ci-monitor:20260908-060056 |
CI finish ledger - d4cd19e (owner update)The one failure on this head now has its fixing PR, so the placeholder above is discharged.
Root cause, from this run's own
#118467 bounds that expansion (100000 paths / 64 MiB / 1000 groups), which rejects a 32-group pattern Relevant to reviewing this PR: the surviving |
Algunenano
left a comment
There was a problem hiding this comment.
This is the wrong approach. In the past we added this gdb because it was the only way to investigate fuzzer client crashes (and there were quite a few). Removing it removes observability
|
You are right, and I am not pursuing the removal. The measurement that drove it, from the job's own The measurement that settles it against me: with this branch's deletion live in CI, the same job OOMed again with one If you do want that residency gone at some point, the shape I would suggest keeps everything the attach prints: take the postmortem from the core instead of from a live attach. Say the word and I will reshape this PR that way. Otherwise I will close it. |
|
IMO if gdb is useful in the server, it's useful in the client. If it's removed in one then it can be removed in both. Also as you say the problem is that the server did not respect its limits, so the issue is in the server, not the client being OOM killed by the system. Let's close this instead |
|
Agreed on the server being the fix site. Following that up, I went looking for why this lane started The onset.
#116782 merged 2026-09-03T14:33:11Z; the first failure is 2026-09-03 16:08:59 and that job's
The ceiling fell 46.33 to 40.33 GiB. Every failing RSS I can read (40.34, 40.35, 40.40, 40.42, Your point holds underneath it. From the One lever, if you want it. Restore the pre-#116782 ceiling, funded by dropping the
I have not opened it, because it is CI accounting and you just pointed at the server. It also does |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Do not attach a second
gdbto the fuzzer client in theAST fuzzerandBuzzHousejobs. It held 4.2 GiB of the job's container memory budget for the whole run, which is what made the container OOM-kill the server it was attached to collect from.Description
Related: #116782, issue #111892. Provenance:
AST fuzzer (amd_debug, targeted)on #107150, head6ac8eded(report).AST fuzzer (amd_debug*)reportsServer unresponsive: memory limit exceededwhen the job's own container cgroup, not the server, runs out of memory.run-fuzzer.shkeeps two residentgdb -batchin it for the whole job: one onclickhouse-server, one on the fuzzerclickhouse-client. Both parse the same unstripped debug binary: 8.4 GiB together, 15.7% of the 53.78 GiB budget, budgeted nowhere.gdbtripped the charge (constraint=CONSTRAINT_MEMCG: the container cap bound, not the host) and the kernel chose the server, which a debug build gives OOM score 555 (getDefaultOomScore()). The diagnostic collection kills the server it attached to collect from. My #116782 made that cap binding without sizing this term: 1 occurrence in 26,481 job runs before it, 15 in 2,984 after.I delete the client attach and the pid-discovery loop that fed it. It has been redundant since 72ac59f ("add signal handlers in client and local"), a week later:
setupCommonDeadlySignalHandlers()covers the seven fatal signals and prints a symbolized trace to stderr, which this script redirects into the uploaded and parsedfuzzer.log; gdb's output reached onlyjob.log, which nothing parses. The server attach stays: the server is what the job fuzzes,script.gdbadds locals, registers and disassembly overBaseDaemon's own trace, and one debugger fits the budget.This buys margin, not immunity: the server alone reached 44.47 GiB against the 40.33 GiB it derives for itself, so it can still trip the cap alone.
No test file or 50/50 run applies to a CI harness script. All seven
AST fuzzerand theBuzzHousejobs digest./ci/jobs/scripts/fuzzer/, so each re-runs the edited script here.Not fixed here:
ast_fuzzer_job.py's dmesg check matches onlyCONSTRAINT_NONE, so a container kill is still misreported as a product failure; #116359 rewrites those lines.Measurements: dmesg accounting, rate, local footprint
dmesg.log at the OOM instant,
oom_memcg=/docker/9e9331e827d2...,hierarchical_memory_limit 57740840960(53.78 GiB),failcnt 136495:clickhouse-servgdb(server)gdb(fuzzer client)clickhouse-clieClickHouseWatchtotal_rss53.03 GiB +cache489 MiB +kmem278 MiB = 53.79 GiB, so the accounting closes with no unexplained term.gdb invoked oom-killer,oom-kill:constraint=CONSTRAINT_MEMCG,Memory cgroup out of memory: Killed process 3238 (clickhouse-serv) ... oom_score_adj:555. The client gdb printed onlyNo stack.here and in three other runs.Other days: 0 oom, on 665 to 1333 runs each.
Locally on a debug build: one resident
gdbwith this job'sscript.gdbreaches 8.53 GiBVmHWM; the deleted block run verbatim gives two debuggers at 17.02 GiB, against 8.50 GiB after this change. A client killed with SIGSEGV and with SIGABRT whileTracerPid: 0prints the full symbolized frame list on stderr, nothing on stdout.Workflow [PR]
Sync PR [sync-upstream/pr/118365]