【问题标题】:Figuring out a IIS app pool crash on production找出生产环境中的 IIS 应用程序池崩溃
【发布时间】:2021-10-08 19:34:46
【问题描述】:

更新:我最终在这里提出并回答了这个问题的不同形式:IIS App Pool crashes about 20 seconds after an OperationCancelledException is logged by middleware


我有一个运行 .net 472 应用程序的应用程序池,它偶尔会在我们的生产服务器上崩溃。这是正在记录的消息:

A process serving application pool 'MyApi' suffered a fatal communication error with the Windows Process Activation Service. The process id was '7472'. The data field contains the error number.

错误号:6D000780


我已经通过 DebugDiag 运行了故障转储,这就是我所看到的

In w3wp.exe.10496.dmp the assembly instruction at iiscore!W3_CONTEXT_BASE::GetIsLastNotification+62 in C:\Windows\System32\inetsrv\iiscore.dll from Microsoft Corporation has caused an access violation exception (0xC0000005) when trying to read from memory location 0x2d8ac2e8 on thread 111

线程 111 显示此堆栈跟踪:

.NET Call Stack


DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus)+73 
[[InlinedCallFrame] (System.Web.Hosting.UnsafeIISMethods.MgdIsLastNotification)] System.Web.Hosting.UnsafeIISMethods.MgdIsLastNotification(IntPtr, System.Web.RequestNotificationStatus) 
System.Web.HttpRuntime.FinishRequestNotification(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext, System.Web.RequestNotificationStatus ByRef)+9b 
System.Web.HttpRuntime.OnRequestNotificationCompletionHelper(System.IAsyncResult)+da 
System.Web.HttpRuntime.OnRequestNotificationCompletion(System.IAsyncResult)+13 
System.Web.HttpAsyncResult.Complete(Boolean, System.Object, System.Exception, System.Web.RequestNotificationStatus)+82 
System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)+562 
System.Threading.Tasks.Task.Execute()+49 
System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+16f 
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+14 
System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)+228 
System.Threading.Tasks.Task.ExecuteEntry(Boolean)+92 
System.Threading.ThreadPoolWorkQueue.Dispatch()+169 
[[DebuggerU2MCatchHandlerFrame]] 
[[ContextTransitionFrame]] 
[[DebuggerU2MCatchHandlerFrame]] 


Full Call Stack



ntdll!NtWaitForMultipleObjects+a 
KERNELBASE!WaitForMultipleObjectsEx+e1 
kernel32!WerpReportFaultInternal+581 
kernel32!WerpReportFault+83 
KERNELBASE!UnhandledExceptionFilter+23f 
w3wp!WpUnhandledExceptionFilter+47 
mscoreei!InternalUnhandledExceptionFilter+41 
KERNELBASE!UnhandledExceptionFilter+1a2 
ntdll!RtlUserThreadStart$filt$0+3e 
ntdll!_C_specific_handler+96 
ntdll!RtlpExecuteHandlerForException+d 
ntdll!RtlDispatchException+197 
ntdll!KiUserExceptionDispatch+3a 
iiscore!W3_CONTEXT_BASE::GetIsLastNotification+62 
webengine4!MgdIsLastNotification+19 
DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus)+73 
System.Web.HttpRuntime.FinishRequestNotification(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext, System.Web.RequestNotificationStatus ByRef)+9b 
System.Web.HttpRuntime.OnRequestNotificationCompletionHelper(System.IAsyncResult)+da 
System.Web.HttpRuntime.OnRequestNotificationCompletion(System.IAsyncResult)+13 
System.Web.HttpAsyncResult.Complete(Boolean, System.Object, System.Exception, System.Web.RequestNotificationStatus)+82 
System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)+562 
System.Threading.Tasks.Task.Execute()+49 
System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+16f 
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+14 
System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)+228 
System.Threading.Tasks.Task.ExecuteEntry(Boolean)+92 
System.Threading.ThreadPoolWorkQueue.Dispatch()+169 
clr!CallDescrWorkerInternal+83 
clr!CallDescrWorkerWithHandler+4e 
clr!MethodDescCallSite::CallTargetWorker+102 
clr!QueueUserWorkItemManagedCallback+2a 
clr!ManagedThreadBase_DispatchInner+40 
clr!ManagedThreadBase_DispatchMiddle+6c 
clr!ManagedThreadBase_DispatchOuter+4c 
clr!ManagedThreadBase_DispatchInCorrectAD+15 
clr!Thread::DoADCallBack+26b 
clr!ManagedThreadBase_DispatchInner+2e2f 
clr!ManagedThreadBase_DispatchMiddle+6c 
clr!ManagedThreadBase_DispatchOuter+4c 
clr!ManagedThreadBase_FullTransitionWithAD+2f 
clr!ManagedPerAppDomainTPCount::DispatchWorkItem+a4 
clr!ThreadpoolMgr::ExecuteWorkRequest+64 
clr!ThreadpoolMgr::WorkerThreadStart+f6 
clr!Thread::intermediateThreadProc+8b 
kernel32!BaseThreadInitThunk+22 
ntdll!RtlUserThreadStart+34 

看起来错误来自GetIsLastNotification in IHttpContext,但这似乎是 IIS 的核心部分,而不是我们的 asp.net api 应用程序调用的东西?我知道我在整个解决方案中找不到任何对 GetIsLastNotification 的引用。

我不知道从这里去哪里。我找到了this in the MS documentation,它看起来与我的转储文件中的错误非常相似,但是应用程序没有使用任何 PreSendRequestHeaders 或 IHttpModule。

不要将 PreSendRequestHeaders 与实现 IHttp 模块。设置这些属性可能会导致问题 异步请求。申请的组合 路由 (ARR) 和 websockets 可能导致访问冲突异常 这可能导致 w3wp 崩溃。例如, iiscore.dll 中的 iiscore!W3_CONTEXT_BASE::GetIsLastNotification+68 有 导致访问冲突异常(0xC0000005)。

【问题讨论】:

  • 确保 IIS 中的应用程序池,在高级设置下已将启用 32 位应用程序设置为 True。

标签: c# iis crash dump


【解决方案1】:

首先,我建议您在使用资源和/或操作对象时始终使用Try Catch 块。

这样可以避免系统崩溃,并且可以通过记录引发异常的错误消息来利用异常。

【讨论】:

  • 这里的问题是 IIS 应用程序池正在崩溃。通常,ASP.NET Web API 中的异常会被自动捕获并向用户返回 500 错误。但是某些东西导致应用程序崩溃。
猜你喜欢
  • 2010-10-03
  • 2018-04-25
  • 2017-03-14
  • 2012-12-18
  • 2012-08-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多