You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assert.Equal() Failure
Expected: [::1]:53046
Actual: [::1]:53110
at System.Net.Sockets.Tests.LocalEndPointTest`1.TcpAcceptSocket_WhenServerBoundToSpecificAddress_LocalEPIsSame() in /_/src/libraries/System.Net.Sockets/tests/FunctionalTests/LocalEndPointTest.cs:line 162
--- End of stack trace from previous location ---
System.Net.Internals.SocketExceptionFactory+ExtendedSocketException : Socket is already connected 127.0.0.1:54400
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 3072
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 860
at System.Net.Sockets.Tests.SocketHelperArraySync.<>c__DisplayClass3_0.<ConnectAsync>b__0() in /_/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs:line 61
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/ExecutionContext.cs:line 294
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:line 2363
--- End of stack trace from previous location ---
at System.Net.Sockets.Tests.LocalEndPointTest`1.TcpAcceptSocket_WhenServerBoundToSpecificAddress_LocalEPIsSame() in /_/src/libraries/System.Net.Sockets/tests/FunctionalTests/LocalEndPointTest.cs:line 159
--- End of stack trace from previous location ---
Assert.Equal(GetLocalEPAddress(server),GetLocalEPAddress(accept));// accept -> same address
Assert.Equal(serverPort,GetLocalEPPort(accept));
A dual-mode client in that other test that is intended to connect to it's matching IPv4-only listener may then connect to the server of the failing test case. Since the sync connection request kicks in slowly (AcceptAsync starting on a threadpool thread), the failing test then accepts that other connection request in Task<Socket> acceptTask = AcceptAsync(server); before accepting of it's own client-s connection.
We can move the sync tests classes to a non-parallel collection as a quick fix attempt.
Activity
karelz commentedon May 7, 2021
Call stack:
Failures (3/12-7/22, incl. PRs):
Alternative / related callstack:
Failures (3/12-6/23, incl. PRs):
antonfirsov commentedon May 10, 2021
A possible explanation might be that this is yet another dual stack IPv4/IPv6 port-collision issue, caused by other test cases running in parallel.
runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/LocalEndPointTest.cs
Lines 152 to 165 in 01b7e73
A dual-mode client in that other test that is intended to connect to it's matching IPv4-only listener may then connect to the
serverof the failing test case. Since the sync connection request kicks in slowly (AcceptAsync starting on a threadpool thread), the failing test then accepts that other connection request inTask<Socket> acceptTask = AcceptAsync(server);before accepting of it's ownclient-s connection.We can move the sync tests classes to a non-parallel collection as a quick fix attempt.