mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-08-12 18:24:46 +00:00
executeSubtask called the pool-wide CommentWorkerPool.Await() from each per-file goroutine before running the review filter, while other files' tool-use loops were still calling Submit(). The pool's own contract forbids Await concurrent with Submit: both use the same sync.WaitGroup, so an Add landing while Wait is blocked panics with "Add called concurrently with Wait" or "WaitGroup is reused before previous Wait has returned". The panic is recovered by the subtask wrapper, so the symptom is a spurious per-file failure (or, depending on the interleaving, a corrupted counter that hangs the final Await). Add SubmitFor/AwaitKey so a caller can drain only the units submitted under one key. The review path keys submissions by the reviewed file's path: a file's loop submits all its async comment work before its AwaitKey runs, so the per-key WaitGroup Add/Wait pairing is race-free, and draining no longer waits for (or crashes into) other files' in-flight submissions. The pool-wide Await remains for the end-of-run call sites, where all submissions have finished. |
||
|---|---|---|
| .. | ||
| compression.go | ||
| compression_test.go | ||
| init_test.go | ||
| loop.go | ||
| loop_test.go | ||
| pool.go | ||
| pool_test.go | ||
| runner_test.go | ||