-
Notifications
You must be signed in to change notification settings - Fork 118
Avoid warning when enabling strict concurrency check #322
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
Conversation
|
@tomerd FYI and approval. Let me know if |
|
this seems reasonable to me. @fabianfett thoughts? |
|
looks sensible to me 👍 |
|
It looks like there are some errors I did not capture locally. First API change. Is there something I can do to tell the CI system this is indeed an intended API change ? The second set of errors seems to deal with strict concurrency checks. It is not specific to this branch / set of changes. The same errors are generated when building the main branch. I guess I should not care about these right now. Any idea how to address these ? |
fabianfett
left a comment
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 don't think we should land this, as this is fundamentally a Swift issue. The problem here is that Sendable checking is too aggressive in 5.10, as the compiler does not understand transfer semantics around actors. This will be fixed in Swift 6, with region based isolation.
As this introduces a requirement on lambda handlers that is not needed, I'm not in support of this patch.
This CI step isn't required. It is fine to be red. We use it as a warning signal. The only way to make it not red, is to not make breaking changes. But even then it sometimes has false positives. |
|
as per discussion with @fabianfett, let's not merge this change. It should be fixed in Swift 6.0 |
Avoid strict concurrency check warnings
Motivation:
My Lambda function is an actor to protect instances variables from race condition.
However, when I compile with
I receive this warning
What I understand from the error message is that
Eventmust beSendable. ButEventis an associated type on LambdaHandler, seehttps://github.com/swift-server/swift-aws-lambda-runtime/blob/main/Sources/AWSLambdaRuntimeCore/LambdaHandler.swift#L146
In this case, it is an
APIGatewayV2Requestwhich correctly implementsSendablebut it looks like the compiler can not detect that.Modifications:
I changed all occurences of
associatedtype Eventandassociatedtype OutputinLambdaHandler.swiftto add:Sendable.I did not check for Swift >=5.6 because I understand Swift 5.7 is the minimum version to compile the runtime.
Result:
No compiler warnings when using
Xswiftc -strict-concurrency=complete