-
Notifications
You must be signed in to change notification settings - Fork 5k
[release/8.0-staging] Back port logical equivalent of #102838 #113230
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR backports a logical fix from .NET 9 to .NET 8 to ensure that store refreshes occur only when needed by reassigning local state after acquiring the lock.
- In OpenSslCachedSystemStoreProvider.cs, the locals ret and elapsed are assigned immediately after acquiring the lock.
- In OpenSslCachedDirectoryStoreProvider.cs, similar assignments ensure that the native collection and elapsed time reflect the most up-to-date information.
Reviewed Changes
File | Description |
---|---|
OpenSslCachedSystemStoreProvider.cs | Assigning s_nativeCollections and s_recheckStopwatch.Elapsed to local variables to avoid stale data during refresh logic. |
OpenSslCachedDirectoryStoreProvider.cs | Updates are applied to ensure that the store's native collection state and elapsed time are captured inside the lock. |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
/ba-g Failures were infrastructure, and not even on configurations that run this code. |
This is a logical back port of #102838. The store providers went through a significant refactoring in .NET 9, so the changes would not back port cleanly to .NET 8.
/cc @bartonjs
Customer Impact
Reported by a customer in #113227 asking to apply the same fix in #102838. When the OpenSSL system and directory stores needed to be refreshed, a lock is taken. However, when the thread acquired the lock, the information about needing to refresh the store is stored in a local. This would lead to all threads that wait on the lock performing a store refresh because the locals were not updated after the lock was acquired.
The fix is to re-assign the locals with up-to-date information after the lock is taken.
Regression
No.
Testing
Existing tests ensure no functional changes are introduced.
Risk
Low. A similar fix was made for .NET 9. The change is isolated and simple to reason about.