You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Tool] Concurrency & Race Conditions in SwiftPM Integration #188446
This issue is one of the top crashers identified in the Flutter 3.44.3 stable release.
The Flutter tool experiences a race condition when preparing the Swift Packages directory during parallel Xcode builds, leading to FileSystemException (OS Error: Directory not empty, errno = 66) or PathExistsException.
Root Cause
In swift_package_manager.dart, generatePluginsSwiftPackage deletes and recreates project.relativeSwiftPackagesDirectory (ephemeral/Packages). Parallel Xcode targets (e.g., main app and extensions) invoke the Flutter tool concurrently, leading to destructive races where one process deletes the directory while another is writing to it.
Proposed Solution
Introduce process-safe file locking (.swift_pm.lock) with retries to serialize directory preparation.
Implement non-destructive, incremental cleanup of the directory (only deleting stale symlinks/files instead of the entire directory).
Implement content-aware write skipping for Package.swift and placeholder source files to avoid redundant writes and prevent unnecessary Xcode project re-indexing.
changed the title [-]Concurrency & Race Conditions in SwiftPM Integration[/-][+][Tool] Concurrency & Race Conditions in SwiftPM Integration[/+]on Jun 23, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
[-]Concurrency & Race Conditions in SwiftPM Integration[/-][+][Tool] Concurrency & Race Conditions in SwiftPM Integration[/+][Tool] Fix SwiftPM race condition during parallel Xcode builds (flutt…
[CP-stable][Tool] Fix SwiftPM race condition during parallel Xcode bu…
github-actions commentedon Aug 21, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.