首页 > 解决方案 > AquireRequestState 阶段单个 AJAX 请求的 IIS 请求挂起

问题描述

我们有一个 AngularJS 应用程序与一个 .NET webforms 后端通信;它向多个系统发出一堆 AJAX 请求,并将大量信息合并到一个页面中,以使其更快地为用户服务。页面加载速度非常快,但有一个 AJAX 请求 (GetPatientRadiology)有时似乎挂起 - 即,如果我进入 AppPool 中的查看当前请求,我会看到它位于 AquireRequestState 中。

AppPool 的内存仍然很低(通常的行为),但是当这种情况发生时,AppPool 的 CPU 使用率会跃升至 30% 左右(对于这个应用程序来说不寻常)。在我回收 appPool 之前,它一直保持这种状态,由于某种原因,它似乎永远不会超时——我们观察到它持续了 17 多个小时。

该应用程序每天提供大约 22,000 次此页面(因此发出 GetPatientRadiology 请求),而且这似乎每天发生 < 10 次。该请求是对 Oracle 数据库的单个查询,在 SQL Developer 中返回的时间 < 0.1 秒。同一个 ConnectionString 有多个其他查询,这些查询没有问题。

它在 Windows 2008R2 服务器 (IIS7.5) 和 ASP.NET 4.6.1 上运行。是的,我知道它已经过时了......但我们被一些遗留设备困住了:(

我已经浏览并阅读了数十篇文章,但看不到任何特别有用的东西;有人建议使用我已经完成的 MS Debug Diags,并在生产过程中捕获了该过程;下面是它的摘录,但我不知道从哪里开始解释它,希望能得到一些帮助。

CPU 时间排名前 5 的线程

Thread ID: 44     Total CPU Time: 00:00:07.222     Entry Point for Thread: clr!StrongNameFreeBuffer+35dc0 
Thread ID: 3     Total CPU Time: 00:00:06.972     Entry Point for Thread: w3tp+2040 
Thread ID: 46     Total CPU Time: 00:00:06.145     Entry Point for Thread: clr!StrongNameFreeBuffer+35dc0 
Thread ID: 5     Total CPU Time: 00:00:05.911     Entry Point for Thread: w3tp+2040 ```

Thread 43 - System ID 5224

Entry point   clr!StrongNameFreeBuffer+35dc0 
Create time   8/11/2019 11:22:24 a.m. 
Time spent in user mode   0 Days 00:05:02.595 
Time spent in kernel mode   0 Days 00:05:06.853 


This thread is not fully resolved and may or may not be a problem. Further analysis of these threads may be required.


.NET Call Stack


System_Data_ni!DomainNeutralILStubClass.IL_STUB_PInvoke(System.Data.Odbc.OdbcStatementHandle, UInt16, SQL_C, System.Data.Odbc.CNativeBuffer, IntPtr, IntPtr ByRef)+e8 
[[InlinedCallFrame] (System.Data.Common.UnsafeNativeMethods.SQLGetData)] System.Data.Common.UnsafeNativeMethods.SQLGetData(System.Data.Odbc.OdbcStatementHandle, UInt16, SQL_C, System.Data.Odbc.CNativeBuffer, IntPtr, IntPtrByRef) 
System_Data_ni!System.Data.Odbc.OdbcStatementHandle.GetData(Int32, SQL_C, System.Data.Odbc.CNativeBuffer, Int32, IntPtr ByRef)+30 
System_Data_ni!System.Data.Odbc.OdbcDataReader.GetData(Int32, SQL_C, Int32, Int32 ByRef)+74 
System_Data_ni!System.Data.Odbc.OdbcDataReader.internalGetString(Int32)+1d4 
System_Data_ni!System.Data.Odbc.OdbcDataReader.GetValue(Int32, System.Data.Odbc.TypeMap)+73 
System_Data_ni!System.Data.Odbc.OdbcDataReader.GetValue(Int32)+43 
_Default.GetPatientRadiology(System.String)+330 
[[DebuggerU2MCatchHandlerFrame]] 
[[HelperMethodFrame_PROTECTOBJ] (System.RuntimeMethodHandle.InvokeMethod)] System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean) 
mscorlib_ni!System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])+80 
mscorlib_ni!System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)+8e 
System.Web.Script.Services.WebServiceMethodData.CallMethod(System.Object, System.Collections.Generic.IDictionary`2)+139 
System.Web.Script.Services.RestHandler.InvokeMethod(System.Web.HttpContext, System.Web.Script.Services.WebServiceMethodData, System.Collections.Generic.IDictionary`2)+74 
System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(System.Web.HttpContext, System.Web.Script.Services.WebServiceMethodData)+5d 
System.Web.Handlers.ScriptModule.OnPostAcquireRequestState(System.Object, System.EventArgs)+120 
System_Web_ni!System.Web.HttpApplication+SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+8b 
System_Web_ni!System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep)+c3 
System_Web_ni!System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)+58 
System_Web_ni!System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)+5bc 
System_Web_ni!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)+79 
System_Web_ni!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)+1db 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)+3cd 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)+13 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)+52 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus ByRef)+7e 
[[InlinedCallFrame] (System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion)] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatusByRef) 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)+595 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)+13 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)+52 
[[ContextTransitionFrame]] 

Full Call Stack


ntdll!NtSetEvent+a 
KERNELBASE!SetEvent+c 
sqora32+17a3 
sqora32!SQLGetData+175 
odbc32!SQLGetData+897 
System_Data_ni!DomainNeutralILStubClass.IL_STUB_PInvoke(System.Data.Odbc.OdbcStatementHandle, UInt16, SQL_C, System.Data.Odbc.CNativeBuffer, IntPtr, IntPtr ByRef)+e8 
[[InlinedCallFrame] (System.Data.Common.UnsafeNativeMethods.SQLGetData)] System.Data.Common.UnsafeNativeMethods.SQLGetData(System.Data.Odbc.OdbcStatementHandle, UInt16, SQL_C, System.Data.Odbc.CNativeBuffer, IntPtr, IntPtrByRef) 
System_Data_ni!System.Data.Odbc.OdbcStatementHandle.GetData(Int32, SQL_C, System.Data.Odbc.CNativeBuffer, Int32, IntPtr ByRef)+30 
System_Data_ni!System.Data.Odbc.OdbcDataReader.GetData(Int32, SQL_C, Int32, Int32 ByRef)+74 
System_Data_ni!System.Data.Odbc.OdbcDataReader.internalGetString(Int32)+1d4 
System_Data_ni!System.Data.Odbc.OdbcDataReader.GetValue(Int32, System.Data.Odbc.TypeMap)+73 
System_Data_ni!System.Data.Odbc.OdbcDataReader.GetValue(Int32)+43 
_Default.GetPatientRadiology(System.String)+330 
clr!LogHelp_LogAssert+2043 
clr!LogHelp_LogAssert+1ef8 
clr!DllUnregisterServerInternal+60f46 
clr!DllUnregisterServerInternal+613ff 
[[DebuggerU2MCatchHandlerFrame]] 
[[HelperMethodFrame_PROTECTOBJ] (System.RuntimeMethodHandle.InvokeMethod)] System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean) 
mscorlib_ni!System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[])+80 
mscorlib_ni!System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)+8e 
System.Web.Script.Services.WebServiceMethodData.CallMethod(System.Object, System.Collections.Generic.IDictionary`2<System.String,System.Object>)+139 
System.Web.Script.Services.RestHandler.InvokeMethod(System.Web.HttpContext, System.Web.Script.Services.WebServiceMethodData, System.Collections.Generic.IDictionary`2<System.String,System.Object>)+74 
System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(System.Web.HttpContext, System.Web.Script.Services.WebServiceMethodData)+5d 
System.Web.Handlers.ScriptModule.OnPostAcquireRequestState(System.Object, System.EventArgs)+120 
System_Web_ni!System.Web.HttpApplication+SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+8b 
System_Web_ni!System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep)+c3 
System_Web_ni!System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)+58 
System_Web_ni!System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)+5bc 
System_Web_ni!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)+79 
System_Web_ni!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)+1db 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)+3cd 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)+13 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)+52 
clr+21fe 
webengine4!PerfDecrementGlobalCounter+33f 
webengine4!RegisterModule+3cca 
webengine4!PerfDecrementGlobalCounter+fb 
webengine4!MgdWebSocketWriteFragment+36f 
iiscore+2e48 
iiscore+46a4 
iiscore+a775 
iiscore+1ee5 
iiscore+a81c 
webengine4!STRU::Unescape+501 
webengine4!MgdIndicateCompletion+22 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus ByRef)+7e 
[[InlinedCallFrame] (System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion)] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatusByRef) 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)+595 
System_Web_ni!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)+13 
System_Web_ni!DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)+52 
clr+2453 
clr!DllUnregisterServerInternal+4cb3a 
clr!LogHelp_LogAssert+5ca4 
[[ContextTransitionFrame]] 
clr!DllUnregisterServerInternal+4cbe5 
clr+23fd 
webengine4!PerfDecrementGlobalCounter+33f 
webengine4!PerfDecrementGlobalCounter+292 
clr!LogHelp_LogAssert+49ff 
clr!LogHelp_LogAssert+35fc 
clr!LogHelp_LogAssert+33a5 
clr!StrongNameFreeBuffer+35e3f 
kernel32!BaseThreadInitThunk+d 
ntdll!RtlUserThreadStart+1d

AppPool 当前请求

非常感谢,

大卫

标签: asp.net.netoracleiisodbc

解决方案


推荐阅读