Closed Bug 240747 Opened 20 years ago Closed 16 years ago

###!!! ASSERTION: Potential deadlock between XPCJSRuntime::mMapLockMonitor@f30290 and Monitor@12df28: 'Error'

Categories

(Core :: XPConnect, defect, P5)

x86
Windows XP
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

()

Details

Attachments

(1 file)

This is trunklike from last weekend with some modifications to xpconnect (adding
nsIClassInfo to classes for bug XXX, addressing an nsMemoryImpl::Alloc assert
when thunking empty arrays for bug XXX), some minor changes to jsd among other
minor things. Lastly there is a hook into chrome to enable the execution of a js
file as chrome. The hook uses the subscript loader, as does some of the code
which is loaded by that hook.

I'm not running w/ NS_TRACE_MALLOC_XXX (I regret that...)

@see bug 181102, bug 183626

some console spew:
--WEBSHELL == 6
GetPrimaryFrameFor() called while nsFrameManager is being destroyed!
--WEBSHELL == 5
WARNING: getting z level of unregistered window, file
r:/mozilla/xpfe/appshell/src/nsWindowMediator.
cpp, line 636
WARNING: getting z level of unregistered window, file
r:/mozilla/xpfe/appshell/src/nsWindowMediator.
cpp, line 636
WARNING: Asked to remove non-existent observer, file
r:/mozilla/content/base/src/nsImageLoadingConte
nt.cpp, line 299
--WEBSHELL == 4
--WEBSHELL == 3
###!!! ASSERTION: Potential deadlock between
XPCJSRuntime::mMapLockMonitor@f30290 and Monitor@12df28
: 'Error', file r:/mozilla/xpcom/threads/nsAutoLock.cpp, line 299
Break: at file r:/mozilla/xpcom/threads/nsAutoLock.cpp, line 299

I'm a bit confused about the second Monitor, I'm not used to seeing them without
pretty names.

Stack:
 	ntdll.dll!DbgBreakPoint() 	
 	xpcom.dll!nsDebug::Assertion(const char * aStr=0x0012de7c, const char *
aExpr=0x00384c44, const char * aFile=0x0038e6c4, int aLine=299)  Line 109	C++
 	xpcom.dll!nsAutoLockBase::nsAutoLockBase(void * addr=0x03aa27a0,
nsAutoLockBase::nsAutoLockType type=eAutoMonitor)  Line 299 + 0x1b	C++
 	xpc3250.dll!XPCAutoLock::XPCAutoLock(PRMonitor * lock=0x00000000)  Line 289	C++
 	xpc3250.dll!XPCWrappedNative::GetSet()  Line 1789 + 0x17	C++
 	xpc3250.dll!XPCWrappedNative::HasMutatedSet()  Line 1817 + 0x1b	C++
 	xpc3250.dll!XPC_WN_Helper_NewResolve(JSContext * cx=0x6169746e, JSObject *
obj=0x6564206c, long idval=1869374561, unsigned int flags=1646291811, JSObject *
* objp=0x65777465)  Line 945 + 0xc	C++
 	js3250.dll!_js_LookupProperty(JSContext * cx=0x0373a288, JSObject *
obj=0x00ed06c0, long id=15927856, JSObject * * objp=0x0012e078, JSProperty * *
propp=0x0012e07c, const char * file=0x01174098, unsigned int line=2300)  Line
2406 + 0x16	C
 	js3250.dll!LookupProperty(JSContext * cx=0x0373a288, JSObject *
obj=0x00282fa0, const char * name=0x011cfb00, JSObject * * objp=0x0012e078,
JSProperty * * propp=0x0012e07c)  Line 2300 + 0x1d	C
 	js3250.dll!JS_LookupProperty(JSContext * cx=0x0373a288, JSObject *
obj=0x00ed06c0, const char * name=0x011cfb00, long * vp=0x0012e0b0)  Line 2457
+ 0x16	C
 	xpc3250.dll!DEBUG_CheckForComponentsInScope(XPCCallContext & ccx={...},
JSObject * obj=0x00ed06c0, int OKIfNotInitialized=0)  Line 536 + 0x1b	C++
 	xpc3250.dll!XPCWrappedNativeScope::FindInJSObjectScope(XPCCallContext &
ccx={...}, JSObject * obj=0x00ed06c0, int OKIfNotInitialized=0)  Line 596 + 0xa	C++
 	xpc3250.dll!XPCConvert::NativeInterface2JSObject(XPCCallContext & ccx={...},
nsIXPConnectJSObjectHolder * * dest=0x0012e1d4, nsISupports * src=0x02f89b90,
const nsID * iid=0x011cb580, JSObject * scope=0x02fcdc48, unsigned int *
pErr=0x0012e1a0)  Line 1049 + 0xd	C++
 	xpc3250.dll!nsXPConnect::WrapNative(JSContext * aJSContext=0x0373a288,
JSObject * aScope=0x02fcdc48, nsISupports * aCOMObj=0x02f89b90, const nsID &
aIID={...}, nsIXPConnectJSObjectHolder * * _retval=0x0012e1d4)  Line 568 + 0x19	C++
 	xpc3250.dll!xpc_NewIDObject(JSContext * cx=0x0373a288, JSObject *
jsobj=0x02fcdc48, const nsID & aID={...})  Line 979 + 0x1b	C++
 	xpc3250.dll!nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(XPCCallContext &
ccx={...}, JSObject * jsobj=0x02fcdc48, const nsID & aIID={...})  Line 267 + 0xc	C++
 	xpc3250.dll!nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS *
