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

LocalEndPointTestIPv6Sync.TcpAcceptSocket_WhenServerBoundToSpecificAddress_LocalEPIsSame failing #52141

Closed
runfoapp bot opened this issue Apr 30, 2021 · 4 comments · Fixed by #56399
Closed
Assignees
Labels
area-System.Net.Sockets test-bug Problem in test source code (most likely) test-run-core Test failures in .NET Core test runs
Milestone

Comments

@runfoapp
Copy link

runfoapp bot commented Apr 30, 2021

Runfo Tracking Issue: LocalEndPointTestIPv6Sync.TcpAcceptSocket_WhenServerBoundToSpecificAddress_LocalEPIsSame failing

Build Definition Kind Run Name
1116477 runtime PR 52128 net6.0-Linux-Debug-x64-Mono_release-(Centos.8.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759
1113740 runtime PR 52046 net6.0-Linux-Debug-x64-Mono_release-(Debian.10.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006

Build Result Summary

Day Hit Count Week Hit Count Month Hit Count
1 2 2
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net untriaged New issue has not been triaged by the area owner labels Apr 30, 2021
@ghost
Copy link

ghost commented Apr 30, 2021

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

Issue Details

Runfo Creating Tracking Issue (data being generated)

Author: runfoapp[bot]
Assignees: -
Labels:

area-System.Net, untriaged

Milestone: -

@karelz karelz added the test-run-core Test failures in .NET Core test runs label May 6, 2021
@karelz karelz added this to the 6.0.0 milestone May 6, 2021
@karelz karelz removed the untriaged New issue has not been triaged by the area owner label May 6, 2021
@karelz
Copy link
Member

karelz commented May 7, 2021

Call stack:

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 ---

Failures (3/12-7/22, incl. PRs):

Run Date OS
Official run 4/2 Debian.9.Amd64.Open - CoreCLR
PR #50929 4/9 Debian.9.Amd64.Open - Mono
PR #49526 4/24 Ubuntu.1804.ArmArch.Open - Mono
PR #52046 4/29 ubuntu.1604.amd64.open - Mono
PR #52003 4/29 RedHat.7.Amd64.Open - CoreCLR
PR #52128 4/30 Ubuntu.1604.Amd64.Open - Mono
PR #52475 5/8 Centos.8.Amd64.Open - Mono
PR #52510 6/7 Ubuntu.1804.ArmArch.Open - Mono
PR #53645 6/14 Ubuntu.1804.Amd64.Open - Mono
PR #54436 6/18 Fedora.30.Amd64.Open - Mono
PR #54822 7/1 SLES.15.Amd64.Open - Mono
PR #54253 7/2 Fedora.30.Amd64.Open - CoreCLR
PR #55101 7/11 Fedora.30.Amd64.Open - Mono
PR #52244 7/15 Fedora.32.Amd64.Open - Mono
PR #52244 7/19 Centos.8.Amd64.Open - CoreCLR

Alternative / related callstack:

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 ---

Failures (3/12-6/23, incl. PRs):

Run Date OS
PR #51763 4/27 OSX.1014.Amd64.Open - CoreCLR

@antonfirsov
Copy link
Member

antonfirsov commented 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.

int serverPort = server.BindToAnonymousPort(Loopback);
Assert.Equal(Loopback, GetLocalEPAddress(server)); // server -> specific before accept
server.Listen();
Task<Socket> acceptTask = AcceptAsync(server);
await ConnectAsync(client, new IPEndPoint(Loopback, serverPort));
Socket accept = await acceptTask;
Assert.Equal(accept.RemoteEndPoint, client.LocalEndPoint);
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.

@ghost
Copy link

ghost commented Jul 26, 2021

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

Issue Details

Runfo Tracking Issue: LocalEndPointTestIPv6Sync.TcpAcceptSocket_WhenServerBoundToSpecificAddress_LocalEPIsSame failing

Build Definition Kind Run Name
1116477 runtime PR 52128 net6.0-Linux-Debug-x64-Mono_release-(Centos.8.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759
1113740 runtime PR 52046 net6.0-Linux-Debug-x64-Mono_release-(Debian.10.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006

Build Result Summary

Day Hit Count Week Hit Count Month Hit Count
1 2 2
Author: runfoapp[bot]
Assignees: antonfirsov
Labels:

area-System.Net.Sockets, test bug, test-run-core

Milestone: 6.0.0

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 27, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 30, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Sockets test-bug Problem in test source code (most likely) test-run-core Test failures in .NET Core test runs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants