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

[tests] Stop the HttpListener as part of teardown #574

Merged
merged 1 commit into from
Nov 12, 2022

Conversation

alanmcgovern
Copy link
Owner

Maybe there's a bug in the finalizer chain and it's causing this crash during app shutdown:

The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.ObjectDisposedException: Safe handle has been closed. Object name: 'SafeHandle'.
at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
at Interop.HttpApi.HttpCancelHttpRequest(SafeHandle requestQueueHandle, UInt64 requestId, IntPtr pOverlapped)
at System.Net.HttpListenerContext.ForceCancelRequest(SafeHandle requestQueueHandle, UInt64 requestId)
at System.Net.HttpListenerContext.Abort()
at System.Net.HttpResponseStream.EndWriteCore(IAsyncResult asyncResult)
at System.Net.HttpResponseStream.EndWrite(IAsyncResult asyncResult)
at System.Net.HttpListenerResponse.NonBlockingCloseCallback(IAsyncResult asyncResult)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.HttpResponseStreamAsyncResult.IOCompleted(HttpResponseStreamAsyncResult asyncResult, UInt32 errorCode, UInt32 numBytes)
at System.Net.HttpResponseStreamAsyncResult.Callback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading.ThreadPoolBoundHandleOverlapped.CompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.IOCompletionCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pNativeOverlapped)

Try to work around dotnet/runtime#78326

Maybe there's a bug in the finalizer chain and it's
causing this crash during app shutdown:

The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.ObjectDisposedException: Safe handle has been closed.
Object name: 'SafeHandle'.
   at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
   at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success)
   at Interop.HttpApi.HttpCancelHttpRequest(SafeHandle requestQueueHandle, UInt64 requestId, IntPtr pOverlapped)
   at System.Net.HttpListenerContext.ForceCancelRequest(SafeHandle requestQueueHandle, UInt64 requestId)
   at System.Net.HttpListenerContext.Abort()
   at System.Net.HttpResponseStream.EndWriteCore(IAsyncResult asyncResult)
   at System.Net.HttpResponseStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.HttpListenerResponse.NonBlockingCloseCallback(IAsyncResult asyncResult)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.HttpResponseStreamAsyncResult.IOCompleted(HttpResponseStreamAsyncResult asyncResult, UInt32 errorCode, UInt32 numBytes)
   at System.Net.HttpResponseStreamAsyncResult.Callback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading.ThreadPoolBoundHandleOverlapped.CompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.IOCompletionCallback_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pNativeOverlapped)
@alanmcgovern alanmcgovern merged commit e3da4c2 into master Nov 12, 2022
@alanmcgovern alanmcgovern deleted the maybe-fix-failure-on-build-pipeline branch November 12, 2022 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant