Skip to content

[Subtask]: D05 [baseline] Close the taskRunner shutdown dependency between result producers and consumers #32283

Description

@XuPeng-SH

Parent Issue

Parent issue: #32278

Detail of Subtask

Catalog ID: D05
Origin: B - Pre-existing in the 4.2 baseline and retained on main
Evidence level: Reproduced shutdown hang

4.2 versus main: provenance

Both 4.2 and main release the parallelism token before an unconditional doneC send. Stop cancels producers and consumers through the same stopper, then closes doneC only after the stopper returns.

Design problem, impact, and existing responsibility

If the done consumer exits first, a producer that has finished business cleanup can block on the full channel. The stopper waits for that producer, while closing doneC depends on the stopper returning. The 30s stopper setting only logs outstanding tasks. CN stopTask and generation revocation call this Stop.

Acceptance criteria

  • Use two executors, queue capacity one, and releasable cleanup barriers: producers can exit and Stop returns even when the consumer exits first.
  • Cover full/empty queues, completion-storage failure, cancellation, generation revocation, and CN shutdown without leaks, double release, or send-on-closed.
  • Preserve normal completion reliability and identify the existing recovery path for results not persisted during shutdown.

Describe implementation you've considered

Define admission stop, execution termination, completion handoff, and consumer exit under the existing runner owner. Producers must terminate after cancellation while unfinished durable completion retains a recovery owner. Increasing channel capacity does not remove the wait cycle.

Additional information

Existing investigation and validation limits

Real Start/Stop with testing/synctest and exit barriers produces doneC=1/1, a producer blocked in addDoneTask, and a blocked Stop; a diagnostic receive releases it. A second boundary uses 257 concurrent executors and default capacity 256; concurrency is explicitly increased, so this is not a claim that default concurrency always hangs. Normal and 100 race repetitions confirm the counterexample.

main investigation snapshot: pkg/taskservice/task_runner.go:303; pkg/taskservice/task_runner.go:565; pkg/cnservice/server_task.go:301

4.2 baseline snapshot: pkg/taskservice/task_runner.go:301

The named probes are local diagnostic overlays, not committed repository tests. Their names identify the investigation; they cannot be selected directly from an ordinary checkout. Implement the smallest maintained contract regressions and reuse relevant CI/validation proportionally. Temporary evidence commits are not required.

Related existing work: #29371. Closed items identify implemented controls or historical context; they do not mean this subtask is already resolved.

Activity

  1. self-assigned this
    on Nov 5, 2026
  2. added theissue type on Nov 5, 2026
  3. changed the title [-][Subtask]: D05 [base] 闭合 taskRunner 完成生产者、消费者与 Stop 的关闭顺序[/-] [+][Subtask]: D05 [baseline] Close the taskRunner shutdown dependency between result producers and consumers[/+] on Nov 5, 2026
  4. added a commit that references this issue on Nov 21, 2026
    f1ffbaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions