Skip to content

Commit 4f7887d

Browse files
[release/7.0] Fix AwaitableSocketAsyncEventArgs reorderings on weaker memory models (#51662)
* Fix AwaitableSocketAsyncEventArgs reorderings on weaker memory models * add comment --------- Co-authored-by: antonfirsov <antonfir@gmail.com>
1 parent a2afc6a commit 4f7887d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketAwaitableEventArgs.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ internal class SocketAwaitableEventArgs : SocketAsyncEventArgs, IValueTaskSource
1818

1919
private readonly PipeScheduler _ioScheduler;
2020

21-
private Action<object?>? _continuation;
21+
// There are places where we read the _continuation field and then read some other state which we assume to be consistent
22+
// with the value we read in _continuation. Without a fence, those secondary reads could be reordered with respect to the first.
23+
// https://github.com/dotnet/runtime/pull/84432
24+
// https://github.com/dotnet/aspnetcore/issues/50623
25+
private volatile Action<object?>? _continuation;
2226

2327
public SocketAwaitableEventArgs(PipeScheduler ioScheduler)
2428
: base(unsafeSuppressExecutionContextFlow: true)

0 commit comments

Comments
 (0)