I have a WebService named ECService.asmx, which contain 230+ WebMethods. When I separate those methods into several "asmx" or comment out half of the code, the StackOverflowException won't happen anymore.
According to MSDN:
A StackOverflowException exception is thrown when the execution stack overflows by having too many nested method calls.
I am pretty sure that I don't have any recursive methods. All they do is return a dataset upon calling, and that's all.
So I did some researchs and convinced to use whatever tool to extract a full userdump of the process (iisexpress), then use windbg tool to inspect the stack tree logged in it. I tried capturing a full userdump by using Visual Studio 2017's option "Debug> Save Dump As...":
kbn .loadby sos clr !CLRStack
then I got this
0:033> !CLRStack OS Thread Id: 0x584 (33) Child SP IP Call Site 06b625a8 77a21d3c [FaultingExceptionFrame: 06b625a8] 06b9ef00 77a21d3c [InlinedCallFrame: 06b9ef00] 06b9f540 77a21d3c [InlinedCallFrame: 06b9f540] 06b9f53c 65cce181 DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus ByRef) 06b9f540 65c7b892 [InlinedCallFrame: 06b9f540] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef) 06b9f574 65c7b892 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32) 06b9f578 65c7b39f [InlinedCallFrame: 06b9f578] 06b9f670 65c7b39f System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32) 06b9f748 05aeeb10 [ContextTransitionFrame: 06b9f748]
yet I found barely anything related to StackOverflowException. To be honest, I already don't know what to do beyond this point...
I also tried using Debug Diagnostic Tool to capture a full dump, but the rule "Crash rule for all IIS/COM+ related processes" I set up has never been triggered. Did I do it wrong? I would like to provide more information if I miss anything.
(Pardon me that I may cannot include the full file due to business sensitiveness.
Now I am intern in a business company, the manager asked me that I cannot ignore this issue by using any mechanic workarounds.)
I don't have a .NET stack overflow crash dump available right now, but here's my memory:
!threads command should list the .NET threads. If there was an exception on a thread, that thread should have an indicator in the "Exception" column. Switch to that thread with
~<number>s, then use
It should also work from native side, since .NET exceptions are also normal SEH exceptions. If you use the navtive threads command
~, there should be one thread marked with
#, which indicates a thread with an exception. If you can't see one, then it's likely the active thread, because the active thread indicator
. overrides the exception indicator. In any case, you should be able to switch to the thread with the exception using
~#s (literally, not replacing # by a number).
Whether the stack space is really exhausted, should be possible to figure out using the
!teb command and looking at the stack base and stack limit. Then compare that to the stack pointer (ESP regiser).
User contributions licensed under CC BY-SA 3.0