mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-06-24 12:21:58 +02:00
49cd44891a
Pending tasks were never drained from `pendingTasks` once `isShutDown == true` (since `poke` early-returns), and `finalizeTaskExecution` for currently-executing tasks is a deferred actor call that may not have run by the time `shutDown` returns. The retained `QueuedTask`s held their `TaskDescription`s, which transitively held `BuildServerManager`, `SemanticIndexManager`, and `ToolchainRegistry`, so a test that exited with indexing still in flight (`testTargetsAreIndexedInDependencyOrder` with `pollIndex: false`) reported 22 leaked objects rooted in the scheduler. Snapshot the in-flight tasks into a local, clear both queues, then cancel and wait. The local snapshot keeps the tasks alive long enough for cancellation to propagate; the early clear means the actor's storage is empty even if a `waitToFinish` hits its 10s timeout.