Closed Bug 817685 Opened 12 years ago Closed 3 years ago

Hang monitor deadlock the application

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
critical

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mayhemer, Unassigned, NeedInfo)

Details

If an I/O operation happens on the main thread that keeps an operation system mutex then hang monitor may try to enter the same lock after it has suspended the main thread to take a stack trace snapshot.  This situation leads to an obvious deadlock, since the main thread cannot leave the lock (it's suspended) and hang monitor is trying to acquire the lock on its thread.


Main thread
	ntdll.dll!_KiFastSystemCallRet@0() 	
 	ntdll.dll!_NtOpenFile@24()  + 0xc bytes	
 	ntdll.dll!_LdrpCheckForLoadedDll@20()  + 0xa57 bytes	
> 	ntdll.dll!_LdrGetDllHandleEx@20()  + 0x1cb bytes	
 	ntdll.dll!_LdrGetDllHandle@16()  + 0x18 bytes	
 	kernel32.dll!_LoadLibraryExW@12()  + 0x22e bytes	
 	version.dll!_GetFileVersionInfoSizeW@8()  + 0x31 bytes	
 	xul.dll!nsLocalFile::GetVersionInfoField(const char * aField, nsAString_internal & _retval)  Line 1632 + 0xf bytes	C++
 	xul.dll!nsOSHelperAppService::GetDefaultAppInfo(const nsAString_internal & aAppInfo, nsAString_internal & aDefaultDescription, nsIFile * * aDefaultApplication)  Line 485	C++
 	xul.dll!nsOSHelperAppService::GetByExtension(const nsString & aFileExt, const char * aTypeHint)  Line 581 + 0x20 bytes	C++
 	xul.dll!nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString_internal & aMIMEType, const nsACString_internal & aFileExt, bool * aFound)  Line 624 + 0x1e bytes	C++
 	xul.dll!nsExternalHelperAppService::GetFromTypeAndExtension(const nsACString_internal & aMIMEType, const nsACString_internal & aFileExt, nsIMIMEInfo * * _retval)  Line 2461 + 0x20 bytes	C++
 	xul.dll!DragDataProducer::Produce(nsDOMDataTransfer * aDataTransfer, bool * aCanDrag, nsISelection * * aSelection, nsIContent * * aDragNode)  Line 579	C++
 	xul.dll!nsContentAreaDragDrop::GetDragData(nsPIDOMWindow * aWindow, nsIContent * aTarget, nsIContent * aSelectionTargetNode, bool aIsAltKeyPressed, nsDOMDataTransfer * aDataTransfer, bool * aCanDrag, nsISelection * * aSelection, nsIContent * * aDragNode)  Line 122 + 0x13 bytes	C++
 	xul.dll!nsEventStateManager::DetermineDragTarget(nsPresContext * aPresContext, nsIContent * aSelectionTarget, nsDOMDataTransfer * aDataTransfer, nsISelection * * aSelection, nsIContent * * aTargetNode)  Line 2192 + 0x29 bytes	C++
 	xul.dll!nsEventStateManager::GenerateDragGesture(nsPresContext * aPresContext, nsMouseEvent * aEvent)  Line 2091	C++
 	xul.dll!nsEventStateManager::PreHandleEvent(nsPresContext * aPresContext, nsEvent * aEvent, nsIFrame * aTargetFrame, nsEventStatus * aStatus)  Line 1065	C++
 	xul.dll!PresShell::HandleEventInternal(nsEvent * aEvent, nsEventStatus * aStatus)  Line 6533 + 0x26 bytes	C++
 	xul.dll!PresShell::HandlePositionedEvent(nsIFrame * aTargetFrame, nsGUIEvent * aEvent, nsEventStatus * aEventStatus)  Line 6313 + 0xe bytes	C++
 	xul.dll!PresShell::HandleEvent(nsIFrame * aFrame, nsGUIEvent * aEvent, bool aDontRetargetEvents, nsEventStatus * aEventStatus)  Line 6112 + 0xc bytes	C++
 	xul.dll!nsViewManager::DispatchEvent(nsGUIEvent * aEvent, nsIView * aView, nsEventStatus * aStatus)  Line 766 + 0x14 bytes	C++
 	xul.dll!nsView::HandleEvent(nsGUIEvent * aEvent, bool aUseAttachedEvents)  Line 1070	C++
 	xul.dll!nsWindow::DispatchEvent(nsGUIEvent * event, nsEventStatus & aStatus)  Line 3579 + 0xd bytes	C++
 	xul.dll!nsWindow::DispatchWindowEvent(nsGUIEvent * event)  Line 3603	C++
 	xul.dll!nsWindow::DispatchMouseEvent(unsigned int aEventType, unsigned int wParam, long lParam, bool aIsContextMenuKey, short aButton, unsigned short aInputSource)  Line 3997 + 0x11 bytes	C++
 	xul.dll!nsWindow::ProcessMessage(unsigned int msg, unsigned int & wParam, long & lParam, long * aRetValue)  Line 4818	C++
 	xul.dll!nsWindow::WindowProcInternal(HWND__ * hWnd, unsigned int msg, unsigned int wParam, long lParam)  Line 4360 + 0x1c bytes	C++
 	xul.dll!CallWindowProcCrashProtected(long (HWND__ *, unsigned int, unsigned int, long)* wndProc, HWND__ * hWnd, unsigned int msg, unsigned int wParam, long lParam)  Line 32 + 0xf bytes	C++
 	xul.dll!nsWindow::WindowProc(HWND__ * hWnd, unsigned int msg, unsigned int wParam, long lParam)  Line 4306 + 0x17 bytes	C++
 	user32.dll!_InternalCallWinProc@20()  + 0x28 bytes	
 	user32.dll!_UserCallWinProcCheckWow@32()  + 0xb7 bytes	
 	user32.dll!_DispatchMessageWorker@8()  + 0xdc bytes	
 	user32.dll!_DispatchMessageW@4()  + 0xf bytes	
 	xul.dll!nsAppShell::ProcessNextNativeEvent(bool mayWait)  Line 325 + 0xb bytes	C++
 	xul.dll!nsBaseAppShell::OnProcessNextEvent(nsIThreadInternal * thr, bool mayWait, unsigned int recursionDepth)  Line 298 + 0x22 bytes	C++
 	xul.dll!nsThread::ProcessNextEvent(bool mayWait, bool * result)  Line 603	C++
 	xul.dll!mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate * aDelegate)  Line 118	C++
 	xul.dll!MessageLoop::RunHandler()  Line 209	C++
 	xul.dll!MessageLoop::Run()  Line 183	C++
 	xul.dll!nsBaseAppShell::Run()  Line 165	C++
 	xul.dll!nsAppShell::Run()  Line 229 + 0x6 bytes	C++
 	xul.dll!nsAppStartup::Run()  Line 291	C++
 	xul.dll!XREMain::XRE_mainRun()  Line 3822 + 0x6 bytes	C++
 	xul.dll!XREMain::XRE_main(int argc, char * * argv, const nsXREAppData * aAppData)  Line 3889 + 0x7 bytes	C++
 	xul.dll!XRE_main(int argc, char * * argv, const nsXREAppData * aAppData, unsigned int aFlags)  Line 4083 + 0xd bytes	C++
 	firefox.exe!wmain(int argc, wchar_t * * argv)  Line 105 + 0x57f bytes	C++
 	firefox.exe!__tmainCRTStartup()  Line 552 + 0x17 bytes	C
 	kernel32.dll!_BaseProcessStart@4()  + 0x23 bytes	

  
  
  
Hang monitor:
	ntdll.dll!_KiFastSystemCallRet@0() 	
 	ntdll.dll!_NtWaitForSingleObject@12()  + 0xc bytes	
 	ntdll.dll!_RtlpWaitForCriticalSection@4()  + 0x8c bytes	
> 	ntdll.dll!_RtlEnterCriticalSection@4()  + 0x46 bytes	
 	ntdll.dll!_LdrLockLoaderLock@12()  + 0x28a0 bytes	
 	ntdll.dll!_LdrGetDllHandleEx@20()  + 0x235 bytes	
 	ntdll.dll!_LdrGetDllHandle@16()  + 0x18 bytes	
 	kernel32.dll!_GetModuleHandleForUnicodeString@4()  + 0x1d bytes	
 	kernel32.dll!_BasepGetModuleHandleExW@16()  + 0xf2 bytes	
 	kernel32.dll!_GetModuleHandleW@4()  + 0x1f bytes	
 	msvcr100.dll!_initptd(_tiddata * ptd, threadlocaleinfostruct * ptloci)  Line 384	C
 	msvcr100.dll!_beginthreadex(void * security, unsigned int stacksize, unsigned int (void *)* initialcode, void * argument, unsigned int createflag, unsigned int * thrdaddr)  Line 161	C
 	xul.dll!EnsureImageHlpInitialized()  Line 274	C++
 	xul.dll!NS_StackWalk(void (void *, void *, void *)* aCallback, unsigned int aSkipFrames, void * aClosure, unsigned int aThread)  Line 468 + 0x5 bytes	C++
 	xul.dll!mozilla::HangMonitor::GetChromeHangReport(mozilla::Telemetry::ProcessedStack & aStack)  Line 137 + 0x16 bytes	C++
 	xul.dll!mozilla::HangMonitor::ThreadMain(void * __formal)  Line 184 + 0xa bytes	C++
 	nspr4.dll!_PR_NativeRunThread(void * arg)  Line 417	C
 	nspr4.dll!pr_root(void * arg)  Line 90 + 0xd bytes	C
 	msvcr100.dll!_callthreadstartex()  Line 314 + 0x6 bytes	C
 	msvcr100.dll!_threadstartex(void * ptd)  Line 292 + 0x5 bytes	C
 	kernel32.dll!_BaseThreadStart@8()  + 0x37 bytes

Hey Honza,
Do you still encounter this issue or can it be closed?

Flags: needinfo?(honzab.moz)

Marking this as Resolved > Incomplete due to the lack of info.
If anyone is able to reproduce this issue re-open it or file a new bug.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.