Skip to content

Commit d4311cc

Browse files
[release/6.0] Fix AwaitableSocketAsyncEventArgs reorderings on weaker memory models (#51663)
* Fix AwaitableSocketAsyncEventArgs reorderings on weaker memory models * add comment --------- Co-authored-by: antonfirsov <[email protected]>
1 parent eec0dfe commit d4311cc

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
@@ -20,7 +20,11 @@ internal class SocketAwaitableEventArgs : SocketAsyncEventArgs, IValueTaskSource
2020

2121
private readonly PipeScheduler _ioScheduler;
2222

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

2529
public SocketAwaitableEventArgs(PipeScheduler ioScheduler)
2630
: base(unsafeSuppressExecutionContextFlow: true)

0 commit comments

Comments
 (0)