Repository navigation
Fix flaky test 05239_workload_drop_memory_reservation_in_use - #127158
Conversation
Since ClickHouse#123341, DROP WORKLOAD purges the dropped workload's queue: the running query's memory reservation fails with MEMORY_RESERVATION_FAILED ("Allocation queue is about to be destructed") at its next sync, which for sleepEachRow(1) with max_block_size 1 is the end of the current 1-second step. When that step ends between DROP WORKLOAD and KILL QUERY, the query is already gone and KILL matches nothing. That was a silent no-op until ClickHouse#125968 made kill_throw_if_noop default to true; now KILL writes NOTHING_TO_KILL to stderr and the test fails with "having stderror" (master 3eecd13, amd_asan_ubsan). The failing purge is the intended behavior (covered by the MemoryReservationDropWorkloadFailsRunningAllocation gtest), so the test now tolerates a no-op KILL with kill_throw_if_noop = false, the idiom of 03824 and 04726, and its comment states the current semantics. Other KILL errors still reach stderr, and the reservation is destroyed after the purge in both branches. Validated on the CI binaries of 3eecd13: amd_asan_ubsan unmodified 7/30 FAIL (all NOTHING_TO_KILL), fixed 50/50 OK with 17 runs in the drop-failed branch; amd_debug with sleep 1.5 injected between DROP and KILL: unmodified 10/10 FAIL, fixed 10/10 OK; plain fixed 50/50 OK. Co-Authored-By: Claude Opus 5.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 the diff (0 findings).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261021-110300 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20261021-102300 |
|
cc @serxa, could you review this and add the |
|
Workflow [PR], commit [867b588] Summary: ✅ AI ReviewSummaryThe PR fixes a race in Missing context / blind spots
Final VerdictStatus: ✅ Approve. |
|
Make sure it is green and ping me |
|
CI has not started yet: the PR has no |
c951088
Cherry pick #127158 to 26.10: Fix flaky test `05239_workload_drop_memory_reservation_in_use`
…_reservation_in_use`
Backport #127158 to 26.10: Fix flaky test `05239_workload_drop_memory_reservation_in_use`
…6.8-123341 Resolve the conflicts of #123341: - This branch still has `TimeShared/FifoQueue.h` instead of `TimeShared/RequestQueue.h`, so the change to `RequestQueue::purgeQueue` goes to `FifoQueue::purgeQueue`. - `WorkloadNode.h`: keep the branch's `FifoQueue` comment and add `queue_dropped`. - Take master's `05239_workload_drop_memory_reservation_in_use.sh`, which includes the follow-up fix #127158 (`kill_throw_if_noop = false`). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…6.9-123341 Resolve the conflicts of #123341: - This branch still has `TimeShared/FifoQueue.h` instead of `TimeShared/RequestQueue.h`, so the change to `RequestQueue::purgeQueue` goes to `FifoQueue::purgeQueue`. - `WorkloadNode.h`: keep the branch's `FifoQueue` comment and add `queue_dropped`. - Take master's `05239_workload_drop_memory_reservation_in_use.sh`, which includes the follow-up fix #127158 (`kill_throw_if_noop = false`). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #123341
Related: #125968
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required.
Description
Stateless tests (amd_asan_ubsan, db disk, distributed plan, sequential, 3/3)on master3eecd139failed withhaving stderror:KILL QUERY ... SYNCgotCode: 785 ... No query to kill. (NOTHING_TO_KILL). No related open issue found.Two merged changes interact. Since #123341,
DROP WORKLOADpurges the dropped workload's queue, so the running query's memory reservation fails withMEMORY_RESERVATION_FAILED(Allocation queue is about to be destructed) at its next sync after the drop. That is intended:MemoryReservationDropWorkloadFailsRunningAllocationin #123341 asserts it. When the query's 1-second step ends betweenDROP WORKLOADandKILL, the query is already gone whenKILLruns. That used to be a silent no-op, but #125968 madekill_throw_if_noopdefault to true, so theKILLnow throws. In the failing job's server log the query fails 95 ms after the drop and theKILLruns about 370 ms later.The
KILLnow passeskill_throw_if_noop = false, as03824and04726already do, and the comment states the current behavior. Any otherKILLerror still reaches stderr, a query that cannot be killed still hangs the test, and the reservation is still destroyed after the purge in both branches.Validation, on the CI binaries of
3eecd139with randomized settings:amd_asan_ubsan: unmodified test 7/30 FAIL, allNOTHING_TO_KILL; new test 50/50 OK, with 17 of the 50 runs taking the drop-failed branch.amd_debugwithsleep 1.5injected betweenDROP WORKLOADandKILL: unmodifiedKILL10/10 FAIL, newKILL10/10 OK, each run's query failing withMEMORY_RESERVATION_FAILEDfirst. Plain new test 50/50 OK.Workflow [PR]
Sync PR [sync-upstream/pr/127158]
Version info
26.11.1.561-master(included in26.11and later)26.10.2.83