-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[5.10][Concurrency] Isolated static lets are not safe to access across actors.
#69607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.10][Concurrency] Isolated static lets are not safe to access across actors.
#69607
Conversation
…tors. (cherry picked from commit 8eab5fe)
|
@swift-ci please test |
…tors. (cherry picked from commit 04be278)
|
@swift-ci please test |
|
@swift-ci please test |
|
|
||
| // Static 'let's are initialized upon first access, so they cannot be | ||
| // synchronously accessed across actors. | ||
| if (var->isGlobalStorage() && var->isLazilyInitializedGlobal()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this rule prohibits reasonable code from working and would like to discuss it further before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hborla has clarified that I misread the code, and this is already appropriate narrow in applicability.
|
|
||
| // Static 'let's are initialized upon first access, so they cannot be | ||
| // synchronously accessed across actors. | ||
| if (var->isGlobalStorage() && var->isLazilyInitializedGlobal()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hborla has clarified that I misread the code, and this is already appropriate narrow in applicability.
|
@swift-ci please test Linux |
lets synchronously across actors was being applied tostaticvariables. However,static letvariables are initialized upon first access, so synchronously accessing them across actors can lead to data races.letvariables that are lazily initialized.expression is 'async' but is not marked with 'await'if it accesses an isolatedstatic letfrom across isolation boundaries withoutawait.static lets are not safe to access across actors. #69598, [Concurrency] Isolated globallets are not safe to access across actors. #69616