Repository navigation
fix: keep blocking work off Swift's shared thread pool - #619
Conversation
Copying StableBar to Applications and looking up yabai's or OmniWM's executable blocked a thread of Swift's shared pool, which has one thread per core and never replaces a blocked one. Their tests block that work on purpose. On CI's 3-core runner, the three blocked cases could take every pool thread while waiting for work that needed one, and the test run hung until the job's 20-minute limit. BlockingWork.run now runs that work on a GCD queue, which adds a thread when one blocks. Both tests check that their blocking stub runs off the pool, so a regression fails at once on any Mac instead of hanging CI now and then. Fixes #618
Add the rule to the test rules in AGENTS.md and to DECISIONS.md. Refs #618
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: High Merge Risk:
|
Before and after
|
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
scenes/accessibility-guide-light
| Before | After |
|---|---|
![]() |
![]() |
Difference, changed pixels in red:
146 unchanged screens
docs/essentials-clock-settings-dark, docs/essentials-clock-settings-light, docs/essentials-dark, docs/essentials-light, docs/essentials-settings-dark, docs/essentials-settings-light, docs/hero-dark, docs/hero-light, docs/popups-dark, docs/popups-light, docs/settings-dark, docs/settings-light, docs/themes-dark, docs/themes-light, scenes/app-menu-popup-dark, scenes/app-menu-popup-light, scenes/apple-menu-settings-dark, scenes/apple-menu-settings-light, scenes/bottom-bar-popup-dark, scenes/bottom-bar-popup-light, scenes/chat-popup-dark, scenes/chat-popup-light, scenes/crowded-edit-bar-dark, scenes/crowded-edit-bar-light, scenes/dock-badges-bar-dark, scenes/dock-badges-bar-light, scenes/edit-bar-wide-group-dark, scenes/edit-bar-wide-group-light, scenes/essentials-clock-popup-dark, scenes/essentials-clock-popup-light, scenes/gruvbox-bar-dark, scenes/gruvbox-bar-light, scenes/horizontal-list-popup-dark, scenes/horizontal-list-popup-light, scenes/increase-contrast-bar-dark, scenes/increase-contrast-bar-light, scenes/increase-contrast-popup-dark, scenes/increase-contrast-popup-light, scenes/input-source-popup-dark, scenes/input-source-popup-light, scenes/notch-flare-bar-dark, scenes/notch-flare-bar-light, scenes/privacy-both-bar-dark, scenes/privacy-both-bar-light, scenes/privacy-hide-when-idle-bar-dark, scenes/privacy-hide-when-idle-bar-light, scenes/privacy-idle-bar-dark, scenes/privacy-idle-bar-light, scenes/privacy-microphone-bar-dark, scenes/privacy-microphone-bar-light, scenes/privacy-settings-dark, scenes/privacy-settings-light, scenes/reduce-transparency-bar-dark, scenes/reduce-transparency-bar-light, scenes/reduce-transparency-glass-bar-dark, scenes/reduce-transparency-glass-bar-light, scenes/settings-bar-dark, scenes/settings-bar-light, scenes/settings-bar-placement-bottom-dark, scenes/settings-bar-placement-bottom-light, scenes/settings-bar-placement-dark, scenes/settings-bar-placement-light, scenes/settings-crashes-dark, scenes/settings-crashes-light, scenes/settings-feedback-dark, scenes/settings-feedback-light, scenes/settings-general-dark, scenes/settings-general-light, scenes/settings-general-macos15-dark, scenes/settings-general-macos15-light, scenes/settings-general-move-dark, scenes/settings-general-move-failed-dark, scenes/settings-general-move-failed-light, scenes/settings-general-move-light, scenes/settings-general-move-moving-dark, scenes/settings-general-move-moving-light, scenes/settings-general-move-replace-dark, scenes/settings-general-move-replace-light, scenes/settings-general-setup-open-dark, scenes/settings-general-setup-open-light, scenes/settings-general-spaces-dark, scenes/settings-general-spaces-light, scenes/settings-help-dark, scenes/settings-help-light, scenes/settings-help-starred-dark, scenes/settings-help-starred-light, scenes/settings-narrow-dark, scenes/settings-narrow-light, scenes/settings-package-dark, scenes/settings-package-light, scenes/settings-package-widget-dark, scenes/settings-package-widget-light, scenes/settings-theme-dark, scenes/settings-theme-light, scenes/settings-uninstall-dark, scenes/settings-uninstall-failed-dark, scenes/settings-uninstall-failed-light, scenes/settings-uninstall-light, scenes/settings-widget-backgrounds-dark, scenes/settings-widget-backgrounds-light, scenes/settings-workspace-hidden-dark, scenes/settings-workspace-hidden-light, scenes/setup-look-below-menu-bar-dark, scenes/setup-look-dark, scenes/setup-look-no-notch-dark, scenes/setup-move-existing-dark, scenes/setup-move-failed-dark, scenes/setup-move-ready-dark, scenes/setup-move-replace-dark, scenes/setup-omniwm-connection-dark, scenes/setup-permissions-dark, scenes/setup-permissions-spaces-dark, scenes/setup-permissions-spaces-ready-dark, scenes/setup-placement-bottom-dark, scenes/setup-placement-dark, scenes/setup-touches-dark, scenes/setup-touches-macos15-dark, scenes/setup-touches-spaces-dark, scenes/setup-try-dark, scenes/setup-yabai-connection-dark, scenes/slider-end-stop-popup-dark, scenes/slider-end-stop-popup-light, scenes/stablebar-widget-bar-dark, scenes/stablebar-widget-bar-light, scenes/stablebar-widget-settings-dark, scenes/stablebar-widget-settings-light, scenes/starter-bar-dark, scenes/starter-bar-light, scenes/starter-edit-bar-dark, scenes/starter-edit-bar-light, scenes/system-monitor-memory-bar-dark, scenes/system-monitor-memory-bar-light, scenes/system-monitor-shows-settings-dark, scenes/system-monitor-shows-settings-light, scenes/update-popup-dark, scenes/update-popup-light, scenes/update-popup-star-github-cli-dark, scenes/update-popup-star-github-cli-light, scenes/update-popup-star-thanks-dark, scenes/update-popup-star-thanks-light, scenes/workspace-badges-bar-dark, scenes/workspace-badges-bar-light, scenes/workspace-focused-window-bar-dark, scenes/workspace-focused-window-bar-light, scenes/workspace-hidden-apps-bar-dark, scenes/workspace-hidden-apps-bar-light
Visual review: 2 changed screens approved.
|
🎉 This PR is included in version 0.15.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
…656) Swift Testing runs about 900 tests at once on CI, nearly all on the main actor, so a test can wait seconds for its next turn. Three tests bounded such a wait with the clock: - Scenes gave their views 60 seconds to get ready. The package scene's views need many main-actor turns; it took 46 to 70 seconds in passing runs and failed three runs since #619. The wait now counts 600 checks a tenth of a second apart, still about a minute when nothing else runs. - The event burst test timed out its startup command after 4 seconds, before the test released it. A later command cleared the error and left a log without end:startup. - The widget actions test's first action had 60 seconds, which a 61-second hold also beat. Both held commands now get 120 seconds, like the cancellation test's command.






Problem
Since 11 November, six CI Test jobs have hung until the 20-minute limit, two of them on
main, where the beta was skipped. Two tests block slow work on purpose, and the app ran that work on Swift's shared thread pool, which has one thread per core and never replaces a blocked one. On the 3-core runner, the three blocked test cases could take every pool thread while waiting for work that needed one. #618 has the stack samples and the diagnosis.Fixes #618
Changes
BlockingWork.run(new) runs blocking work on a GCD queue and awaits it. GCD adds a thread when one blocks.ApplicationMovercopies, verifies and un-quarantines the new copy through it.SetupWorkspaceCheckerlooks up yabai's or OmniWM's executable through it, so a lookup stuck on a network volume no longer holds a pool thread after setup's check has given up at its deadline.applicationMoveCapturesSessionEditsAfterCopyingandtheDeadlineReturnsEvenWhileExecutableLookupIsStuckcheck that their blocking stub runs off the pool, so a regression fails at once on any Mac instead of hanging CI now and then.blockingWorkRunsOffSwiftsPoolchecks that the pool check itself tells the two apart.Testing
main(9d60793), both tests hang every time with Swift's pool narrowed to one thread (LIBDISPATCH_COOPERATIVE_POOL_STRICT=1), stopped after 60 s, while other tests from the same suites pass.swift test): XCTest 308 tests, 0 failures. Swift Testing: 924 tests with 6 issues, all inpinnedPopupsStayOnScreenAndReturnUnderTheirWidgetandshiftReturnStartsANewLineInAnInputThatWrapsAndReturnSends. My screen was locked with the display asleep. Both tests fail the same way without these changes, and they pass on CI.swift test --filter 'ApplicationMove|applicationMove|SetupWorkspace|BlockingWork': 90 tests pass.scripts/check.sh --quickand commitlint pass.No visible change, so no screenshots.
Merging
Merge commit: one
fixcommit for the app and tests and onedocscommit for the rule. The fix changes app code, so it ships in the next beta.Claude Opus 5.5 via Claude Code