Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

"ObjectDisposedException: Safe handle has been closed" when running FunctionalTests on OSX #972

Closed
mikeharder opened this issue Jul 15, 2016 · 2 comments
Assignees

Comments

@mikeharder
Copy link
Contributor

The following exception was thrown once when running FunctionalTests on OSX. No test failures were reported before the exception:

Unhandled Exception: System.ObjectDisposedException: Safe handle has been closed
   at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
   at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.NativeMethods.uv_async_send(UvAsyncHandle handle)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.async_send(UvAsyncHandle handle)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvAsyncHandle.Send()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.PostCloseHandle(Action`1 callback, IntPtr handle)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvHandle.ReleaseHandle()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvStreamHandle.ReleaseHandle()
   at System.Runtime.InteropServices.SafeHandle.InternalFinalize()
   at System.Runtime.InteropServices.SafeHandle.Finalize()
@Tragetaschen
Copy link
Contributor

That's the same stack trace as in #946. Do those tests properly dispose Kestrel?

@halter73
Copy link
Member

@Tragetaschen The tests do dispose KestrelServer. It's somewhat harder to mess that up in the functional tests where we pretty much always use using (WebHostBuilder.Build()). The error happens fairly infrequently, and looks like it could be due to some sort of shutdown race.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants