我有一个32位MFC应用程序,加载了一些.NET 2.0程序集。 收到转储因为它似乎挂起(被冻结)。在w7-64上运行
对我而言,看起来应该责怪FinalizerThread,但我怎样才能找到根本原因?
Loaded symbol image file: mscorwks.dll
Image path: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
0:006> !analyze -hang -v
<Cut some verbose output>
BUILD_VERSION_STRING: 6.1.7601.18229 (win7sp1_gdr.130801-1533)
MANAGED_THREAD_ID: 77c
DERIVED_WAIT_CHAIN:
Dl Eid Cid WaitType
-- --- ------- --------------------------
6 d48.3fc Pseudo Thread Handle
WAIT_CHAIN_COMMAND: ~6s;k;;
THREAD_ATTRIBUTES:
PROBLEM_CLASSES:
BlockedOn_EventHandle
Tid [0x3fc]
BLOCKING_THREAD: 000003fc
DEFAULT_BUCKET_ID: APPLICATION_HANG_BlockedOn_EventHandle
THREAD_SHA1_HASH_MOD_FUNC: 3088ee7b2b2c579d04c782e4cf604f0179eeb747
THREAD_SHA1_HASH_MOD_FUNC_OFFSET: 75f294bbc1ac358b92e8d5e7660d0d49028dba99
LAST_CONTROL_TRANSFER: from 76bc15e9 to 774a015d
FAULTING_THREAD: 000003fc
STACK_TEXT:
0751fc5c 76bc15e9 00000002 0751fcac 00000001 ntdll!NtWaitForMultipleObjects+0x15
0751fcf8 750519fc 0751fcac 0751fd20 00000000 KERNELBASE!WaitForMultipleObjectsEx+0x100
0751fd40 750541d8 00000002 7efde000 00000000 kernel32!WaitForMultipleObjectsExImplementation+0xe0
0751fd5c 72caef76 00000002 7317a410 00000000 kernel32!WaitForMultipleObjects+0x18
0751fd7c 72cb2f46 002e4498 0751fe80 002e44c8 mscorwks!WKS::WaitForFinalizerEvent+0x77
0751fd90 72c3a0bf 0751fe80 00000000 00000000 mscorwks!WKS::GCHeap::FinalizerThreadWorker+0x49
0751fda4 72c3a05b 0751fe80 0751fe2c 72d55c37 mscorwks!Thread::DoADCallBack+0x32a
0751fe38 72c39f81 0751fe80 6bdfde61 00000000 mscorwks!Thread::ShouldChangeAbortToUnload+0xe3
0751fe74 72ce36ac 0751fe80 00000000 003037c0 mscorwks!Thread::ShouldChangeAbortToUnload+0x30a
0751fe9c 72ce36bd 72cb2efb 00000008 0751fee4 mscorwks!ManagedThreadBase_NoADTransition+0x32
0751feac 72d304c4 72cb2efb 6bdfdef1 00000000 mscorwks!ManagedThreadBase::FinalizerBase+0xd
0751fee4 72d70647 00000000 00000000 00000000 mscorwks!WKS::GCHeap::FinalizerThreadStart+0xbb
0751ff88 7505336a 002e44c8 0751ffd4 774b9f72 mscorwks!Thread::intermediateThreadProc+0x49
0751ff94 774b9f72 002e44c8 984bccd8 00000000 kernel32!BaseThreadInitThunk+0xe
0:006> !threads
ThreadCount: 2
UnstartedThread: 0
BackgroundThread: 2
PendingThread: 0
DeadThread: 0
Hosted Runtime: no
PreEmptive GC Alloc Lock
ID OSID ThreadOBJ State GC Context Domain Count APT Exception
0 1 77c 003078f0 4220 Enabled 00000000:00000000 003037c0 0 STA
6 2 3fc 00313de0 b220 Enabled 00000000:00000000 003037c0 0 MTA (Finalizer)
0:006> !pe
There is no current managed exception on this thread
0:000> !FinalizeQueue
SyncBlocks to be cleaned up: 0
MTA Interfaces to be released: 0
STA Interfaces to be released: 0
----------------------------------
generation 0 has 1 finalizable objects (00313518->0031351c)
generation 1 has 0 finalizable objects (00313518->00313518)
generation 2 has 0 finalizable objects (00313518->00313518)
Ready for finalization 0 objects (0031351c->0031351c)
Statistics:
MT Count TotalSize Class Name
722e131c 1 56 System.Threading.Thread
Total 1 objects
0:006> ~0s
eax=00000000 ebx=00288a70 ecx=00000000 edx=00000000 esi=00288a70 edi=00288a70
eip=756a78d7 esp=0018fe88 ebp=0018fea8 iopl=0 nv up ei pl zr na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246
user32!NtUserGetMessage+0x15:
756a78d7 83c404 add esp,4
0:000> kn
# ChildEBP RetAddr
00 0018fe88 756a7c1d user32!NtUserGetMessage+0x15
01 0018fea8 7417a685 user32!GetMessageA+0xa1
02 0018fec4 7417ad32 mfc90!AfxInternalPumpMessage+0x1a [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\thrdcore.cpp @ 153]
03 0018fee4 7414717d mfc90!CWinThread::Run+0x5b [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\thrdcore.cpp @ 629]
04 0018fef8 00412b18 mfc90!AfxWinMain+0x6a [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\winmain.cpp @ 47]
05 0018ff88 7505336a <MyMFCApp>+0x12b18
06 0018ff94 774b9f72 kernel32!BaseThreadInitThunk+0xe
07 0018ffd4 774b9f45 ntdll!__RtlUserThreadStart+0x70
08 0018ffec 00000000 ntdll!_RtlUserThreadStart+0x1b
更新
0:000> !eeheap -gc
Number of GC Heaps: 1
generation 0 starts at 0x05381018
generation 1 starts at 0x0538100c
generation 2 starts at 0x05381000
ephemeral segment allocation context: (0x0539044c, 0x05391ff4)
segment begin allocated size
05380000 05381000 05391ff4 0x00010ff4(69620)
Large object heap starts at 0x06381000
segment begin allocated size
06380000 06381000 0638d488 0x0000c488(50312)
Total Size 0x1d47c(119932)
------------------------------
GC Heap Size 0x1d47c(119932)
更新2:
我跑了!DumpHeap 0x05381018(从0代开始), 没有错误输出。还运行了!VerifyHeap和!heap -s -v(在本地堆上)没有可疑输出。