Repository navigation
Conversation
The test drives the cancelled INSERT only over the native protocol, but its
final "ensure that thread_cancel actually did something" assertion was inherited
from the HTTP-heavy sibling 02434 and matches only HTTP-chunked / socket-drop
messages (plus a predicate that exists only in the test files).
On the native protocol a SIGINT makes the client send a graceful 'Cancel' packet
and keep the connection open, so the server logs QUERY_WAS_CANCELLED_BY_CLIENT
("Received 'Cancel' packet from the client, canceling the query.") instead of a
broken pipe or connection reset. The socket-drop messages only fire when a SIGKILL
lands while the server happens to be writing back to the client. thread_cancel
picks INT or KILL with equal probability, so roughly half of the cancellations
produce no message the assertion recognizes, and the SIGKILL half matches only
when the kill races a server-side write. Over the 40s run the margin is thin and
the assertion occasionally observes zero matching messages, printing 0 instead of 1.
Add the native-protocol cancellation messages to the matcher. Verified locally:
a SIGINT interrupting an in-flight native distributed insert logs the cancel
packet message 11 out of 12 times while matching the old filter 0 times; a normal
uncancelled insert never logs it, so the assertion still requires a real
cancellation.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-0:20260623-224400 |
|
cc @CheSema — could you review this? This test (which you split out in #107886) drives the cancelled insert only over the native protocol, where SIGINT sends a graceful Cancel packet instead of dropping the socket, so the final "ensure thread_cancel did something" assertion (inherited from the HTTP-heavy 02434) misses the QUERY_WAS_CANCELLED_BY_CLIENT messages and occasionally prints 0 instead of 1. The fix just adds those native cancel-packet messages to the matcher. |
|
Workflow [PR], commit [401bc6c] Summary: ❌
AI ReviewSummaryThis PR fixes the flaky Final VerdictStatus: ✅ Approve |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 435 line(s), 103 function(s) across 138 file(s) · Details Top files
|
CI finish ledger — 401bc6cEvery failure below links a fixing PR (ours or external). Only
The 04365 test this PR fixes is green on this commit (0 FAIL; SKIPPED in sanitizer builds per its tags, OK on arm_binary). Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108343&sha=401bc6c8948aafec9d012dc420984876161f259e&name_0=PR&name_1=Stress%20test%20%28arm_asan_ubsan%2C%20s3%29 Session id: cron:our-pr-ci-monitor:20260624-043000 |
9d4d0e6
…ted-cancel-insert-native-match Fix flaky test 04365_cancel_insert_when_client_dies_distributed
No related open issue found (searched issues + PRs for the test name; none exist).
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Fixes flaky
04365_cancel_insert_when_client_dies_distributed(failed flakily in two unrelated PRs, 0 master hits; 2 FAIL / 59 OK in 30 days).The test cancels an INSERT into a
Distributedtable over the native protocol only (the HTTP variants live in the siblings02434/04366). Its final "ensure that thread_cancel actually did something" assertion was inherited from the HTTP-heavy02434and matches only HTTP-chunked / socket-drop messages (plus the predicate'Query was cancelled or a client has unexpectedly dropped the connection', which exists only in the test files, never in the server source).On the native protocol a
SIGINTmakes the client send a gracefulCancelpacket and keep the connection open, so the server logsQUERY_WAS_CANCELLED_BY_CLIENT(Received 'Cancel' packet from the client, canceling the query.) rather than a broken pipe / connection reset. The socket-drop messages only fire when aSIGKILLlands while the server happens to be writing back to the client.thread_cancelpicksINTorKILLwith equal probability, so roughly half the cancellations produce no message the assertion recognizes, and theSIGKILLhalf matches only when the kill races a server-side write. Over the 40s run the margin is thin and the assertion occasionally observes zero matching messages, printing0instead of1.Fix: add the native-protocol cancellation messages to the matcher. Verified locally against a debug build with the test's cluster pointed at a single capped server:
SIGINTinterrupting an in-flight native distributed insert logs the cancel-packet message 11/12 times while matching the old filter 0/12 (directional proof: old assertion -> 0, the flaky failure; new assertion -> 1)..shtest passes 3/3 end-to-end (output500000 / 500000 / 1).Only the assertion's message list changes; the test's behavior and
.referenceare unchanged.Version info
26.6.1.1200