Data race involving non-Sendable
class may be induced when concurrently modified with task groups and actor isolation control
#78360
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
crash
Bug: A crash, i.e., an abnormal termination of software
triage needed
This issue needs more specific labels
Description
By combining task groups, actor isolation control (
isolated (any Actor)?
), and a small trampoline function, a data race may be induced at runtime through concurrent access and modification of aDictionary
. Swift isn't supposed to let this code compile. When certain elements of this test case are removed, then an error is correctly emitted.Reproduction
Stack dump
Expected behavior
The code fails to compile with a concurrency-related diagnostic.
Environment
swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0
Additional information
Removing the
await trampoline { … }
call correctly prevents compilation:However, even without the
trampoline
function, you can still induce a runtime crash by forwarding the actor isolation:This resultant binary compiled from this code also segfaults.
The
trampoline
function isn't as contrived as it seems because in the real code where the crash was occurring,trampoline
is actually a helper function that provides latency measurements by trivially wrapping async closures.This issue may very well be a duplicate of #76003 or #76016, but it might help with triage.
The text was updated successfully, but these errors were encountered: