2014-01-14 108 views
0

我有一个com +服务,其中一个线程占用50%的CPU。同一个线程的调用堆栈如下所示。Delphi COM中的高CPU消耗+

ntoskrnl.exe!KeWaitForMultipleObjects+0xc0a 
ntoskrnl.exe!KeAcquireSpinLockAtDpcLevel+0x732 
ntoskrnl.exe!KeWaitForMutexObject+0x19f 
ntoskrnl.exe!PoStartNextPowerIrp+0xba4 
ntoskrnl.exe!PoStartNextPowerIrp+0x1821 
ntoskrnl.exe!PoStartNextPowerIrp+0x1a97 
rtl160.bpl!SystemDelphiExceptionHandler$qqsp23SystemTExceptionRecorduipvt3+0x76a 

任何想法可能会出错。

另一个线程这就是消耗50%的CPU看起来像这样

Child-SP   RetAddr   Call Site 
00000000`0256b1c0 00000000`392e53d7 rtl160!SystemDelphiExceptionHandler$qqsp23SystemTExceptionRecorduipvt3+0xaba 
00000000`0256b200 00000000`773e9dad rtl160!SystemDelphiExceptionHandler$qqsp23SystemTExceptionRecorduipvt3+0x597 
00000000`0256b330 00000000`773d8a4c ntdll!RtlDecodePointer+0x12d 
00000000`0256b360 00000000`771d2d3e ntdll!RtlUnwindEx+0x43c 
00000000`0256ba00 00000000`392e522f kernel32!RtlUnwindEx+0x1e 
00000000`0256ba40 00000000`773e9d2d rtl160!SystemDelphiExceptionHandler$qqsp23SystemTExceptionRecorduipvt3+0x3ef 
00000000`0256bb70 00000000`773d91cf ntdll!RtlDecodePointer+0xad 
00000000`0256bba0 00000000`773d97c8 ntdll!RtlUnwindEx+0xbbf 
00000000`0256c280 000007fe`fd5d940d ntdll!RtlRaiseException+0x248 
00000000`0256c8c0 00000000`392e5a16 KERNELBASE!RaiseException+0x3d 
00000000`0256c990 00000000`3932f733 rtl160!SystemRaiseAtExcept$qqrrp14SystemTObjectrpv+0x106 
00000000`0256caa0 00000000`392da7c3 rtl160!SystemSysutilsEHeapExceptionRaisingException$qqrrp23SystemTExceptionRecord+0x123 
00000000`0256cad0 00000000`392da81c rtl160!SystemReleaseExceptionObject$qqrv+0x53 
00000000`0256cb10 00000000`392da3c2 rtl160!SystemError$qqr20SystemTRuntimeError+0x1c 
00000000`0256cb40 00000000`392e3168 rtl160!SystemFreeMem$qqrrpv+0x22 
00000000`0256cb70 00000000`392e3d81 rtl160!SystemTObjectFreeInstance$qqrv+0x18 
00000000`0256cba0 00000000`3932f437 rtl160!SystemClassDestroy$qqrrp14SystemTObject+0x11 
00000000`0256cbd0 00000000`392e3258 rtl160!SystemSysutilsException$bdtr$qqrv+0x57 
00000000`0256cc10 00000000`392e5b1a rtl160!SystemTObjectFree$qqrv+0x18 
00000000`0256cc40 00000000`011985a9 rtl160!SystemDestroyException$qqrrp25SystemTExceptionPointersui+0x7a 
00000000`0256cc90 00000000`392e53d7 **MyServiceDll**!DllCanUnloadNow+0xe2a9 
00000000`0256ccc0 00000000`773e9dad rtl160!SystemDelphiExceptionHandler$qqsp23SystemTExceptionRecorduipvt3+0x597 
00000000`0256cdf0 00000000`773d8a4c ntdll!RtlDecodePointer+0x12d 
00000000`0256ce20 00000000`771d2d3e ntdll!RtlUnwindEx+0x43c 
00000000`0256d4c0 00000000`392e522f kernel32!RtlUnwindEx+0x1e 
00000000`0256d500 00000000`773e9d2d rtl160!SystemDelphiExceptionHandler$qqsp23SystemTExceptionRecorduipvt3+0x3ef 
00000000`0256d630 00000000`773d91cf ntdll!RtlDecodePointer+0xad 
00000000`0256d660 00000000`773d97c8 ntdll!RtlUnwindEx+0xbbf 
00000000`0256dd40 000007fe`fd5d940d ntdll!RtlRaiseException+0x248 
00000000`0256e380 00000000`392e5a16 KERNELBASE!RaiseException+0x3d 
00000000`0256e450 00000000`3932f733 rtl160!SystemRaiseAtExcept$qqrrp14SystemTObjectrpv+0x106 
00000000`0256e560 00000000`392da7c3 rtl160!SystemSysutilsEHeapExceptionRaisingException$qqrrp23SystemTExceptionRecord+0x123 
00000000`0256e590 00000000`392da81c rtl160!SystemReleaseExceptionObject$qqrv+0x53 
00000000`0256e5d0 00000000`392da3c2 rtl160!SystemError$qqr20SystemTRuntimeError+0x1c 
00000000`0256e600 00000000`392e3168 rtl160!SystemFreeMem$qqrrpv+0x22 
00000000`0256e630 00000000`392e3d81 rtl160!SystemTObjectFreeInstance$qqrv+0x18 
00000000`0256e660 00000000`3932f437 rtl160!SystemClassDestroy$qqrrp14SystemTObject+0x11 
00000000`0256e690 00000000`392e3258 rtl160!SystemSysutilsException$bdtr$qqrv+0x57 
00000000`0256e6d0 00000000`392e5b9b rtl160!SystemTObjectFree$qqrv+0x18 
00000000`0256e700 00000000`0119837f rtl160!SystemDoneExcept$qqrv+0x3b 
*** ERROR: Symbol file could not be found. Defaulted to export symbols for rpcrt4.dll - 
00000000`0256e740 000007fe`ff5bff85 **MyServiceDll**!DllCanUnloadNow+0xe07f 
00000000`0256e880 000007fe`ff5b4de2 rpcrt4!RpcBindingSetAuthInfoW+0xe5 
00000000`0256e8f0 000007fe`fead376f rpcrt4!NdrStubCall2+0x2d2 
*** ERROR: Symbol file could not be found. Defaulted to export symbols for oleaut32.dll - 
00000000`0256ef10 000007fe`fd7a10c4 ole32!CoGetInstanceFromFile+0x7bbf 
00000000`0256ef40 000007fe`fead0ccd oleaut32!DllRegisterServer+0xde4 
00000000`0256ef90 000007fe`fead0c43 ole32!CoGetInstanceFromFile+0x511d 
00000000`0256f000 000007fe`fe98a4f0 ole32!CoGetInstanceFromFile+0x5093 
00000000`0256f0b0 000007fe`fe99d551 ole32!CoSetState+0x1450 
00000000`0256f240 000007fe`fead347e ole32!GetErrorInfo+0x599 
00000000`0256f290 000007fe`fead122b ole32!CoGetInstanceFromFile+0x78ce 
00000000`0256f300 000007fe`fead3542 ole32!CoGetInstanceFromFile+0x567b 
00000000`0256f490 000007fe`fe99d42d ole32!CoGetInstanceFromFile+0x7992 
00000000`0256f4c0 000007fe`fe99d1d6 ole32!GetErrorInfo+0x475 
*** ERROR: Symbol file could not be found. Defaulted to export symbols for user32.dll - 
00000000`0256f4f0 00000000`772d9bd1 ole32!GetErrorInfo+0x21e 
00000000`0256f570 00000000`772d98da user32!TranslateMessageEx+0x2a1 
*** ERROR: Symbol file could not be found. Defaulted to export symbols for comsvcs.dll - 
00000000`0256f630 000007fe`e5bb640d user32!TranslateMessage+0x1ea 
00000000`0256f6b0 000007fe`e5bb7474 comsvcs!Ordinal7+0x6609 
00000000`0256f6f0 000007fe`e5bb6ee2 comsvcs!Ordinal7+0x7670 
*** ERROR: Symbol file could not be found. Defaulted to export symbols for msvcrt.dll - 
00000000`0256f770 000007fe`fda3415f comsvcs!Ordinal7+0x70de 
00000000`0256f880 000007fe`fda36ebd msvcrt!srand+0x93 
00000000`0256f8b0 00000000`771b652d msvcrt!ftime64_s+0x1dd 
00000000`0256f8e0 00000000`773ec541 kernel32!BaseThreadInitThunk+0xd 
00000000`0256f910 00000000`00000000 ntdll!RtlUserThreadStart+0x21 

任何想法,为什么DllCanUnloadNow会导致系统异常?如何解决这个场景

回答

-1

它看起来像你的程序抛出一个异常,也许在一个循环中。添加MadExcept或EurekaLog以查看是否可以获取堆栈跟踪。