Skip to content

[Distributed] Avoid infinite recursion in distributed thunk on protocol extensions #73032

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
merged 1 commit into from
Apr 15, 2024

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Apr 15, 2024

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

…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 added the distributed Feature → concurrency: distributed actor label Apr 15, 2024
@ktoso ktoso requested a review from xedin April 15, 2024 06:13
@ktoso
Copy link
Contributor Author

ktoso commented Apr 15, 2024

@swift-ci please smoke test

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a nit about method name and placement.

@ktoso
Copy link
Contributor Author

ktoso commented Apr 15, 2024

@swift-ci please smoke test

@ktoso ktoso enabled auto-merge (squash) April 15, 2024 07:53
@ktoso ktoso merged commit 460a030 into main Apr 15, 2024
@ktoso ktoso deleted the wip-distributed-witness-recursion branch April 15, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed Feature → concurrency: distributed actor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants