Repository navigation
Conversation
…ient_dies_distributed" This reverts commit fc2b4b2, restoring tests/queries/0_stateless/04365_cancel_insert_when_client_dies_distributed.sh byte for byte to its 8a43197 (ClickHouse#111157) content. That commit regressed the test on the public arm_binary lane. CIDB, on Stateless tests (arm_binary, parallel), this test only: test file revision runs FAIL rate pre-ClickHouse#111157 21183 10 0.047% ClickHouse#111157 8a43197 10251 0 0% ClickHouse#119778 fc2b4b2 220 2 0.909% The two siblings that commit did not touch are clean over the same post-merge window (02434_cancel_insert_when_client_dies 221 OK / 0 FAIL, 04366 220 OK / 0 FAIL), so only the file it changed regressed. Mechanism. thread_cancel kills the insert client at a random point in its life, and the test's anti-vacuity guard passes only if some kill lands while the server is holding an insert. On a release build that window is about 17 ms of a 108 ms client cycle, so the client-discovery latency decides where the kill lands. The reverted commit replaced a /proc/*/cmdline sweep, which can only return a client that has already been alive one poll, with an O(1) read of a pid the client publishes at fork, which returns within about 10 ms and therefore lands the kill in the client's startup phase, where the server has no query to cancel. An A/B of both revisions on one RelWithDebInfo binary, interleaved so both see the same conditions, measures the per-kill cancellation probability at 28.2 percent for the sweep against 15.5 percent for the O(1) lookup, and 15.5 percent is the uniform in-flight share. The commit also raised the kill count by 26 percent, which is why the lost quality is invisible on a debug build. The cost the reverted commit set out to remove, a /proc sweep starving once the host carries tens of thousands of processes, was measured on a shared development machine and has never been observed in CI: the identical code ran 10251 times on arm_binary without one failure. Synchronising the kill on real server progress is the better design, but one client round trip costs about 64 ms against a 17 ms window, so it needs a different workload and is out of scope for this revert. 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; 2 gate findings plus 8 from my own
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20260914-110900 |
|
Workflow [PR], commit [ada9469] Summary: ✅ AI ReviewSummaryThis PR reverts the O(1) client lookup in Findings
Final VerdictChanges requested: the revert restores a previously failing cancellation mechanism on another CI lane, so I would not merge it without evidence that the private lane no longer regresses or a lane-independent replacement for the |
| PID="$CANDIDATE" | ||
| break | ||
| fi | ||
| PID=$(grep -Fa "query_id=$TEST_MARK" /proc/*/cmdline | grep -Fav grep | grep -Fav insert_data | grep -Eoa "/proc/[0-9]*/cmdline:" | grep -Eo "[0-9]*" | head -1) |
There was a problem hiding this comment.
This restores the same /proc/*/cmdline sweep that was already failing on the private Stateless tests (amd_release, distributed cache, meta in keeper, s3 storage, parallel) lane Alexey linked in #96844 (comment): the 04365 failure there is the same 500000 / 500000 / 0 guard flip, and its bash log shows this line-76 scan in the trace immediately before kill.
So even if this fixes the public arm_binary regression, merging the plain revert just moves the known flake back to the private release lane rather than removing it. Can we either keep a constant-time client handoff here, or provide evidence from that lane that the restored scan no longer regresses?
There was a problem hiding this comment.
Premise granted where I can check it: line 76 is the restored sweep, and the file is byte-for-byte the pre-#119778 revision, so this does return the design that was in force while that lane was red. The PR body says that at the close and I am not claiming the revert is neutral there.
Two corrections to the citation. The comment you link carries no signature and no bash log: it reports 35 failures in 90 days with 24 on master and asks for an investigation. And that private report is HTTP 401 for this account (re-measured today), with 0 rows in public CIDB for any distributed cache or meta in keeper lane in 90 days. The private facet relayed to me is consistent with your claim: 32 of 32 master-branch failures of this test on the private lanes in 30 days carry the same -1/+0 flip.
On (a): the constant-time handoff is the commit being reverted, and it is the measured cause of the public regression. Stateless tests (arm_binary, parallel), this test only:
| design in force | runs | FAIL |
|---|---|---|
| snapshot + long sleeps (pre-#111157) | 21183 | 10 |
sweep poll (#111157 8a43197aa9f9) |
10251 | 0 |
O(1) pid file (#119778 fc2b4b22204e4) |
313 | 2 |
Siblings unchanged on the same lane and window (02434 314/0, 04366 313/0); Fisher one-sided p = 8.7e-4. The sweep costs 85-300 ms per poll, so the kill lands late, inside the roughly 17 ms window where the server holds the insert. The O(1) lookup returns about 10 ms after fork, so kills rose from 0-8 to 110-133 per run while per-kill conversion fell from 28% to 15%, and a whole 40 s window can pass with no cancellation logged. Discovery latency is load-bearing here, so a constant-time handoff that also keeps the public lane green needs the kill synchronised on observed server-side insert progress, and this workload cannot carry that: about 17 ms in flight against a 50-64 ms client round trip. That is a separate change with its own before and after, not a rider on a revert.
On (b): I cannot read that lane, for the reason above. The same standard cuts both ways: the O(1) lookup synced down at 2026-09-13 15:49Z and I hold no post-sync measurement of that lane either, so it has not been shown to fix it. And on your own reading of that log, a scan immediately before kill means the kill did land, which makes that failure a conversion failure rather than the discovery starvation the reverted commit removed.
So I am keeping the plain revert. The #96844 ask stays open on my side after this merges, and if that lane reds again the design named above goes in its own PR with that lane's own numbers. Whether to take the public restore now or hold for one change covering both lanes is @ alexey-milovidov's call, as the reviewer who requested and approved the commit being reverted.
|
Fixed in another PR. |
Related: #119778
Related: #96844
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reverted the O(1) insert-client lookup in
04365_cancel_insert_when_client_dies_distributed, which made that test's cancellation guard flip on thearm_binarylane.Description
This reverts my #119778, which @alexey-milovidov requested in #96844 and approved 29 minutes before
it merged. Since then the test's anti-vacuity guard flips to
0onStateless tests (arm_binary, parallel), reddening #119819 and my own #117702. CIDB, that lane and test only:8a43197aa9f9fc2b4b22204e4Siblings
02434and04366, untouched by #119778, are 281/0 and 280/0 there: only the file itchanged regressed.
The guard passes only if a kill lands while the server is holding an insert, ~17 ms of a ~108 ms
client cycle on a release build, so discovery latency decides where the kill lands. #119778 replaced
a
/proc/*/cmdlinesweep, which can only return a client already alive one poll, with an O(1) readof a pid published at
fork. A/B of both revisions interleaved on one RelWithDebInfo binary: 27.3cancellations per run with the sweep against 18.9 (per-kill 28.2% against 15.5%, the uniform
in-flight share). That is the direction, not the size: neither arm flips locally on x86, so the case
for reverting is the rate above.
A plain revert, byte for byte back to
8a43197aa9f9, validated on RelWithDebInfo (thearm_binarybuild type) on x86; I cannot match ARM locally.
Two disclosures. The sweep costs O(processes on the host): on the shared 59-slot box I test on it
takes 85 to 1820 ms per poll and the guard flips there instead, 21 of 50 runs, so this is a trade-off.
And the failure @ alexey-milovidov reported is on a private lane I cannot read, which #119778 aimed at
and was never shown to fix there; this revert may reopen it.
CIDB query behind the table
The window boundaries are revision boundaries, not merge dates: a pull request branched before
#111157 merged still ran the old file, so
2026-08-18 15:14:31is the first run on that lane afterthe last pre-#111157 one. Both failures in window 3 are the same signature,
@@ -1,3 +1,3 @@withboth
500000data lines intact and-1/+0on the guard line, on two different pull requestsrather than one retried, and neither carries
LLVM Profile Error(the separate coverage-lane facet,closed by merged #113619).
Workflow [PR]
Sync PR [sync-upstream/pr/119948]