-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Better handle HttpConnectionContext state transitions #8225
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
// Capture the connection state | ||
status = connection.Status; | ||
|
||
lastSeenUtc = connection.LastSeenUtc; |
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.
This fixes a potential race. Since there were no memory barriers before, it was theoretically possible to observe an Inactive status with a LastSeenUtc set long before the connection last became inactive. There's also the possibility of tearing without a lock.
@@ -100,8 +100,11 @@ public partial class HttpConnectionContext : Microsoft.AspNetCore.Connections.Co | |||
public System.Threading.SemaphoreSlim WriteLock { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } | |||
[System.Diagnostics.DebuggerStepThroughAttribute] | |||
public System.Threading.Tasks.Task DisposeAsync(bool closeGracefully = false) { throw null; } | |||
public void MarkInactive() { } |
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.
@davidfowl What's the deal with reference assemblies for pubternal classes? Do we really have to keep back compat? If so, should we just make everything new internal?
@BrennanConroy Ping. |
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.
Still have a flaky test
src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionManager.cs
Outdated
Show resolved
Hide resolved
src/SignalR/common/Http.Connections/src/Internal/HttpConnectionContext.cs
Outdated
Show resolved
Hide resolved
102aa7b
to
1810e77
Compare
da3caae
to
03e65d5
Compare
@BrennanConroy I added the test. |
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.
Looks good 👍
Possible alternative to #8114