Repository navigation
Conversation
…ilesystem On filesystems where advisory locking is not supported (such as macOS SMB/smbfs mounts), `RandomAccessFile.lockSync` throws a `FileSystemException` with an OS error code indicating that locking is unsupported (e.g. `ENOTSUP` / 45, `ENOLCK` / 77, or `EINVAL` / 22). Previously, `FileSystemLocking.runLocked` only caught `UnimplementedError` and `UnsupportedError` to bypass locking. As a result, native `FileSystemException` errors on unsupported filesystems were treated as lock contention, causing Flutter commands (such as Swift Package Manager plugin resolution) to retry indefinitely in a 50ms polling loop with: "Waiting for another flutter command to release the Swift Package Manager lock..." This change inspects the OS error code in `runLocked`. If the error code indicates an error other than genuine lock contention (`EAGAIN`, `EACCES`, Windows sharing/lock violations), `runLocked` logs the exception to trace and proceeds with executing the scope without holding the lock. Fixes flutter#192802
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.
Description
On filesystems where advisory locking is not supported (such as macOS SMB/smbfs network mounts),
RandomAccessFile.lockSyncthrows aFileSystemExceptionwith an OS error code indicating that locking is unsupported (e.g.ENOTSUP/ 45,ENOLCK/ 77, orEINVAL/ 22).Previously,
FileSystemLocking.runLockedonly caughtUnimplementedErrorandUnsupportedErrorto bypass locking. Consequently, nativeFileSystemExceptionerrors on unsupported filesystems were treated as lock contention, causing Flutter commands (such as Swift Package Manager plugin resolution) to hang indefinitely in a 50ms polling loop with:This change inspects the OS error code in
runLocked. If the error code indicates that locking is unsupported rather than genuine lock contention (EAGAIN,EACCES, Windows sharing/lock violations),runLockedlogs the exception to trace and proceeds to execute the scope without holding the lock.Related Issues
Fixes #192802
Tests
test/general.shard/base/file_system_test.dartfor all unsupported error codes across macOS, Linux, and Windows, scope exception propagation, and contention retries.test/general.shard/macos/swift_package_manager_test.dartverifying thatgeneratePluginsSwiftPackageproceeds without locking or hanging on macOSENOTSUP(45).