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

Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket' from System.Net.Sockets.Tests.ReceiveFrom*.ClosedDuringOperation_Throws_ObjectDisposedExceptionOrSocketException #47561

Closed
danmoseley opened this issue Jan 28, 2021 · 10 comments · Fixed by #47575
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

@danmoseley
Copy link
Member

danmoseley commented Jan 28, 2021

net6.0-windows-Debug-x64-CoreCLR_release-Windows.81.Amd64.Open
https://dev.azure.com/dnceng/public/_build/results?buildId=969030&view=ms.vss-test-web.build-test-results-tab&runId=30459202&paneView=debug

System.Net.Sockets.Tests.ReceiveFrom_SyncForceNonBlocking.ClosedDuringOperation_Throws_ObjectDisposedExceptionOrSocketException(closeOrDispose: True)

{ "HelixJobId": "3ea51fa5-fda3-4c43-8a92-d69d605fd83e", "HelixWorkItemName": "System.Net.Sockets.Tests" }


Error message
Assert.Throws() Failure\r\nExpected: typeof(System.Net.Sockets.SocketException)\r\nActual:   typeof(System.ObjectDisposedException): Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket'.\r\n---- System.ObjectDisposedException : Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket'.


Stack trace
   at System.Net.Sockets.Socket.ThrowObjectDisposedException() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 4158
   at System.Net.Sockets.Socket.ThrowIfDisposed() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 4153
   at System.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint& remoteEP) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 1610
   at System.Net.Sockets.Tests.SocketHelperArraySync.<>c__DisplayClass7_0.<ReceiveFromAsync>b__0() in /_/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs:line 69
   at System.Threading.Tasks.Task`1.InnerInvoke() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:line 503
   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 303
--- 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 ---
----- Inner Stack Trace -----
   at System.Net.Sockets.Socket.ThrowObjectDisposedException() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 4158
   at System.Net.Sockets.Socket.ThrowIfDisposed() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 4153
   at System.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint& remoteEP) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 1610
   at System.Net.Sockets.Tests.SocketHelperArraySync.<>c__DisplayClass7_0.<ReceiveFromAsync>b__0() in /_/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs:line 69
   at System.Threading.Tasks.Task`1.InnerInvoke() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:line 503
   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 303
--- 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 ---

Runfo Tracking Issue: system.net.sockets.tests.receivemessagefrom* throwing ObjectDisposedExceptions