self=0x038ba1a8, const nsID & aIID={...}, void * * aInstancePtr=0x0012e304) 
Line 589	C++
 	xpc3250.dll!nsXPCWrappedJS::QueryInterface(const nsID & aIID={...}, void * *
aInstancePtr=0x0012e304)  Line 97 + 0xa	C++
 	xpcom.dll!nsQueryInterface::operator()(const nsID & aIID={...}, void * *
answer=0x0012e304)  Line 52	C++
 	xpc3250.dll!nsCOMPtr<nsIClassInfo>::assign_from_qi(nsQueryInterface qi={...},
const nsID & aIID={...})  Line 1030 + 0x12	C++
 	xpc3250.dll!nsCOMPtr<nsIClassInfo>::nsCOMPtr<nsIClassInfo>(nsQueryInterface
qi={...})  Line 572	C++
 	xpc3250.dll!XPCWrappedNative::GetNewOrUsed(XPCCallContext & ccx={...},
nsISupports * Object=0x00000000, XPCWrappedNativeScope * Scope=0x030bef60,
XPCNativeInterface * Interface=0x03211ea0, XPCWrappedNative * *
resultWrapper=0x0012e3dc)  Line 288	C++
 	xpc3250.dll!XPCConvert::NativeInterface2JSObject(XPCCallContext & ccx={...},
nsIXPConnectJSObjectHolder * * dest=0x0012e498, nsISupports * src=0x038ba1a8,
const nsID * iid=0x0012e5d0, JSObject * scope=0x027e3060, unsigned int *
pErr=0x0012e620)  Line 1065 + 0x11	C++
 	xpc3250.dll!XPCConvert::NativeData2JS(XPCCallContext & ccx={...}, long *
d=0x65746f50, const void * s=0x6169746e, const nsXPTType & type={...}, const
nsID * iid=0x6f6c6461, JSObject * scope=0x62206b63, unsigned int *
pErr=0x65777465)  Line 466 + 0x1f	C++
 	xpc3250.dll!XPCWrappedNative::CallMethod(XPCCallContext & ccx={...},
XPCWrappedNative::CallMode mode=CALL_GETTER)  Line 2117 + 0x24	C++
 	xpc3250.dll!XPC_WN_GetterSetter(JSContext * cx=0x0373a288, JSObject *
obj=0x027e3060, unsigned int argc=0, long * argv=0x0395c350, long *
vp=0x0012e728)  Line 1319 + 0xb	C++
 	js3250.dll!js_Invoke(JSContext * cx=0x6f6c6461, unsigned int argc=1646291811,
unsigned int flags=1702327397)  Line 941 + 0x11	C
 	js3250.dll!js_InternalInvoke(JSContext * cx=0x02f0066c, JSObject *
obj=0x027e3060, long fval=41824384, unsigned int flags=0, unsigned int argc=0,
long * argv=0x00000000, long * rval=0x0012e9d8)  Line 1035 + 0xe	C
 	js3250.dll!js_InternalGetOrSet(JSContext * cx=0x0373a288, JSObject *
obj=0x027e3060, long id=15582920, long fval=41824384, JSAccessMode
mode=JSACC_READ, unsigned int argc=0, long * argv=0x00000000, long *
rval=0x0012e9d8)  Line 1078 + 0x19	C
 	js3250.dll!js_GetProperty(JSContext * cx=0x0373a288, JSObject *
obj=0x027e3060, long id=15582920, long * vp=0x0012e9d8)  Line 2672 + 0x1d	C
 	js3250.dll!js_Interpret(JSContext * cx=0x62206b63, long * result=0x65777465) 
Line 2793 + 0x34d	C
 	js3250.dll!js_Execute(JSContext * cx=0x00f19238, JSObject * chain=0x03038628,
JSScript * script=0x02e18390, JSStackFrame * down=0x00000000, unsigned int
special=0, long * result=0x0012ede0)  Line 1157	C
 	js3250.dll!JS_EvaluateUCScriptForPrincipals(JSContext * cx=0x0373a288,
JSObject * obj=0x03038628, JSPrincipals * principals=0x01e31d6c, const unsigned
short * chars=0x03bef830, unsigned int length=16557, const char *
filename=0x02ca9478, unsigned int lineno=1, long * rval=0x0012ede0)  Line 3541
+ 0xf	C
 	js3250.dll!JS_EvaluateScriptForPrincipals(JSContext * cx=0x0373a288, JSObject
* obj=0x03038628, JSPrincipals * principals=0x01e31d6c, const char *
bytes=0x03b213f8, unsigned int length=16557, const char * filename=0x02ca9478,
unsigned int lineno=1, long * rval=0x0012ede0)  Line 3507	C
 	xpc3250.dll!mozJSSubScriptLoader::LoadSubScript(const unsigned short *
__formal=0x032b5420)  Line 320	C++
 	xpcom.dll!XPTC_InvokeByIndex(nsISupports * that=0x03097920, unsigned int
methodIndex=3, unsigned int paramCount=1, nsXPTCVariant * params=0x0012eb70) 
Line 102	C++
 	xpc3250.dll!XPCWrappedNative::CallMethod(XPCCallContext & ccx={...},
XPCWrappedNative::CallMode mode=CALL_METHOD)  Line 2028 + 0x15	C++
 	xpc3250.dll!XPC_WN_CallMethod(JSContext * cx=0x0373a288, JSObject *
obj=0x027906d8, unsigned int argc=1, long * argv=0x03137d80, long *
vp=0x0012ede0)  Line 1287 + 0xa	C++
 	js3250.dll!js_Invoke(JSContext * cx=0x6f6c6461, unsigned int argc=1646291811,
unsigned int flags=1702327397)  Line 941 + 0x11	C
 	js3250.dll!js_Interpret(JSContext * cx=0x62206b63, long * result=0x65777465) 
Line 2964	C
 	js3250.dll!js_Invoke(JSContext * cx=0x6f6c6461, unsigned int argc=1646291811,
unsigned int flags=1702327397)  Line 958 + 0xa	C
 	js3250.dll!js_InternalInvoke(JSContext * cx=0x0373a2b4, JSObject *
obj=0x03333f98, long fval=41485992, unsigned int flags=0, unsigned int argc=1,
long * argv=0x0012f1fc, long * rval=0x0012f224)  Line 1035 + 0xe	C
 	js3250.dll!JS_CallFunctionValue(JSContext * cx=0x0373a288, JSObject *
obj=0x03333f98, long fval=41485992, unsigned int argc=1, long * argv=0x0012f1fc,
long * rval=0x0012f224)  Line 3590 + 0x1a	C
 	gklayout.dll!nsJSContext::CallEventHandler(JSObject * aTarget=0x03333f98,
JSObject * aHandler=0x027906a8, unsigned int argc=1, long * argv=0x0012f1fc,
long * rval=0x00f304e0)  Line 1294 + 0x16	C++
 	gklayout.dll!nsJSEventListener::HandleEvent(nsIDOMEvent * aEvent=0x0372d3a0) 
Line 175 + 0x1c	C++
 	gklayout.dll!nsEventListenerManager::HandleEventSubType(nsListenerStruct *
aListenerStruct=0x03183894, nsIDOMEvent * aDOMEvent=0x0372d3a0,
nsIDOMEventTarget * aCurrentTarget=0x0303a808, unsigned int aSubType=57856940,
unsigned int aPhaseFlags=4189208)  Line 1435	C++
 	gklayout.dll!nsEventListenerManager::HandleEvent(nsIPresContext *
aPresContext=0x00000000, nsEvent * aEvent=0x0012f5e8, nsIDOMEvent * *
aDOMEvent=0x0012f4d4, nsIDOMEventTarget * aCurrentTarget=0x0303a808, unsigned
int aFlags=7, nsEventStatus * aEventStatus=0x0012f640)  Line 1512	C++
 	gklayout.dll!nsXULElement::HandleDOMEvent(nsIPresContext *
aPresContext=0x6169746e, nsEvent * aEvent=0x6564206c, nsIDOMEvent * *
aDOMEvent=0x6f6c6461, unsigned int aFlags=1646291811, nsEventStatus *
aEventStatus=0x65777465)  Line 2852	C++
 	gklayout.dll!PresShell::HandleDOMEventWithTarget(nsIContent *
aTargetContent=0x036d41f0, nsEvent * aEvent=0x0012f5e8, nsEventStatus *
aStatus=0x0012f640)  Line 6103	C++
 	gklayout.dll!nsButtonBoxFrame::MouseClicked(nsIPresContext *
aPresContext=0x03019520, nsGUIEvent * aEvent=0x0012f71c)  Line 178	C++
 	gklayout.dll!nsButtonBoxFrame::HandleEvent(nsIPresContext *
aPresContext=0x03019520, nsGUIEvent * aEvent=0x0012f71c, nsEventStatus *
aEventStatus=0x0012f8c8)  Line 147	C++
 	gklayout.dll!PresShell::HandleEventInternal(nsEvent * aEvent=0x0012f71c,
nsIView * aView=0x00000000, unsigned int aFlags=1, nsEventStatus *
aStatus=0x0012f8c8)  Line 6067 + 0x13	C++
 	gklayout.dll!PresShell::HandleEventWithTarget(nsEvent * aEvent=0x0012f71c,
nsIFrame * aFrame=0x038e5874, nsIContent * aContent=0x033a8c60, unsigned int
aFlags=1, nsEventStatus * aStatus=0x0012f8c8)  Line 5979	C++
 	gklayout.dll!nsEventStateManager::CheckForAndDispatchClick(nsIPresContext *
aPresContext=0x6f6c6461, nsMouseEvent * aEvent=0x62206b63, nsEventStatus *
aStatus=0x65777465)  Line 2917	C++
 	gklayout.dll!nsEventStateManager::PostHandleEvent(nsIPresContext *
aPresContext=0x03019520, nsEvent * aEvent=0x0012f9e0, nsIFrame *
aTargetFrame=0x038e5874, nsEventStatus * aStatus=0x0012f8c8, nsIView *
aView=0x033e5cd8)  Line 1927 + 0xf	C++
>	gklayout.dll!PresShell::HandleEventInternal(nsEvent * aEvent=0x0012f9e0,
nsIView * aView=0x033e5cd8, unsigned int aFlags=1, nsEventStatus *
aStatus=0x0012f8c8)  Line 6075 + 0x1e	C++
 	gklayout.dll!PresShell::HandleEvent(nsIView * aView=0x033e5cd8, nsGUIEvent *
aEvent=0x0012f9e0, nsEventStatus * aEventStatus=0x0012f8c8, int aForceHandle=1,
int & aHandled=23942976)  Line 5916 + 0x11	C++
 	gklayout.dll!nsViewManager::HandleEvent(nsView * aView=0x6f6c6461, nsGUIEvent
* aEvent=0x62206b63, int aCaptured=1702327397)  Line 2285	C++
 	gklayout.dll!nsViewManager::DispatchEvent(nsGUIEvent * aEvent=0x3d888889,
nsEventStatus * aStatus=0x0012f934)  Line 2025 + 0x14	C++
 	gklayout.dll!HandleEvent(nsGUIEvent * aEvent=0x0012f9e0)  Line 79	C++
 	gkwidget.dll!nsWindow::DispatchEvent(nsGUIEvent * event=0x0012f9e0,
nsEventStatus & aStatus=nsEventStatus_eIgnore)  Line 1067 + 0x3	C++
 	gkwidget.dll!nsWindow::DispatchWindowEvent(nsGUIEvent * event=0x00000000) 
