nickdu
2009-08-21 14:43:02 UTC
My application is making use of ETW (Event Trace for Windows) API for
tracing. We've noticed that sometimes our application crashes and it appears
this intermittantly happens when our managed application's ETW callback is
executed. I had the debugger (cdb) attached to IIS the other day and it did
capture a crash dump when this occurred. The exception was a stack overflow.
Below is the faulting stack:
0:000> kb 50
ChildEBP RetAddr Args to Child
050cf65c 7c90de7a 7c801e3a ffffffff 800703e9 ntdll!KiFastSystemCallRet
050cf660 7c801e3a ffffffff 800703e9 050cf6d4 ntdll!NtTerminateProcess+0xc
050cf670 7a0960b1 ffffffff 800703e9 c9b72903 kernel32!TerminateProcess+0x20
050cf6d4 7a0961e1 050cf67c 0023f398 050cf814
mscorwks!EEPolicy::HandleFatalStackOverflow+0xf2
050cf6f8 7a00b617 00000001 00000000 00000000
mscorwks!EEPolicy::HandleStackOverflow+0x173
050cf714 7c9032a8 050cf800 050cfd00 050cf814
mscorwks!COMPlusFrameHandler+0x10b
050cf738 7c90327a 050cf800 050cfd00 050cf814 ntdll!ExecuteHandler2+0x26
050cf7e8 7c90e48a 00000000 050cf814 050cf800 ntdll!ExecuteHandler+0x24
050cf7e8 7c812afb 00000000 050cf814 050cf800
ntdll!KiUserExceptionDispatcher+0xe
050cfb34 7a0363d7 e053534f 00000000 00000000 kernel32!RaiseException+0x53
050cfb50 7a0c86ae 0023f398 0023f398 050cfba0 mscorwks!ReportStackOverflow+0x61
050cfb60 79e7c5d2 00000050 00100000 00080000 mscorwks!Alloc+0x3b
050cfba0 79e7c697 79304f88 c9b72393 050cfc74 mscorwks!FastAllocateObject+0x38
050cfc44 04a709d9 01875fa4 00000000 00000000 mscorwks!JIT_NewFast+0x9e
WARNING: Frame IP not in any known module. Following frames may be wrong.
050cfd0c 79e71e5f 00000004 00000000 050cfef4 0x4a709d9
050cfd24 7a0c9692 050cfed0 00000010 009531b8
mscorwks!UM2MThunk_WrapperHelper+0x1f
050cfd84 7a0c97c9 050cfe6c 0023f398 0023f398
mscorwks!UM2MThunk_WrapperWorker+0x60
050cfd98 79fd9799 050cfe6c 050cfe3c 79f7762b mscorwks!UM2MThunk_Wrapper+0x14
050cfe48 7a0c984d 00000005 7a0c97b5 050cfe6c
mscorwks!Thread::DoADCallBack+0xda
050cfea0 009531a2 ffffffff 0023f398 050cfed0 mscorwks!UM2MDoADCallBack+0x7c
050cfec8 77e05f9e 00000004 00000000 050cfef4 0x9531a2
050cff1c 77e2fa38 00ba4028 00000000 00000000
advapi32!WmipInternalNotification+0x17d
050cff60 77e2fbee 00ba4028 00000040 050cffe8
advapi32!WmipDeliverAllEvents+0x33
050cff70 77e061b1 00ba4028 00000040 050cffe4
advapi32!WmipProcessEventBuffer+0x82
050cffe8 77e2f9ee 00000000 00000004 00000000 advapi32!WmipEventPump+0x28c
050cfff4 00000000 1f1f1f1f 00000000 00000000
advapi32!WmipEventPumpFromKernel+0x42
Is this something that has been identified as a potential problem, e.g.
callbacks into managed code from unmanaged threads? I'm guessing the
unmanaged thread's stack is not that large and when the managed code executes
it ends up doing a bunch of stuff which blows out the stack, again just a
guess of mine. If this is the case what might be a solution? Should I just
set some flag in the callback and somehow get the code to run in a managed
thread? If so, what's the best way to do this? Async delegate? A dedicated
worker thread which I manage? etc.
tracing. We've noticed that sometimes our application crashes and it appears
this intermittantly happens when our managed application's ETW callback is
executed. I had the debugger (cdb) attached to IIS the other day and it did
capture a crash dump when this occurred. The exception was a stack overflow.
Below is the faulting stack:
0:000> kb 50
ChildEBP RetAddr Args to Child
050cf65c 7c90de7a 7c801e3a ffffffff 800703e9 ntdll!KiFastSystemCallRet
050cf660 7c801e3a ffffffff 800703e9 050cf6d4 ntdll!NtTerminateProcess+0xc
050cf670 7a0960b1 ffffffff 800703e9 c9b72903 kernel32!TerminateProcess+0x20
050cf6d4 7a0961e1 050cf67c 0023f398 050cf814
mscorwks!EEPolicy::HandleFatalStackOverflow+0xf2
050cf6f8 7a00b617 00000001 00000000 00000000
mscorwks!EEPolicy::HandleStackOverflow+0x173
050cf714 7c9032a8 050cf800 050cfd00 050cf814
mscorwks!COMPlusFrameHandler+0x10b
050cf738 7c90327a 050cf800 050cfd00 050cf814 ntdll!ExecuteHandler2+0x26
050cf7e8 7c90e48a 00000000 050cf814 050cf800 ntdll!ExecuteHandler+0x24
050cf7e8 7c812afb 00000000 050cf814 050cf800
ntdll!KiUserExceptionDispatcher+0xe
050cfb34 7a0363d7 e053534f 00000000 00000000 kernel32!RaiseException+0x53
050cfb50 7a0c86ae 0023f398 0023f398 050cfba0 mscorwks!ReportStackOverflow+0x61
050cfb60 79e7c5d2 00000050 00100000 00080000 mscorwks!Alloc+0x3b
050cfba0 79e7c697 79304f88 c9b72393 050cfc74 mscorwks!FastAllocateObject+0x38
050cfc44 04a709d9 01875fa4 00000000 00000000 mscorwks!JIT_NewFast+0x9e
WARNING: Frame IP not in any known module. Following frames may be wrong.
050cfd0c 79e71e5f 00000004 00000000 050cfef4 0x4a709d9
050cfd24 7a0c9692 050cfed0 00000010 009531b8
mscorwks!UM2MThunk_WrapperHelper+0x1f
050cfd84 7a0c97c9 050cfe6c 0023f398 0023f398
mscorwks!UM2MThunk_WrapperWorker+0x60
050cfd98 79fd9799 050cfe6c 050cfe3c 79f7762b mscorwks!UM2MThunk_Wrapper+0x14
050cfe48 7a0c984d 00000005 7a0c97b5 050cfe6c
mscorwks!Thread::DoADCallBack+0xda
050cfea0 009531a2 ffffffff 0023f398 050cfed0 mscorwks!UM2MDoADCallBack+0x7c
050cfec8 77e05f9e 00000004 00000000 050cfef4 0x9531a2
050cff1c 77e2fa38 00ba4028 00000000 00000000
advapi32!WmipInternalNotification+0x17d
050cff60 77e2fbee 00ba4028 00000040 050cffe8
advapi32!WmipDeliverAllEvents+0x33
050cff70 77e061b1 00ba4028 00000040 050cffe4
advapi32!WmipProcessEventBuffer+0x82
050cffe8 77e2f9ee 00000000 00000004 00000000 advapi32!WmipEventPump+0x28c
050cfff4 00000000 1f1f1f1f 00000000 00000000
advapi32!WmipEventPumpFromKernel+0x42
Is this something that has been identified as a potential problem, e.g.
callbacks into managed code from unmanaged threads? I'm guessing the
unmanaged thread's stack is not that large and when the managed code executes
it ends up doing a bunch of stuff which blows out the stack, again just a
guess of mine. If this is the case what might be a solution? Should I just
set some flag in the callback and somehow get the code to run in a managed
thread? If so, what's the best way to do this? Async delegate? A dedicated
worker thread which I manage? etc.
--
Thanks,
Nick
***@community.nospam
remove "nospam" change community. to msn.com
Thanks,
Nick
***@community.nospam
remove "nospam" change community. to msn.com