Skip to content

[6.0][Distributed] Avoid infinite recursion in distributed thunk on protocol extension #73033

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

Merged

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Apr 15, 2024

Description: Because of the new ways we handle distributed requirements to support distributed resolvable protocols, we now have protocol requirements for both the thunk and the real method. A distributed thunk inside a protocol extension now ended up calling "itself" through protocol witness, but instead should always call the "real" method.

Without this patch such situation would end up in an infinite recurstion executing such method from executeDistributedTarget when the method was a default impl provided by extension on a protocol.

This patch resolves this by becoming contextually aware of the distributed thunk, and allowing it to always call the "real" method.

Scope of the issue: The issue specifically affects Swift 6.x (since introduction of @_DistributedProtocol), and specifically distributed func declared in an extension of a protocol.
Risk: Low, no impact on other code than the described situation.
Testing: CI testing, manually verified the reproducer as well.
Reviewed by: @xedin

Original PR: #73032
Radar: rdar://125445347

…ol extensions

Because of the new ways we handle distributed requirements to support
distributed resolvable protocols, we now have protocol requirements for
both the thunk and the real method. A distributed thunk inside a
protocol extension now ended up calling "itself" through protocol
witness, but instead should always call the "real" method.

Without this patch such situation would end up in an infinite recurstion
executing such method from executeDistributedTarget when the method was
a default impl provided by extension on a protocol.

This patch resolves this by becoming contextually aware of the
distributed thunk, and allowing it to always call the "real" method.

resolves rdar://125445347
@ktoso ktoso requested a review from a team as a code owner April 15, 2024 06:46
@ktoso ktoso requested a review from hborla April 15, 2024 07:04
@ktoso ktoso changed the title [Distributed] Avoid infinite recursion in distributed thunk on protoc… [6.0][Distributed] Avoid infinite recursion in distributed thunk on protoc… Apr 15, 2024
@ktoso
Copy link
Contributor Author

ktoso commented Apr 15, 2024

@swift-ci please test

@ktoso ktoso changed the title [6.0][Distributed] Avoid infinite recursion in distributed thunk on protoc… [6.0][Distributed] Avoid infinite recursion in distributed thunk on protocol extension Apr 15, 2024
@ktoso ktoso added distributed Feature → concurrency: distributed actor 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Apr 15, 2024
@ktoso ktoso merged commit 339e8c6 into swiftlang:release/6.0 Apr 15, 2024
@ktoso ktoso deleted the pick-wip-distributed-witness-recursion branch April 15, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed Feature → concurrency: distributed actor 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants