[6.4] Fix AsyncQueue cleanup leak and dependency metadata bug#53
Merged
rintaro merged 2 commits intoMay 22, 2026
Merged
Conversation
- Wrap PendingTask removal in `defer` so a thrown or cancelled operation no longer leaves stale entries in `tasksByMetadata`. - The "depend only on the bucket's last task" optimization checked `metadata.isDependency(of: metadata)` (the new task's self-dep) instead of `pendingMetadata.isDependency(of: pendingMetadata)` (the bucket's). With cross-metadata dependencies, the new task could start before earlier concurrent tasks in that bucket. (cherry picked from commit ae2e9df)
978cc09 to
c09ebad
Compare
Verifies the bucket-self-dependency optimization waits on every entry in the bucket, not just the last. (cherry picked from commit 151e6fc)
c09ebad to
4b06670
Compare
hamishknight
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick #52 (minus
Mutexmigration) intorelease/6.4.xAsyncQueue:tasksByMetadatawhen the operation threw or the task was cancelled. Cleanup was placed afteroperation()instead of in adefer, so the dictionary grew unboundedly per failed task.metadata.isDependency(of: metadata)(the new task's self-dependency) instead ofpendingMetadata.isDependency(of: pendingMetadata)(the bucket's). When the new task was self-serializing but its dependency bucket was not, the new task could start before earlier concurrent tasks in that bucket finished.AsyncQueue(request handling queues and background index scheduling in sourcekit-lsp)defer; no behavior change for the success path.