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

Flaky Test: Safe handle has been closed #1752

Closed
mikeharder opened this issue Apr 24, 2017 · 5 comments
Closed

Flaky Test: Safe handle has been closed #1752

mikeharder opened this issue Apr 24, 2017 · 5 comments
Assignees

Comments

@mikeharder
Copy link
Contributor

mikeharder commented Apr 24, 2017

[VSTest] Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.ResponseTests.WhenAppSetsContentLengthToZeroAndDoesNotWriteNoErrorIsThrown(flushResponse: False)
[14:46:24]
[Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.ResponseTests.WhenAppSetsContentLengthToZeroAndDoesNotWriteNoErrorIsThrown(flushResponse: False)] System.AggregateException : One or more errors occurred.
---- System.ObjectDisposedException : Safe handle has been closed
[Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.ResponseTests.WhenAppSetsContentLengthToZeroAndDoesNotWriteNoErrorIsThrown(flushResponse: False)]    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.TestServer.Dispose() in C:\b\w\33bdfc1cae7b2a38\.r\KestrelHttpServer\test\Microsoft.AspNetCore.Server.Kestrel.FunctionalTests\TestServer.cs:line 106
   at Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.ResponseTests.<WhenAppSetsContentLengthToZeroAndDoesNotWriteNoErrorIsThrown>d__25.MoveNext() in C:\b\w\33bdfc1cae7b2a38\.r\KestrelHttpServer\test\Microsoft.AspNetCore.Server.Kestrel.FunctionalTests\ResponseTests.cs:line 828
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
----- Inner Stack Trace -----
   at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
   at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.LibuvFunctions.NativeMethods.uv_async_send(UvAsyncHandle handle)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.LibuvFunctions.async_send(UvAsyncHandle handle)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.LibuvThread.Post[T](Action`1 callback, T state)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.LibuvThread.<StopAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.LibuvTransport.<StopAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.<StopAsync>d__22.MoveNext()

4/24/17: http://aspnetci/viewLog.html?buildId=207567&tab=buildLog&buildTypeId=Lite_UniverseTest&logTab=tree&filter=err#_

@halter73
Copy link
Member

Based on the fact that the ODE is being thrown from LibuvThread.Post() inside LibuvThread.StopAsync(), it appears that the call to Post(t => t.AllowStop()); is throwing. This would mean that uv_run exited before that.

@halter73 halter73 self-assigned this Apr 25, 2017
@halter73 halter73 added the bug label Apr 25, 2017
@halter73 halter73 added this to the 2.0.0-preview1 milestone Apr 25, 2017
@halter73
Copy link
Member

Fixed by #1756

@davidfowl
Copy link
Member

@halter73 I did some playing around with the shutdown logic and I don't think this test failure can be an exception on the libuv thread. This test uses the test server which will crash the process if there' s any exception on the libuv thread.

@mikeharder
Copy link
Contributor Author

@davidfowl: Are you saying you believe this test failure is not actually fixed by #1756?

@davidfowl
Copy link
Member

@mikeharder we had some theories yesterday as to why this could possibly happen and I was trying to narrow it down last night. @halter73 's change should this specific issue but we still don't know the root cause.

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

No branches or pull requests

3 participants