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
If an ordinary async function calls an async actor-instance's method and then does some long-running work that does not interact with an actor, then that actor-instance can become indefinitely reserved, preventing other tasks from making progress. See attachment for minimal reproducer and expected output.
The text was updated successfully, but these errors were encountered:
Thanks for creating this issue and for the concise reproducer, @kavon! For a bit more context to what I asked on the forums:
I ran into this issue while migrating a Vapor code base to async/await. Some unit test methods are marked as async and call various other async methods, none of them actor isolated. The unit tests then also use some mock objects that used to be classes but that I migrated to actors (because they have mutable state and my understanding of Swift’s concurrency features makes me think that’s the right thing to do here). As soon as I migrated the mocks to actors, some calls to them caused the unit tests to hang. Those calls were simple property accesses like in print(await mock.requestCount)
This problem was resolved on main in this PR and in release/5.6 in this PR as part of SE-338
Just FYI: This issue is not resolved in Swift 5.6 as it ships with Xcode 13.4.0, as can be verified with the attached sample code. It is resolved in Swift 5.7 that ships with the Xcode 14 Betas, though.
Attachment: Download
Environment
macOS; reproduces on `main` and Swift 5.5
Additional Detail from JIRA
md5: 01e747a08c7538b6c2c29bcf7aa1d229
Issue Description:
If an ordinary async function calls an async actor-instance's method and then does some long-running work that does not interact with an actor, then that actor-instance can become indefinitely reserved, preventing other tasks from making progress. See attachment for minimal reproducer and expected output.
The text was updated successfully, but these errors were encountered: