Skip to content
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

ComWrappers.GetOrCreateObjectForComInstance becomes expensive during the Get cached RCW scenario when called from multiple threads #90964

Closed
manodasanW opened this issue Aug 22, 2023 · 1 comment · Fixed by #91120
Labels
Milestone

Comments

@manodasanW
Copy link
Contributor

Description

From multiple different threads, do calls to ComWrappers.GetOrCreateObjectForComInstance to get the RCW for the same existing native object which has already been cached. Observe that the amount of time this takes can be pretty high due to the mutex in ExtObjCxtCache which causes it to become a one at a time operation to do the cached RCW lookup.

ExtObjCxtCache::LockHolder lock(cache);

Configuration

.NET 6

Regression?

No

@manodasanW manodasanW added the tenet-performance Performance related issue label Aug 22, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 22, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 22, 2023
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 9.0.0 milestone Aug 22, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Aug 22, 2023
@AaronRobinsonMSFT
Copy link
Member

The fix here would be to use a reader/writer lock instead of a mutex. We should consider this early in .NET 9.

/cc @agocke @jkoritzinsky

@AaronRobinsonMSFT AaronRobinsonMSFT removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 22, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 25, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 25, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants