-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[release/5.0] Allow ConnectionListener.AcceptAsync() to return null #41453
Conversation
Tagging subscribers to this area: @dotnet/ncl |
I support this change to be ported to 5.0 -- it is feedback from adoption in Kestrel, which is blocking them to achieve their goals. |
Ready for your approval @ericstj |
Do we have any implementations of this abstract class in runtime or aspnetcore that need to react to this change? Are they prepared to react to this in time for RC1? |
Yes, @halter73 from ASP.NET team is ready to react to this change in RC1. |
There's test code here that implements this API: Line 56 in 8b5467e
This code is used in Connection tests, possibly elsewhere. I assume this didn't break because it's just a nullability change, but we should fix it regardless. And we should fix the behavior of the test code to return null when disposed and validate this. |
Good point @geoffkizer -- I don't think this has to be blocking 5.0 merge though, would you agree? |
I'm fine with that. |
@ericstj it's ready for your approval now ... |
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.
Thanks for addressing my concerns around reacting to the change.
Backport of #41442 to release/5.0
As it was discussed in #41304, with current System.Net.Connections APIs, listeners need to throw from AcceptAsync when shutting down since AcceptAsync cannot return null. This PR allows AcceptAsync to return null, to avoid unnecessary first-chance exceptions when listeners are gracefully shutting down.
Customer Impact
It's all about usability. A server will always have a loop accepting new connections, until the server is shutdown. So, handling that via returning null is far better than throwing an exception -- we shouldn't make handling an exception part of the standard non-error path.
Testing
N/A
Risk
There is no implementation, and we are only relaxing nullability. Risk is low.