Line 1088	C++
 	gkwidget.dll!nsWindow::DispatchMouseEvent(unsigned int aEventType=301,
unsigned int wParam=0, nsPoint * aPoint=0x00000000)  Line 5261	C++
 	gkwidget.dll!ChildWindow::DispatchMouseEvent(unsigned int aEventType=301,
unsigned int wParam=0, nsPoint * aPoint=0x00000000)  Line 5513 + 0x13	C++
 	gkwidget.dll!nsWindow::ProcessMessage(unsigned int msg=514, unsigned int
wParam=0, long lParam=3014707, long * aRetValue=0x0012fce8)  Line 4090 + 0x11	C++
 	gkwidget.dll!nsWindow::WindowProc(HWND__ * hWnd=0x00031328, unsigned int
msg=514, unsigned int wParam=0, long lParam=58487644)  Line 1349 + 0x10	C++
 	user32.dll!77d43a50() 	
 	user32.dll!77d43b1f() 	
 	user32.dll!GetMessageW()  + 0x125	
 	user32.dll!DispatchMessageW()  + 0xb	
 	appshell.dll!nsAppShellService::Run()  Line 524	C++
 	mozilla.exe!main1(int argc=1869374561, char * * argv=0x62206b63, nsISupports *
nativeApp=0x65777465)  Line 1304	C++
 	mozilla.exe!main(int argc=1, char * * argv=0x003f7b60)  Line 1777 + 0x16	C++
 	mozilla.exe!mainCRTStartup()  Line 400 + 0x11	C
 	kernel32.dll!GetCurrentDirectoryW()  + 0x44	

I can see monitors at:
#4>	xpc3250.dll!XPCWrappedNative::GetSet()  Line 1789 + 0x17	C++
#11>	xpc3250.dll!XPCWrappedNativeScope::FindInJSObjectScope(XPCCallContext &
ccx={...}, JSObject * obj=0x00ed06c0, int OKIfNotInitialized=0)  Line 596 + 0xa	C++

But, those should be fine.
I finally noticed that the second thing is sorta imaginary
the caller is XPCWrappedNative::GetSet()
and it calls XPCAutoLock w/ PRMonitor * lock = 0x0
now...
the normal non ifdef DEBUG code basically does nothing for !lock
but the ifdef DEBUG code passes |(void*) this| into nsAutoLockBase
it seems fairly silly to me to assert about deadlock for a case where one of
the locks isn't real.

this code is jband's. I'd like to remove the ifdef DEBUG case.
*** Bug 252733 has been marked as a duplicate of this bug. ***
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P5
BTW: I stumbled across a website where you can see this assertion happening, it's https://implicit.harvard.edu/implicit/Process?mode=processStudy&xmlDocument=/implicit/research/education/age/age.xml Just click on the "Click Here to Begin" link (i do not have Flash installed btw for the green checkmark), then close the window that now opened and now close the tab/window with the website. Now the assertion should fire.
This makes debugging incredibly painful...
Flags: blocking1.9a2?
Attached file Stack trace
I've also started seeing this since adding nsIClassInfo.THREADSAFE to one of our XPCOM components that was written in JS. Here's the stack.
Flags: blocking1.9a2? → blocking1.9-
Whiteboard: [wanted-1.9]
(In reply to comment #5)
> I've also started seeing this since adding nsIClassInfo.THREADSAFE to one of
> our XPCOM components that was written in JS. Here's the stack.
> 

These assertions disappeared when we applied the fix for bug 280236.
Noting dependency.

/be
Depends on: 280236
QA Contact: pschwartau → xpconnect
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/js/src/xpconnect/src/xpcprivate.h&rev=1.279&mark=316#307
it looks like I "fixed" this in rev 1.193 in September of 2006
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: