问题
I'm trying to troubleshoot a COM+ application that deadlocks intermittently. The last time it locked up, I was able to take a usermode dump of the dllhost process and analyze it using WinDbg. After inspecting all the threads and locks, it all boils down to a critical section owned by this thread:
ChildEBP RetAddr Args to Child
0deefd00 7c822114 77e6bb08 000004d4 00000000 ntdll!KiFastSystemCallRet
0deefd04 77e6bb08 000004d4 00000000 0deefd48 ntdll!ZwWaitForSingleObject+0xc
0deefd74 77e6ba72 000004d4 00002710 00000000 kernel32!WaitForSingleObjectEx+0xac
0deefd88 75bb22b9 000004d4 00002710 00000000 kernel32!WaitForSingleObject+0x12
0deeffb8 77e660b9 000a5cc0 00000000 00000000 comsvcs!PingThread+0xf6
0deeffec 00000000 75bb21f1 000a5cc0 00000000 kernel32!BaseThreadStart+0x34
The object it's waiting on is an event:
0:016> !handle 4d4 f
Handle 000004d4
Type Event
Attributes 0
GrantedAccess 0x1f0003:
Delete,ReadControl,WriteDac,WriteOwner,Synch
QueryState,ModifyState
HandleCount 2
PointerCount 4
Name <none>
No object specific information available
As far as I can tell, the event never gets signaled, causing the thread to hang and hold up several other threads in the process. Does anyone have any suggestions for next steps in figuring out what's going on?
Now, seeing as the method is called PingThread, is it possible that it's trying to ping another thread in the process that's already deadlocked?
UPDATE
This actually turned out to be a bug in the Oracle 10.2.0.1 client. Although, I'm still interested in ideas on how I could have figured this out without finding the bug in Oracle's bug database.
回答1:
SIEExtPub can help you figure out locks in COM
And here is article about this
If you have any trouble in using this extension please post back
回答2:
You could use !locks
which will try to auto analyse deadlocks and then dump the call stacks of the threads ~* kb
and check which threads are waiting on the critical section or event objects.
There is an example usage here: http://www.dumpanalysis.org/blog/index.php/2007/07/28/crash-dump-analysis-patterns-part-9c/
plus the guy's site has lots of examples of using WinDbg for other types of deadlocks including managed code: http://www.dumpanalysis.org/ just do a search on the page for 'deadlock', hope this helps.
来源:https://stackoverflow.com/questions/2374811/troubleshooting-a-com-application-deadlock