Skip to content

[6.4] AsyncQueue: await dependencies concurrently to avoid priority inversion#58

Merged
ktoso merged 1 commit into
swiftlang:release/6.4.xfrom
rintaro:6.4-asyncqueue-concurrent-deps
May 28, 2026
Merged

[6.4] AsyncQueue: await dependencies concurrently to avoid priority inversion#58
ktoso merged 1 commit into
swiftlang:release/6.4.xfrom
rintaro:6.4-asyncqueue-concurrent-deps

Conversation

@rintaro
Copy link
Copy Markdown
Member

@rintaro rintaro commented May 27, 2026

Cherry-pick #57 into release/6.4.x

  • Explanation: Replaces the sequential for ... await dep.task.waitForCompletion() loop in AsyncQueue.swift with dependencies.concurrentForEach { ... }. Functionally equivalent for the dependency tasks themselves (which already run concurrently), but the await fan-out changes so that a priority escalation on the awaiting task propagates to every dependency at once instead of only the one currently being awaited.
  • Scope: AsyncQueue
  • Issues: rdar://178006261
  • Risk: Low. The change is semantically equivalent to the previous loop for dependency completion ordering. Worst case is a marginal allocation overhead from spawning a child task per dependency, which is negligible against the operations AsyncQueue is used for (indexing, request handling).
  • Testing: Passes current test cases
  • Reviewers: @hamishknight @owenv

A sequentially-awaited list of dependency tasks only propagates a
priority escalation to the dependency currently being awaited. The
rest stay at their original priority and can starve under load,
producing nondeterministic multi-minute hangs in tests that mix
self-serializing and non-self-serializing metadata (e.g. a serial
task waiting on many concurrent tasks).

Replace the sequential await with concurrentForEach so a priority
escalation on the running task reaches every dependency at once.

Speculative fix for rdar://178006261

(cherry picked from commit 24bfcfd)
@rintaro rintaro changed the title AsyncQueue: await dependencies concurrently to avoid priority inversion [6.4] AsyncQueue: await dependencies concurrently to avoid priority inversion May 27, 2026
@ktoso
Copy link
Copy Markdown
Contributor

ktoso commented May 28, 2026

only failure:


xcrun: error: missing DEVELOPER_DIR path: /Applications/Xcode_26.0.app
Error: Process completed with exit code 1.

using build wrangler powers to merge.

@ktoso ktoso merged commit 4288ac6 into swiftlang:release/6.4.x May 28, 2026
52 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants