Repository navigation
Do not treat a transient liveness-probe timeout as a dead fuzzer server - #108582
alexey-milovidov merged 1 commit into
Conversation
After the AST fuzzer is SIGTERM'd at its 30m time limit (a clean run, exit 143), run-fuzzer.sh probes the server with `clickhouse-client --receive_timeout=5 --query "SELECT 1"`. If that first probe hit its 5s receive timeout (the server is alive but slow to answer right after 30m of ASAN fuzzing), the loop's catch-all branch set server_died=1 and broke on the first failure. status.tsv then carried server_died=1, and ast_fuzzer_job.py checks server_died before the exit-143 OK branch, so the healthy run was reported as a FAIL whose only "stack" is the server's normal-shutdown "Received signal 15" line. A receive/socket timeout means the server is alive but slow, not dead: a dead server returns "Connection refused" (code 210) or EOF (code 32), neither of which contains "Timeout". Count consecutive probe timeouts and only declare a hang once they persist (12 in a row, ~12s), so a single transient timeout no longer turns a clean run into a bogus "server died" failure while a genuine hang is still caught. The busy branches reset the counter so it tracks consecutive timeouts only. Observed across 8 unrelated PRs in 30 days (arm_asan_ubsan, amd_msan, amd_tsan, amd_debug-targeted), 0 on master. Adds ci/tests/test_fuzzer_liveness_loop.py, which drives the loop text verbatim against a mock clickhouse-client for the transient-recovery, connection-refused, and persistent-hang cases. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260626-071200 |
|
cc @maxknv — could you review this CI fix? It stops the AST fuzzer job from reporting a bogus |
|
Workflow [PR], commit [64bc255] Summary: ✅ AI ReviewSummaryThis PR changes Missing context / blind spots
Final VerdictStatus: ✅ Approve No required actions. |
96509b5
The post-fuzz liveness probe loop in run-fuzzer.sh is written to spend 5 seconds per probe, but each probe can block for 300 seconds. On PR ClickHouse#111394's AST fuzzer (amd_debug, targeted) job the loop took 66 minutes to reach its verdict: 5m27s per probe, twelve times. --receive_timeout does not apply until the handshake completes. Connection.cpp sets both socket timeouts to handshake_timeout before sendHello and only swaps them to receive_timeout/send_timeout afterwards, and the client CLI's handshake fallback is DBMS_DEFAULT_RECEIVE_TIMEOUT_SEC * 1000 = 300000 ms, even though the setting's own declared default is 10000. A server that accepts the TCP connection but never finishes the handshake therefore holds each probe for 300 seconds. The fuzzer's port is TLS and the TLS handshake is deferred to the first send, so the error text reads "writing to socket", which invites a wrong attribution to send_timeout; elapsed time discriminates the two. Measured against a listener that accepts and never replies: --receive_timeout=5 alone blocks 300s (322s over TLS); adding --handshake_timeout_ms=30000 bounds it at 30s, and 5000 and 12000 confirm the bound tracks the value passed. 30000 rather than 10000 because 7ec04d1 documents a healthy server needing more than 10s to send Hello on a loaded lane, and a retry does not help since each attempt spawns a fresh client and restarts the handshake from zero. The worst healthy handshake measured on a debug server under 65 concurrent queries was 0.148s, so the margin is large. The two best-effort diagnostics get a hard command deadline instead of a flag: a diagnostic can stall pre-Hello, post-Hello or inside the query itself, and one wall-clock cap covers all three. --kill-after is required because a bare timeout only sends SIGTERM and then keeps waiting: measured 12s for a 3s budget against a child that ignores it. Both call sites were already ||:-guarded, so the signal cannot abort the script before the status.tsv write. No loop bound, branch or verdict is changed. Running the loop's five outcomes (immediate success, connection refused, persistent timeout, TOO_MANY_SIMULTANEOUS_QUERIES, MEMORY_LIMIT_EXCEEDED) against the patched and unpatched text gives identical results, including the final timeouts counter; two mutations of the loop do shift those results, so the comparison is not vacuous. In particular timeouts_max stays at 12, since lowering it would weaken the anti-false-positive property added in ClickHouse#108582. This does not fix whatever wedged the server and would not have turned the cited run green: that server genuinely failed 12 consecutive probes, so the job fails either way. What it removes is about 54 minutes of wasted runner time per occurrence, and three reachable scenarios whose worst case exceeds the 5 hour job cap today (bootstrap readiness, post-gdb readiness, and all-busy probing) now peak at 188 minutes.
…r-liveness-probe-timeout Do not treat a transient liveness-probe timeout as a dead fuzzer server
Related: #108508
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
The
AST fuzzer (...)job intermittently reports aReceived signal 15failure across unrelated PRs (8 PRs in the last 30 days onarm_asan_ubsan,amd_msan,amd_tsan,amd_debug-targeted; 0 on master). The reported row has no STID, no stack, and no fuzzed query.Root cause. It is a false positive in the post-fuzz server-liveness probe, not a crash. After the fuzzer is SIGTERM'd at its 30m time limit (a clean run,
fuzzer_exit_code=143),run-fuzzer.shprobes the server withclickhouse-client --receive_timeout=5 --query "SELECT 1". When that first probe hits its 5s receive timeout (the server is alive but slow to answer right after 30m of ASAN fuzzing), the loop's catch-allelsebranch setsserver_died=1and breaks on the first failure.status.tsvthen carriesserver_died=1, andast_fuzzer_job.pychecksserver_diedbefore thefuzzer_exit_code in (0, 137, 143)OK branch, so the healthy run is reported as a FAIL whose only "stack" is the server's normal-shutdownReceived signal 15line.stop_serverconfirms it in the same logs (Server exit code is 0) — the server shut down cleanly and was never dead.Evidence from the triggering run (PR #108508, SHA
88795dc6caed,AST fuzzer (arm_asan_ubsan), report):04:11:26fuzzer started (30m budget);04:41:26(+30m)timeout --signal TERM→ fuzzer exit143,server_died=0.04:41:32post-fuzz probe →Timeout exceeded while receiving data from server. Waited for 5 seconds→ catch-all setsserver_died=1, breaks.04:41:46Server exit code is 0(clean shutdown).fuzzer.logends atFuzzing step 602 out of 1000thentimeout: sending signal TERM— no ASan/LOGICAL_ERROR/signal 11/6.server.loghas onlyReceived signal 15/Received signal -2shutdown markers, no<Fatal>, no sanitizer report, no OOM.Fix. A receive/socket timeout means the server is alive but slow, not dead — a dead server returns
Connection refused(code 210) or EOF (code 32), neither of which containsTimeout. The loop now counts consecutive probe timeouts and only declares a hang once they persist (12 in a row), so a single transient timeout no longer turns a clean run into a bogusserver diedFAIL, while a genuine hang is still caught. The existingConnection refused/EOF path is unchanged, so a real dead server is still detected immediately.ci/tests/test_fuzzer_liveness_loop.pydrives the loop text verbatim against a mockclickhouse-clientfor three cases: transient-timeout-then-recovers (server_died=0), connection-refused (server_died=1on the first probe), and persistent-timeout/hang (server_died=1once it persists). The transient case fails against the pre-fix loop and passes after the fix.Version info
26.7.1.160(included in26.7and later)