-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Make the lazy assignment of an assoociated type/wtable atomic #31768
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
Make the lazy assignment of an assoociated type/wtable atomic #31768
Conversation
@swift-ci Please test. |
FWIW, we are still seeing TSan failures related to the metadata cache with this patch applied, e.g.
|
I think you might want to still do some sort of lock on the slow path. Like so:
Otherwise, the slow path will get called twice. |
Do you still have the original report around? TSan reports generally talk about multiple accesses, and it's important to include all of them. It's likely there are multiple bugs. For example, the original bug you reported did not superficially involve any associated types or conformances. Is this report related to that bug (which you reported as SR-12761) or to the one I'm directly trying to fix (SR-12760)? |
I don't mind the slow path getting called twice. Note that the slow path for associated type metadata doesn't even always cache its result. We rely on the slow path being confluent. Anyway, adding locks would be problematic. We have a very specific concurrency-control scheme here, and as with most concurrency-control schemes, it cannot always be safely hybridized with another scheme without introducing deadlocks. |
Here is a dump of the tsan results for the reproducer from SR-12760 with this change patched in: |
If I understand those results correctly, it's saying that |
Should fix SR-12760.
46a8c1e
to
6200df1
Compare
@swift-ci Please test. |
Build failed |
Build failed |
@swift-ci Please test Windows |
Should fix SR-12760.