Skip to content

[Distributed] fix distributed thunk method descriptor mangling in IRGen #81805

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented May 28, 2025

Description: While we mangle distributed thunks correctly in Mangler we did not update IRGenMangler to also handle them. This remained undiscovered until developers needed to use library evolution where these method descriptors are used, and the distributed_thunk descriptors would be mangled the same as the not-thunks, leading to duplicate symbols. This would result in .N suffixes and break the manled names in resilient witness tables.

Finally, this would manifest in runtime not being able to obtain a witness from the resilient witness table when library evolution is enabled, and causing null witnesses and crashes at runtime when attempting to make remote calls in such project.

This corrects the missing mangling part, which then corrects everything else implicitly -- since we no longer have duplicated symbols, and the thunks are uniqued correctly, everything falls into place and works well.

Scope/Impact: Distributed actors adopters which use library evolution. Specifically, attempts to make a remote call on a https://github.com/resolvable protocol would crash without this fix, making https://github.com/resolvable and the "server / client split" approach of distributed actors not usable at all with library evolution.

Risk: Low, the fix is very centralized to distributed thunks and sil witness tables of distributed protocol witnessing actors.

Testing: Added test verifying the emitted witness tables. Confirmed in real project hitting this problem that the solution is correct and resolves the crashes.

Radar: rdar://144568615 rdar://125628060

@ktoso ktoso marked this pull request as draft May 28, 2025 14:06
@ktoso
Copy link
Contributor Author

ktoso commented May 28, 2025

@swift-ci please smoke test

@ktoso ktoso requested a review from xedin May 28, 2025 14:13
@ktoso ktoso force-pushed the wip-distributed-fixes branch from 06cfe1c to 132ef47 Compare May 29, 2025 09:57
@ktoso ktoso changed the title [Distributed] fix distributed thunk witness handling [Distributed] fix distributed thunk IRGen mangling & behavior in library evolution May 29, 2025
@ktoso ktoso changed the title [Distributed] fix distributed thunk IRGen mangling & behavior in library evolution [Distributed][lib evo] fix distributed thunk IRGen mangling May 29, 2025
@ktoso
Copy link
Contributor Author

ktoso commented May 29, 2025

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented May 29, 2025

@swift-ci please test macOS

@ktoso ktoso marked this pull request as ready for review May 29, 2025 10:04
@ktoso ktoso changed the title [Distributed][lib evo] fix distributed thunk IRGen mangling [Distributed] fix distributed thunk method descriptor mangling in IRGen May 29, 2025
@ktoso
Copy link
Contributor Author

ktoso commented May 29, 2025

@swift-ci please smoke test Linux

@ktoso
Copy link
Contributor Author

ktoso commented May 29, 2025

@swift-ci please smoke test Windows

@ktoso
Copy link
Contributor Author

ktoso commented May 29, 2025

unrelated test failures, docc etc

@ktoso
Copy link
Contributor Author

ktoso commented May 29, 2025

@swift-ci please test Windows

@ktoso ktoso force-pushed the wip-distributed-fixes branch from 5c42e56 to bb70c1c Compare June 2, 2025 04:34
@ktoso
Copy link
Contributor Author

ktoso commented Jun 2, 2025

@swift-ci please smoke test

@ktoso ktoso force-pushed the wip-distributed-fixes branch from bb70c1c to a1b7242 Compare June 2, 2025 07:11
@ktoso
Copy link
Contributor Author

ktoso commented Jun 2, 2025

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented Jun 2, 2025

Unrelated lldb test failure: lldb-api :: functionalities/tsan/swift-access-race/TestTsanSwiftAccessRace.py

@ktoso
Copy link
Contributor Author

ktoso commented Jun 2, 2025

@swift-ci please smoke test macOS

@ktoso ktoso force-pushed the wip-distributed-fixes branch from a1b7242 to fb6453c Compare June 2, 2025 22:46
@ktoso
Copy link
Contributor Author

ktoso commented Jun 2, 2025

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented Jun 2, 2025

Cleaned up this PR a bit

@ktoso ktoso enabled auto-merge June 2, 2025 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants