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
Synchronize writing to connection and aborting connection #10043
Conversation
|
Help me understand this change? The description of the fix is a bit light on explanation. |
|
Servers could get error logs saying "Writing is not allowed after writer was completed" if the connection was closed while writing, especially when writing the ping message. This synchronizes the abort with the writing so we wont see error logs when writing would be expected to fail. |
|
Unit test? |
This reverts commit de2735a.
It's a race and there isn't anywhere to inject our own test code to force it. |
| @@ -173,7 +178,7 @@ public virtual ValueTask WriteAsync(HubMessage message, CancellationToken cancel | |||
| /// <returns></returns> | |||
| public virtual ValueTask WriteAsync(SerializedHubMessage message, CancellationToken cancellationToken = default) | |||
| { | |||
| if (_connectedAborted) | |||
| if (_connectionAborted) | |||
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.
Is there much reason to check _connectionAborted before acquiring the lock when we check immediately after? Presumably, if the connection is aborted, whoever has the lock shouldn't for long. I prefer removing redundant checks if possible.
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.
Agreed
|
Do we need to backport this? |
Worst case it's an erroneous error log. There is no functional issue here. Based on that I don't think we should, but open to other opinions. |
|
Looks like a legit test failures:
|
|
This comment was made automatically. If there is a problem contact aspnetcore-build@microsoft.com. I've triaged the above build. I've created/commented on the following issue(s) |
Fixes #6701
Verified perf didn't change.