0

I have a production windows service written in C# against the .NET Framework 4.0 that is crashing intermittently about once a day. The system adminstrator at the remote site where the service is running extracted a dump file when the latest crash ocurred. Analysis in windbg reveals that the one of the threads threw an SEHException:

                                       PreEmptive   GC Alloc                Lock
       ID  OSID ThreadOBJ    State GC           Context       Domain   Count APT Exception
  22    c   cdc 051c2600   1009220 Enabled  0f6af244:0f6b04d4 0054b9e0     0 MTA (Threadpool Worker) System.Runtime.InteropServices.SEHException (0f43a964)

The stack from that thread is as follows:

ChildEBP RetAddr  
091ee930 71fb28ca clr!JIT_Dbl2IntSSE2+0x6
091ee954 71fb239a mscorlib_ni+0x2728ca
091ee9ac 71fb2299 mscorlib_ni+0x27239a
091ee9c4 738e21db mscorlib_ni+0x272299
091ee9d4 73904a2a clr!CallDescrWorker+0x33
091eea50 73904bcc clr!CallDescrWorkerWithHandler+0x8e
091eeb94 73904c01 clr!MethodDesc::CallDescr+0x194
091eebb0 73969c29 clr!MethodDesc::CallTargetWorker+0x21
091eec90 73995c05 clr!QueueUserWorkItemManagedCallback+0x4b
091eeca4 73995c87 clr!Thread::DoExtraWorkForFinalizer+0x114
091eed54 73995d42 clr!Thread::ShouldChangeAbortToUnload+0x101
091eedb4 73995dd9 clr!Thread::ShouldChangeAbortToUnload+0x399
091eedd8 73a656d5 clr!Thread::ShouldChangeAbortToUnload+0x43a
091eedf0 73969b67 clr!ManagedThreadBase::ThreadPool+0x15
091eeebc 73a6525f clr!ManagedPerAppDomainTPCount::DispatchWorkItem+0xe6
091eef2c 73a66ac5 clr!ThreadpoolMgr::NewWorkerThreadStart+0x20b
091eef94 73995a08 clr!ThreadpoolMgr::WorkerThreadStart+0x3d1
091efab8 7679eccb clr!Thread::intermediateThreadProc+0x4b
091efac4 7715d24d kernel32!BaseThreadInitThunk+0xe
091efb04 7715d45f ntdll!__RtlUserThreadStart+0x23
091efb1c 00000000 ntdll!_RtlUserThreadStart+0x1b

The data embedded within the SEHException is as follows:

ClassName:  System.Runtime.InteropServices.SEHException
  Message:  External component has thrown an exception.
  HResult:  -2147467259
ErrorCode:  -1073741132

Any thoughts on what might be causing this or what additional analysis can be done?

thoshaw
  • 1
  • 1

1 Answers1

0

When you get such errors, convert the codes in Hex format, which is

HRESULT 80004005
Error Code C00002B4

Google searches are much better then.

80004005 is E_FAIL, a very generic error

C00002B4 seems to be EXCEPTION_FLOAT_MULTIPLE_FAULTS

If you use a C++ component and specify the /fp:strict or /fp:except compiler switch, this is not compatible with .NET any more. See Specify Floating Point behavior at Microsoft. .NET likes floating point exceptions to be masked.

You can try fixing this by declaring

[DllImport("msvcr110.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int _controlfp(int n, int mask)

and resetting the floating point behavior after you called the C++ code:

CallMyCppCodeHere();
_controlfp(0x9001f, 0xfffff);
Community
  • 1
  • 1
Thomas Weller
  • 55,411
  • 20
  • 125
  • 222