Closed bernardnormier closed 1 week ago
I have been debugging this for a while, for IPv6 case I see
2 startAccept exception: System.ArgumentException: The supplied System.Net.SocketAddress is an invalid size for the System.Net.IPEndPoint end point. (Parameter 'socketAddress')
at System.Net.IPEndPoint.Create(SocketAddress socketAddress)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationAccept(SocketAddress remoteSocketAddress)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSyncSuccess(Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSync(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
at System.Net.Sockets.SocketAsyncEventArgs.DoOperationAccept(Socket _, SafeSocketHandle handle, SafeSocketHandle acceptHandle, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AcceptAsync(SocketAsyncEventArgs e, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.AcceptAsync(Socket socket, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AcceptAsync(Socket acceptSocket, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AcceptAsync()
at System.Net.Sockets.Socket.BeginAccept(AsyncCallback callback, Object state)
at Ice.Internal.TcpAcceptor.startAccept(AsyncCallback callback, Object state) in /Users/jose/Documents/3.8/connect-holding/csharp/src/Ice/Internal/TcpAcceptor.cs:line 49
Here startAsyncs from TcpAcceptor is throwing an ArgumentException, but the connection factory only handles Ice.LocalException
.
try
{
if (_acceptor.startAccept(completedCallback, this))
{
Console.WriteLine("start completed synchronously");
completedCallback(this);
}
}
catch (Ice.LocalException ex)
{
_acceptorException = ex;
completedCallback(this);
}
Handling the exception solves the shutdown hang. The acceptor is still closed as result of the exception and new connections are rejected.
Good, can you create a PR to fix this bug?
I'm unable to reproduce the ArgumentException with a simpler test case in plain .NET.
Sounds like https://github.com/dotnet/runtime/issues/102663 ?
Sounds like https://github.com/dotnet/runtime/issues/102663 ?
Yes. It is likely the same issue. I was able to reproduce the problem with a .NET debug build, and the test hits and assert in .NET. I reported the details in the dotnet/runtime issue issue with a possible workaround.
An object adapter in the Holding state keeps accepting connections by does not read them and does not send a ValidateConnection message until it's back in the Active state.
With this test: https://github.com/zeroc-ice/ice/compare/main...bernardnormier:connect-holding?expand=1
Furthermore, with IPv6, the server never shuts down (waitForShutdown never returns), because "_handler.pending" never reaches 0.
Partial server logging with comments for IPv4 (expected behavior):
Partial server logging with comments for IPv6 (unexpected behavior):
(All on macos)