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

Work around a HttpListener framework bug #659

Merged
merged 1 commit into from
Jul 6, 2024
Merged

Conversation

alanmcgovern
Copy link
Owner

@alanmcgovern alanmcgovern commented Jul 5, 2024

If HttpListener throws an exception in it's async callback because it's already been disposed, then it's a framework bug and they should fix it. I'm pretty sure i filed it before and it wasn't addressed, so work around it by ignoring the exit code from the test running process and only fail the build if tests have failed.

This is no longer causing red builds:

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._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._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pNativeOverlapped)

@alanmcgovern alanmcgovern force-pushed the test_ci_fix branch 2 times, most recently from 77315d0 to ec7a144 Compare July 6, 2024 14:05
If the tests report a failure then that's still a failure though!
@alanmcgovern alanmcgovern merged commit f4de6f8 into master Jul 6, 2024
1 check passed
@alanmcgovern alanmcgovern deleted the test_ci_fix branch July 6, 2024 14:40
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.

1 participant