Skip to content
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

Merged
merged 1 commit into from
Aug 28, 2020

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 27, 2020

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.

@ghost
Copy link

ghost commented Aug 27, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@karelz
Copy link
Member

karelz commented Aug 27, 2020

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.

@karelz
Copy link
Member

karelz commented Aug 27, 2020

Ready for your approval @ericstj

@ericstj
Copy link
Member

ericstj commented Aug 27, 2020

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?

@karelz
Copy link
Member

karelz commented Aug 27, 2020

Yes, @halter73 from ASP.NET team is ready to react to this change in RC1.

@geoffkizer
Copy link
Contributor

There's test code here that implements this API:

public override async ValueTask<Connection> AcceptAsync(IConnectionProperties options = null, CancellationToken cancellationToken = default)

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.

@karelz
Copy link
Member

karelz commented Aug 27, 2020

Good point @geoffkizer -- I don't think this has to be blocking 5.0 merge though, would you agree?
We can do it in 6.0 branch as test-only change and then consider porting it separately into 5.0 (depends on the bar).

@geoffkizer
Copy link
Contributor

I'm fine with that.

@karelz
Copy link
Member

karelz commented Aug 28, 2020

@ericstj it's ready for your approval now ...

Copy link
Member

@ericstj ericstj left a 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.

@CarnaViire CarnaViire merged commit 1dfd943 into release/5.0 Aug 28, 2020
@CarnaViire CarnaViire deleted the backport/pr-41442-to-release/5.0 branch August 28, 2020 09:00
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants