You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This #103008 (comment) from @ManickaP made me double-check the thread-safety of our reading/parsing logic on HttpHeaders.
After #68115, concurrent reads on the header collection are thread-safe. All read operations will see the same values, and won't corrupt the underlying storage.
A minor exception to that is that while they will all see equivalent values, they may not be exactly the same objects. Since some header values are mutable, this could lead to observable differences later.
The fix would be to avoid overwriting the underlying storage with different HeaderStoreItemInfo instances. The simplest way would be via an Interlocked.CompareExchange here:
This #103008 (comment) from @ManickaP made me double-check the thread-safety of our reading/parsing logic on
HttpHeaders
.After #68115, concurrent reads on the header collection are thread-safe. All read operations will see the same values, and won't corrupt the underlying storage.
A minor exception to that is that while they will all see equivalent values, they may not be exactly the same objects. Since some header values are mutable, this could lead to observable differences later.
Simple repro:
The fix would be to avoid overwriting the underlying storage with different
HeaderStoreItemInfo
instances. The simplest way would be via anInterlocked.CompareExchange
here:runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs
Line 739 in 7ffb9a4
and here
runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs
Lines 352 to 360 in 7ffb9a4
The text was updated successfully, but these errors were encountered: