Reenable concurrent OOP sync sharing.#60758
Merged
CyrusNajmabadi merged 10 commits intodotnet:mainfrom Apr 15, 2022
Merged
Conversation
CyrusNajmabadi
commented
Apr 14, 2022
| internal partial class SolutionAssetStorage | ||
| { | ||
| internal readonly struct Scope : IDisposable | ||
| internal class Scope : IDisposable |
Contributor
Author
There was a problem hiding this comment.
needs to be a class to use ReferenceCountedDisposable.
This was referenced Apr 14, 2022
dibarbet
approved these changes
Apr 15, 2022
Contributor
Author
|
i'm going to wait on merging htis until we insert the fix in #60753 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new design pushes the concurrency detection to the host instead. On hte host side, we look to see if we're concurrently making feature requests for the same solution checksums. If so, those concurrent features share the same PinnedSolutionInfo and Scope objects (in a ref counted fashion so that they stay alive as long as any of the requests is still in flight).
Then, on the OOP side, we just have a mapping from ScopeId to the in-flight operation to sync it. Any OOP operations that then are working on the same scope-Id (which means they're sharing the same pinned info on the host side) can then share teh same sync operation on the OOP side.
This is safe as hte host side can only clean up if all concurrent features on the same checksum cancel/finish. Only then does the pinned scope on the host side go away. But tahts' ok as all the features on the OOP side that might care are themselves cancelled/finished.
Note: @dibarbet suggested a nice simplification where we no longer use scope-ids, but instead use solution-checksums. That change will come in a follow-up PR to keep things simple here.