Coder Social home page Coder Social logo

Comments (4)

Tratcher avatar Tratcher commented on July 30, 2024

Repro stack:

Not Flagged	>	22164	5	Worker Thread	Worker Thread	Microsoft.Owin.Security.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.OnSendingHeaderCallback	Normal
 	 	 	 	 	 	mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)	 
 	 	 	 	 	 	mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout)	 
 	 	 	 	 	 	mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)	 
 	 	 	 	 	 	mscorlib.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)	 
 	 	 	 	 	 	mscorlib.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)	 
 	 	 	 	 	 	mscorlib.dll!System.Threading.Tasks.Task.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)	 
 	 	 	 	 	 	Microsoft.Owin.Security.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.OnSendingHeaderCallback(object state)	 
 	 	 	 	 	 	Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.CallHeaders.SendingHeadersEvent.Fire()	 
 	 	 	 	 	 	Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.OwinCallContext.StartOnce()	 
 	 	 	 	 	 	mscorlib.dll!System.Threading.LazyInitializer.EnsureInitializedCore<System.__Canon>(ref System.__Canon target, ref bool initialized, ref object syncLock, System.Func<System.__Canon> valueFactory)	 
 	 	 	 	 	 	Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.OwinCallContext.OnStart()	 
 	 	 	 	 	 	Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Start(bool force)	 
 	 	 	 	 	 	Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken)	 
 	 	 	 	 	 	mscorlib.dll!System.IO.MemoryStream.CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken)	 
 	 	 	 	 	 	mscorlib.dll!System.IO.Stream.CopyToAsync(System.IO.Stream destination)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureHttpLoggingExtension.ConfigureHttpLogging.AnonymousMethod__0(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.ConfigureHttpLoggingExtension.<<ConfigureHttpLogging>b__0>d__2>(ref Owin.ConfigureHttpLoggingExtension.<<ConfigureHttpLogging>b__0>d__2 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureHttpLoggingExtension.ConfigureHttpLogging.AnonymousMethod__0(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	Microsoft.Owin.dll!Microsoft.Owin.Infrastructure.AppFuncTransition.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	Microsoft.Owin.Security.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Twitter.TwitterAuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Twitter.TwitterAuthenticationOptions>.<Invoke>d__0>(ref Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Twitter.TwitterAuthenticationOptions>.<Invoke>d__0 stateMachine)	 
 	 	 	 	 	 	Microsoft.Owin.Security.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Twitter.TwitterAuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	Microsoft.Owin.Security.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationOptions>.<Invoke>d__0>(ref Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationOptions>.<Invoke>d__0 stateMachine)	 
 	 	 	 	 	 	Microsoft.Owin.Security.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	Microsoft.Owin.dll!Microsoft.Owin.Infrastructure.OwinMiddlewareTransition.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__1()	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.SignOutMessageCookieExtension.ConfigureSignOutMessageCookie.AnonymousMethod__0(Microsoft.Owin.IOwinContext context, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.SignOutMessageCookieExtension.<<ConfigureSignOutMessageCookie>b__0>d__5>(ref Owin.SignOutMessageCookieExtension.<<ConfigureSignOutMessageCookie>b__0>d__5 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.SignOutMessageCookieExtension.ConfigureSignOutMessageCookie.AnonymousMethod__0(Microsoft.Owin.IOwinContext context, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__1()	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.UseCookieAuthenticationExtension.ConfigureCookieAuthentication.AnonymousMethod__6(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.UseCookieAuthenticationExtension.(ref Owin.UseCookieAuthenticationExtension.<>c__DisplayClass9.<<ConfigureCookieAuthentication>b__6>d__10 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.UseCookieAuthenticationExtension.ConfigureCookieAuthentication.AnonymousMethod__6(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Infrastructure.AppFuncTransition.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.<Invoke>d__0>(ref Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.<Invoke>d__0 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.<Invoke>d__0>(ref Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.<Invoke>d__0 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.<Invoke>d__0>(ref Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.<Invoke>d__0 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware<Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions>.Invoke(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Infrastructure.OwinMiddlewareTransition.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Cors.CorsMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.Owin.Cors.CorsMiddleware.<Invoke>d__0>(ref Microsoft.Owin.Cors.CorsMiddleware.<Invoke>d__0 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Cors.CorsMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__1()	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.OwinExtensions.UseAutofacMiddleware.AnonymousMethod__0(Microsoft.Owin.IOwinContext context, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.OwinExtensions.(ref Owin.OwinExtensions.<>c__DisplayClass2.<<UseAutofacMiddleware>b__0>d__7 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.OwinExtensions.UseAutofacMiddleware.AnonymousMethod__0(Microsoft.Owin.IOwinContext context, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__1()	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureRenderLoggedOutPageExtension.ConfigureRenderLoggedOutPage.AnonymousMethod__0(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.ConfigureRenderLoggedOutPageExtension.<<ConfigureRenderLoggedOutPage>b__0>d__2>(ref Owin.ConfigureRenderLoggedOutPageExtension.<<ConfigureRenderLoggedOutPage>b__0>d__2 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureRenderLoggedOutPageExtension.ConfigureRenderLoggedOutPage.AnonymousMethod__0(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__1()	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureRequestBodyBufferExtension.ConfigureRequestBodyBuffer.AnonymousMethod__0(Microsoft.Owin.IOwinContext context, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.ConfigureRequestBodyBufferExtension.<<ConfigureRequestBodyBuffer>b__0>d__2>(ref Owin.ConfigureRequestBodyBufferExtension.<<ConfigureRequestBodyBuffer>b__0>d__2 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureRequestBodyBufferExtension.ConfigureRequestBodyBuffer.AnonymousMethod__0(Microsoft.Owin.IOwinContext context, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__1()	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureIdentityServerIssuerExtension.ConfigureIdentityServerIssuer.AnonymousMethod__1(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.ConfigureIdentityServerIssuerExtension.(ref Owin.ConfigureIdentityServerIssuerExtension.<>c__DisplayClass5.<<ConfigureIdentityServerIssuer>b__1>d__7 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureIdentityServerIssuerExtension.ConfigureIdentityServerIssuer.AnonymousMethod__1(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__1()	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureIdentityServerBaseUrlExtension.ConfigureIdentityServerBaseUrl.AnonymousMethod__0(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.ConfigureIdentityServerBaseUrlExtension.(ref Owin.ConfigureIdentityServerBaseUrlExtension.<>c__DisplayClass1.<<ConfigureIdentityServerBaseUrl>b__0>d__3 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureIdentityServerBaseUrlExtension.ConfigureIdentityServerBaseUrl.AnonymousMethod__0(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__1()	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureRequestIdExtension.ConfigureRequestId.AnonymousMethod__0(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Owin.ConfigureRequestIdExtension.<<ConfigureRequestId>b__0>d__2>(ref Owin.ConfigureRequestIdExtension.<<ConfigureRequestId>b__0>d__2 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!Owin.ConfigureRequestIdExtension.ConfigureRequestId.AnonymousMethod__0(Microsoft.Owin.IOwinContext ctx, System.Func<System.Threading.Tasks.Task> next)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware..ctor.AnonymousMethod__0(Microsoft.Owin.IOwinContext context)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.Extensions.UseHandlerMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.StaticFiles.StaticFileMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.StaticFiles.DefaultFilesMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.StaticFiles.StaticFileMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!Microsoft.Owin.StaticFiles.DefaultFilesMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	IdentityServer3.dll!IdentityServer3.Core.Configuration.Hosting.RequireSslMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> env)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<IdentityServer3.Core.Configuration.Hosting.RequireSslMiddleware.<Invoke>d__0>(ref IdentityServer3.Core.Configuration.Hosting.RequireSslMiddleware.<Invoke>d__0 stateMachine)	 
 	 	 	 	 	 	IdentityServer3.dll!IdentityServer3.Core.Configuration.Hosting.RequireSslMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> env)	 
 	 	 	 	 	 	Microsoft.Owin.dll!Microsoft.Owin.Mapping.MapMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0>(ref Microsoft.Owin.Mapping.MapMiddleware.<Invoke>d__0 stateMachine)	 
 	 	 	 	 	 	Microsoft.Owin.dll!Microsoft.Owin.Mapping.MapMiddleware.Invoke(System.Collections.Generic.IDictionary<string, object> environment)	 
 	 	 	 	 	 	Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.RunApp(System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task> entryPoint, System.Collections.Generic.IDictionary<string, object> environment, System.Threading.Tasks.TaskCompletionSource<object> tcs, Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult result)	 
 	 	 	 	 	 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.<RunApp>d__5>(ref Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.<RunApp>d__5 stateMachine)	 
 	 	 	 	 	 	Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.RunApp(System.Func<System.Collections.Generic.IDictionary<string, object>, System.Threading.Tasks.Task> entryPoint, System.Collections.Generic.IDictionary<string, object> environment, System.Threading.Tasks.TaskCompletionSource<object> tcs, Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult result)	 
 	 	 	 	 	 	Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.BeginEvent(object sender, System.EventArgs e, System.AsyncCallback cb, object extradata)	 
 	 	 	 	 	 	System.Web.dll!System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()	 
 	 	 	 	 	 	System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously)	 
 	 	 	 	 	 	System.Web.dll!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception error)	 
 	 	 	 	 	 	System.Web.dll!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext context, System.AsyncCallback cb)	 
 	 	 	 	 	 	System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context)	 
 	 	 	 	 	 	System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)	 
 	 	 	 	 	 	System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)	 
 	 	 	 	 	 	[AppDomain Transition]	 

private static void OnSendingHeaderCallback(object state)
{
    AuthenticationHandler handler = (AuthenticationHandler)state;
    handler.ApplyResponseAsync().Wait();
}

This happens because Twitter's ApplyResponseChallengeAsync is actually async, so the task in OnSendingHeaderCallback is actually async and blocks. This chokes on System.Web's sync context.

This only happens with IS3's logging enabled because they buffer, log, and flush the request body before the auth middleware has a chance to apply its challenge, so it tries to add the challenge in the OnSendingHeaderCallback.
https://github.com/IdentityServer/IdentityServer3/blob/93bc6bc9b536146b9e3fa0bed21d77283d07f788/source/Core/Configuration/AppBuilderExtensions/ConfigureHttpLoggingExtension.cs#L48
The write that triggered this was WriteAsync(byte[0], 0, 0);, there's no body. Not sure why CopyToAsync though it needed to call write.

Solutions:

  • For ASP.NET Core OnSendingHeaderCallback is fully async, and there's no sync context, so there's no need to block/wait here. That's not a breaking change we can make to Microsoft.Owin though. (is it?)
  • The IdentityServer logger does not need to copy the body if it's empty.
  • Adding the buffering logger before the auth middleware in the pipeline should allow the auth middleware to complete and avoid triggering OnSendingHeaderCallback.

        public void Configuration(IAppBuilder app)
        {
            app.Map("/identity", idsrvApp =>
            {
                idsrvApp.Use(async (ctx, next) =>
                {
                    // await LogRequest(ctx.Request);

                    var oldStream = ctx.Response.Body;
                    var ms = new MemoryStream();
                    ctx.Response.Body = ms;

                    try
                    {
                        await next();
                        // await LogResponse(ctx.Response);

                        ctx.Response.Body = oldStream;
                        if (ms.Length > 0)
                        {
                            ms.Seek(0, SeekOrigin.Begin);
                            await ms.CopyToAsync(oldStream);
                        }
                    }
                    catch (Exception ex)
                    {
                        // Logger.DebugException("HTTP Response Exception", ex);
                        throw;
                    }
                });

from aspnetkatana.

Tratcher avatar Tratcher commented on July 30, 2024

@brockallen
When I copied ConfigureHttpLogging for debugging I found it was missing a Seek on the response body before CopyToAsync. It could also use a Length check. See above.
https://github.com/IdentityServer/IdentityServer3/blob/93bc6bc9b536146b9e3fa0bed21d77283d07f788/source/Core/Configuration/AppBuilderExtensions/ConfigureHttpLoggingExtension.cs#L48

from aspnetkatana.

brockallen avatar brockallen commented on July 30, 2024

Thanks. I opened an issue.

from aspnetkatana.

Tratcher avatar Tratcher commented on July 30, 2024

Closing this issue. The core issue is the .Wait(); in OnSendingHeaders which has been fixed in Core but can't be fixed here without other significant breaks. The triggering issue lies in MemoryStream.CopyToAsync() and can most easily be worked around in IdentityServer.

from aspnetkatana.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.