Repository navigation
fix(taskservice): unblock async completion on runner shutdown - #33040
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
This pull request is merged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 4ea9f1737a2e14d6362b901e130153727f425a96
Assessment: approve
The existing runner and stopper now cancel blocked completion sends and retry delays before Stop joins workers and drains their queues. Live generic completions still retry the same runner- and epoch-conditional write, and releasing the execution slot before handoff lets scheduled SQL publish through its own completion path. The shutdown and retry tests exercise both behaviors. HAKeeper retains recovery of generic rows when their assigned CN expires. The PR discussion adds no substantive concerns.
Model: gpt-6.2-sol / xhigh
Session: 01a1ee80-0d82-7030-a965-b51f496c3054 · slot 2 · generation 1
Validation:
-
Verified the clean frozen head, target and merge-base, complete patch, pinned policy, discussion coverage, and diff whitespace. Matched retained native inputs and passed the private /tmp and loopback preflight. Receipts checks/1795264149901998770-3.json, checks/1795264162225124208-2.json, and checks/1795264150307739242-89.json.
-
The complete pkg/taskservice suite passed under -race (taskservice-race.jsonl and taskservice-race.stderr, checks/1795264288807624835-2.json).
-
TestTaskRunnerStopWithFullCompletionQueue and TestTaskRunnerRetriesCompletionWithoutReexecuting each passed 100 individually selected race-detector repetitions (stop-race-repeat.jsonl and completion-retry-race-repeat.jsonl, checks/1795264398694831160-2.json and checks/1795264406484125050-2.json).
-
A retained, hashed overlay test passed under -race through the real runner with in-memory storage. With one completion in backoff and one execution retry parked, Stop canceled both contexts, released the parked slot, and left both uncommitted rows RUNNING (parked-retry-probe.stdout and parked-retry-probe.stderr, checks/1795264622598148602-2.json).
-
Passed the existing CN generation revocation tests for frontend shutdown ordering and in-flight runner start, the CN stopTask test, and HAKeeper TestReallocateExpiredTasks (runner-consumers.stdout and runner-consumers.stderr, checks/1795264576318155074-2.json).
Limitations:
-
The runner tests use in-memory storage and the CN and HAKeeper consumer checks exercise their components individually. A live multi-CN shutdown and recovery run was outside this local validation.
-
The supplied CI snapshot had the shared build and unit lanes in progress.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32282
Fixes #32283
Part of #32278.
What this PR does / why we need it:
When a stopped runner's completion queue is full, an executor can block while sending its result after the completion worker has stopped. The stopper waits for that executor, so CN shutdown or generation revocation can hang. The existing execution-slot release before completion handoff lets scheduled SQL continue through its independent completion path when generic writes stall.
The live backlog of generic results during a persistent storage failure is outside this shutdown fix. For generic results that remain uncommitted at shutdown, HAKeeper still marks the existing running row failed once the assigned CN leaves the working pool. The SQL task executor retains its existing completion and recovery ownership.
Validation
pkg/taskservice,pkg/cnservice, andpkg/hakeeper/taskon Linux with Go 1.27.1. The focused shutdown and retry scenarios passed 50 race repetitions, including shutdown during completion backoff with an execution retry parked.