Build Definition Kind Run Name
1033413 runtime PR 49474 net6.0-windows-Debug-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
1033413 runtime PR 49474 net6.0-windows-Debug-x64-CoreCLR_release-Windows.10.Amd64.Server19H1.ES.Open
1033413 runtime PR 49474 net6.0-windows-Debug-x64-CoreCLR_release-Windows.81.Amd64.Open
1033413 runtime PR 49474 net6.0-Linux-Debug-x64-CoreCLR_release-(Alpine.312.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:alpine-3.12-helix-20200602002622-e06dc59
1033413 runtime PR 49474 net6.0-Linux-Debug-x64-CoreCLR_release-(Fedora.30.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:fedora-30-helix-20200512010621-4f8cef7
1033413 runtime PR 49474 net6.0-Linux-Debug-x64-CoreCLR_release-SLES.15.Amd64.Open
1033413 runtime PR 49474 net6.0-Linux-Debug-x64-CoreCLR_release-Ubuntu.1804.Amd64.Open
1033413 runtime PR 49474 net6.0-Linux-Debug-x64-CoreCLR_release-Ubuntu.1604.Amd64.Open
1033413 runtime PR 49474 net6.0-Linux-Debug-x64-CoreCLR_release-(Debian.10.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006
1033413 runtime PR 49474 net6.0-Linux-Debug-x64-CoreCLR_release-RedHat.7.Amd64.Open
1033413 runtime PR 49474 net6.0-Linux-Debug-x64-CoreCLR_release-(Centos.8.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759
1033413 runtime PR 49474 net6.0-windows-Debug-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.Open
1033413 runtime PR 49474 net6.0-windows-Debug-x86-CoreCLR_release-Windows.7.Amd64.Open
1033413 runtime PR 49474 net6.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.ES.Open
1033413 runtime PR 49474 net6.0-OSX-Debug-x64-CoreCLR_release-OSX.1015.Amd64.Open
1033413 runtime PR 49474 net6.0-OSX-Debug-x64-CoreCLR_release-OSX.1014.Amd64.Open
969479 runtime Rolling net6.0-windows-Release-x64-CoreCLR_release-Windows.10.Amd64.Server19H1.Open
969470 runtime PR 47572 net6.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.ES.Open
969470 runtime PR 47572 net6.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.ES.Open
969431 runtime PR 47167 net6.0-windows-Debug-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
969431 runtime PR 47167 net6.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.ES.Open
969431 runtime PR 47167 net6.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.ES.Open
969404 runtime Rolling net6.0-windows-Release-x86-CoreCLR_release-Windows.7.Amd64.Open
969404 runtime Rolling net6.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.ServerRS5.Open
969357 runtime PR 46602 net6.0-Linux-Debug-x64-Mono_release-RedHat.7.Amd64.Open
969288 runtime Rolling net6.0-Linux-Release-x64-CoreCLR_release-RedHat.7.Amd64.Open
969288 runtime Rolling net6.0-windows-Release-x86-CoreCLR_release-Windows.7.Amd64.Open
969288 runtime Rolling net6.0-windows-Release-x86-CoreCLR_release-Windows.10.Amd64.ServerRS5.Open
969213 runtime PR 47511 net6.0-Linux-Debug-x64-Mono_release-(Debian.10.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006
969213 runtime PR 47511 net6.0-windows-Debug-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
969211 runtime Rolling net6.0-Linux-Release-x64-CoreCLR_release-Debian.9.Amd64.Open
969211 runtime Rolling net6.0-windows-Release-x64-CoreCLR_release-Windows.10.Amd64.ServerRS5.Open
969154 runtime PR 47560 net6.0-Linux-Debug-x64-CoreCLR_release-(Fedora.30.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:fedora-30-helix-20200512010621-4f8cef7
969030 runtime PR 47511 net6.0-windows-Debug-x64-CoreCLR_release-Windows.81.Amd64.Open
968977 runtime PR 47539 net6.0-windows-Debug-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
968801 runtime PR 47316 net6.0-windows-Debug-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
968785 runtime PR 45479 net6.0-windows-Debug-x64-CoreCLR_release-Windows.81.Amd64.Open
968785 runtime PR 45479 net6.0-windows-Debug-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.Open
968785 runtime PR 45479 net6.0-windows-Debug-x64-CoreCLR_release-Windows.81.Amd64.Open
968596 runtime PR 47526 net6.0-Linux-Debug-x64-CoreCLR_release-(Debian.10.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006
968596 runtime PR 47526 net6.0-Linux-Debug-x64-CoreCLR_release-Ubuntu.1804.Amd64.Open
968596 runtime PR 47526 net6.0-windows-Debug-x64-CoreCLR_release-(Windows.Nano.1809.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
968555 runtime PR 47539 net6.0-windows-Debug-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.Open
968083 runtime PR 47174 net6.0-Linux-Debug-x64-Mono_release-(Fedora.30.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:fedora-30-helix-20200512010621-4f8cef7
968073 runtime PR 47459 net6.0-Linux-Debug-x64-CoreCLR_release-RedHat.7.Amd64.Open
968029 runtime PR 47521 net6.0-Linux-Debug-x64-CoreCLR_release-(Alpine.312.Amd64.Open)[email protected]/dotnet-buildtools/prereqs:alpine-3.12-helix-20200602002622-e06dc59

Build Result Summary

Day Hit Count Week Hit Count Month Hit Count
0 0 0
@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net.Sockets untriaged New issue has not been triaged by the area owner labels Jan 28, 2021
@ghost
Copy link

ghost commented Jan 28, 2021

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

Issue Details

net6.0-windows-Debug-x64-CoreCLR_release-Windows.81.Amd64.Open
https://dev.azure.com/dnceng/public/_build/results?buildId=969030&view=ms.vss-test-web.build-test-results-tab&runId=30459202&paneView=debug

System.Net.Sockets.Tests.ReceiveFrom_SyncForceNonBlocking.ClosedDuringOperation_Throws_ObjectDisposedExceptionOrSocketException(closeOrDispose: True)

{ "HelixJobId": "3ea51fa5-fda3-4c43-8a92-d69d605fd83e", "HelixWorkItemName": "System.Net.Sockets.Tests" }


Error message
Assert.Throws() Failure\r\nExpected: typeof(System.Net.Sockets.SocketException)\r\nActual:   typeof(System.ObjectDisposedException): Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket'.\r\n---- System.ObjectDisposedException : Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket'.


Stack trace
   at System.Net.Sockets.Socket.ThrowObjectDisposedException() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 4158
   at System.Net.Sockets.Socket.ThrowIfDisposed() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 4153
   at System.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint& remoteEP) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 1610
   at System.Net.Sockets.Tests.SocketHelperArraySync.<>c__DisplayClass7_0.<ReceiveFromAsync>b__0() in /_/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs:line 69
   at System.Threading.Tasks.Task`1.InnerInvoke() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:line 503
   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 303
--- 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 ---
----- Inner Stack Trace -----
   at System.Net.Sockets.Socket.ThrowObjectDisposedException() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 4158
   at System.Net.Sockets.Socket.ThrowIfDisposed() in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 4153
   at System.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint& remoteEP) in /_/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs:line 1610
   at System.Net.Sockets.Tests.SocketHelperArraySync.<>c__DisplayClass7_0.<ReceiveFromAsync>b__0() in /_/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs:line 69
   at System.Threading.Tasks.Task`1.InnerInvoke() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:line 503
   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 303
--- 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 ---
Author: danmosemsft
Assignees: -
Labels:

area-System.Net.Sockets, untriaged

Milestone: -

@karelz karelz added test-run-core Test failures in .NET Core test runs and removed untriaged New issue has not been triaged by the area owner labels Jan 28, 2021
@karelz karelz added this to the 6.0.0 milestone Jan 28, 2021
@hoyosjs hoyosjs added the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Jan 28, 2021
@hoyosjs hoyosjs changed the title Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket' from ClosedDuringOperation_Throws_ObjectDisposedExceptionOrSocketException Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket' from System.Net.Sockets.Tests.ReceiveFrom* tests Jan 28, 2021
@hoyosjs
Copy link
Member

hoyosjs commented Jan 28, 2021

Looks like these tests were added with #47229, going to disable failing tests to unblock CI.

@karelz
Copy link
Member

karelz commented Jan 28, 2021

@antonfirsov can you please confirm if it is test regression introduced by your PR?

@hoyosjs hoyosjs changed the title Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket' from System.Net.Sockets.Tests.ReceiveFrom* tests Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.Socket' from System.Net.Sockets.Tests.ReceiveFrom*.ClosedDuringOperation_Throws_ObjectDisposedExceptionOrSocketException Jan 28, 2021
@hoyosjs
Copy link
Member

hoyosjs commented Jan 28, 2021

Somehow the tests seem not to have run in said PR, so I am confused as to what happened...

@antonfirsov
Copy link
Member

Yes, this is either a test bug introduced by my PR, or a product bug (exception type depends on timing factors).

@antonfirsov
Copy link
Member

The latter case would explain missing it in my original PR despite of several runs.
Looking into it.

@hoyosjs hoyosjs added disabled-test The test is disabled in source code against the issue and removed blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' labels Jan 28, 2021
@hoyosjs
Copy link
Member

hoyosjs commented Jan 28, 2021

@antonfirsov It's weird, for example testResults.xml for your PR's debian x64 leg doesn't show the tests being run

antonfirsov added a commit to antonfirsov/runtime that referenced this issue Jan 28, 2021
@antonfirsov
Copy link
Member

@hoyosjs that particular xml seems to belong to an outerloop run. Here's an innerloop log from OSX where the test passed:
https://helix.dot.net/api/jobs/e73e2d4a-3040-442a-a551-ce9db1803b44/workitems/System.Net.WebSockets.Tests?api-version=2019-06-17

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jan 28, 2021
@danmoseley
Copy link
Member Author

@jaredpar how did runfo know to attach to this bug - magic? or someone manually connects it ?

@hoyosjs
Copy link
Member

hoyosjs commented Jan 28, 2021

I made it a tracking issue after investigating some elevated failures.

geoffkizer pushed a commit that referenced this issue Feb 4, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 4, 2021
@karelz karelz removed the disabled-test The test is disabled in source code against the issue label Feb 4, 2021
@karelz karelz added the test-bug Problem in test source code (most likely) label Feb 4, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 12, 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
4 participants