-
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
Restore exception compatibility in TcpListener.EndAccept*** #41745
Conversation
Tagging subscribers to this area: @dotnet/ncl |
{ | ||
return TaskToApm.End<TResult>(asyncResult); | ||
} | ||
catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted) |
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.
There could be other cases that cause this exception.
I think we should check explicitly for !_active before changing to ODE. That's what other routines here do.
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.
I'm wondering what are those other cases?
Anyways, I changed the line to catch (SocketException) when (!_active)
. Want to be equivalent with the old code.
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.
I'm wondering what are those other cases?
Possibly there aren't any. But it seems better to explicitly check _active, rather than just assume this is the only way that exception can happen.
/azp run runtime-libraries outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
@antonfirsov I didn't suggest any pushing out of 5.0 -- I just used correct milestone for the PR - which is in master and hence goes into 6.0. Once we have it merged, we can start porting it to 5.0 RC2 branch. |
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
LGTM
/backport to release/5.0-rc2 |
Started backporting to release/5.0-rc2: https://github.com/dotnet/runtime/actions/runs/243045182 |
#40476 changed
EndAcceptSocket
andEndAcceptTcpClient
to utilize the Task-basedSocket.AcceptAsync
implementation instead of the APM code path.This however introduced a breaking change for the exception being thrown when
listener.Stop()
has been called, closing the underlying socket between the calls toBeginAccept
andEndAccept
.According to the old code and the documentation, we should throw
ObjectDisposedException
here.Fixes #41585
/cc @geoffkizer