Skip to content

CI's test run hangs until its 20-minute limit when blocked work fills Swift's thread pool #618

Closed

Description

@M4n0x

What happens

Since 11 November, six Test jobs never finished: Swift Testing stopped making progress a few minutes in, and the job was cancelled at its 20-minute limit without a failing test. On main this skips the beta: run 43212032624 on 11-12, which also held up a stable release, and 43407416688 on 11-13. Four pull request runs hung the same way: 43378851623, 43179792123, 43034798309 and 43031003135.

Steps to reproduce

Run either test with Swift's shared thread pool narrowed to one thread:

swift build --build-tests
LIBDISPATCH_COOPERATIVE_POOL_STRICT=1 swift test --skip-build --filter theDeadlineReturnsEvenWhileExecutableLookupIsStuck
LIBDISPATCH_COOPERATIVE_POOL_STRICT=1 swift test --skip-build --filter applicationMoveCapturesSessionEditsAfterCopying

Both hang every time (stopped after 60 s). With the normal pool they pass in 0.04 s and 0.15 s, and other tests from the same suites pass with one thread. On CI, the 3-core runner gives the pool 3 threads, and the run hangs whenever these tests' three cases run at the same time.

Expected

The test run finishes on any number of cores: no test blocks a thread of Swift's shared pool while it waits for work that needs one.

Environment

GitHub's macos-26 runner (3 cores) with Xcode 26.6, main at 9d60793. On a 10-core Mac it doesn't hang unless the pool is narrowed.

Evidence

The stack samples added by #604 (the test-results artifact of runs 43407416688 and 43378851623) show the main thread idle in its run loop and all three com.apple.root.default-qos.cooperative threads in DispatchSemaphore.wait:

  • two in applicationMoveCapturesSessionEditsAfterCopying(setup:), one per case: the stubbed copy waits on releaseCopy (Tests/StableBarTests/ApplicationMoverTests.swift:577). ApplicationMover.transfer (Sources/StableBar/ApplicationMover.swift:289) calls it from the Task.detached in ApplicationMoveController.proceed.
  • one in theDeadlineReturnsEvenWhileExecutableLookupIsStuck(): BlockedWorkspaceLookup.find() waits on its gate (Tests/StableBarTests/SetupWorkspaceConnectionTests.swift:536), called from SetupWorkspaceChecker.inspect (Sources/StableBar/SetupWorkspaceConnection.swift:104).

The four earlier hangs have no samples, but their logs list the same tests among those that never finished.

Diagnosis

Both tests stand in for slow blocking work that the app runs on Swift's shared pool: copying the app bundle and checking the copy's signature, and looking up yabai's or OmniWM's executable, which the code notes can stall on a disconnected network volume. The pool has one thread per core and never adds one for a blocked thread. The tests release their semaphores only after a Task.sleep wakes or setup's 3-second deadline task runs, and both of those need a pool thread. Once the three blocked cases hold all three threads, nothing runs again.

The app has the same exposure: a lookup stuck on a network volume keeps a pool thread for as long as it stays stuck, even after setup's check has given up at its deadline.

Fix: run this blocking work on a dispatch queue and await it through a continuation, so a blocked call holds a GCD thread, which GCD replaces, rather than a pool thread.

Related

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    bug
    on Nov 13, 2026
  2. stablebar-releases commented on Nov 14, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.15.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions