Closed Bug 486613 Opened 15 years ago Closed 15 years ago

Assertion running test_urlformatter.js test

Categories

(Core :: XPConnect, defect, P1)

defect

Tracking

()

RESOLVED DUPLICATE of bug 486585

People

(Reporter: Waldo, Unassigned)

References

Details

(Keywords: assertion, testcase)

TEST-UNEXPECTED-FAIL | /Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/_tests/xpcshell/test_urlformatter/unit/test_urlformatter.js | test failed, see following log:
  >>>>>>>
  ### XPCOM_MEM_LEAK_LOG defined -- logging leaks to /tmp/runxpcshelltests_leaks.log
*** test pending
*** test finished
*** exiting
*** PASS ***
WARNING: nsExceptionService ignoring thread destruction after shutdown: file /Users/jwalden/moz/2/xpcom/base/nsExceptionService.cpp, line 194
###!!! ASSERTION: bad!: 'Error', file /Users/jwalden/moz/2/js/src/xpconnect/src/xpccallcontext.cpp, line 88

908daed28fa2 demonstrates the bug, sometime the Sunday before (March 22) does not -- I'm bisecting to figure out what caused this.  Putting here until it's clearer what caused the bug...

I am going to bite my tongue and not point out bug 372581 too insistently here, even though it wasted a few hours of at least one person's time trying to debug a problem his patch didn't even cause.
http://hg.mozilla.org/mozilla-central/rev/6955c8360d08 is bad.

http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a07d2c4218f9&tochange=6955c8360d08 for reference, I think the question now is which of peterv's changes caused this, but doing a last few builds now to be sure...
And the loser is:

http://hg.mozilla.org/mozilla-central/rev/1e484f30d821

Peter, could you fix this ASAP please?  TraceMonkey developers, for starters, want to be able to run tests on debug builds so as to uncover JS assertions, and this makes it impossible to do a full xpcshell test run.

The stack plus a trivial amount of debugging show that having nsWrapperCache not implement nsISupports is at least part of the problem:

find-waldo-now:~/moz/2 jwalden$ make -s -C obj-i386-apple-darwin8.11.1/toolkit/components/urlformatter/tests/ check | tools/rb/fix-macosx-stack.pl 
TEST-UNEXPECTED-FAIL | /Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/_tests/xpcshell/test_urlformatter/unit/test_urlformatter.js | test failed, see log
  /Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/_tests/xpcshell/test_urlformatter/unit/test_urlformatter.js.log:
  >>>>>>>
  *** test pending
*** test finished
*** exiting
*** PASS ***
WARNING: nsExceptionService ignoring thread destruction after shutdown: file /Users/jwalden/moz/2/xpcom/base/nsExceptionService.cpp, line 194
###!!! ASSERTION: bad!: 'Error', file /Users/jwalden/moz/2/js/src/xpconnect/src/xpccallcontext.cpp, line 88
XPCCallContext::XPCCallContext(XPCContext::LangType, JSContext*, JSObject*, JSObject*, long, unsigned int, long*, long*) (/Users/jwalden/moz/2/js/src/xpconnect/src/xpccallcontext.cpp:88)
GetContextFromObject(JSObject*) (/Users/jwalden/moz/2/js/src/xpconnect/src/xpcwrappedjsclass.cpp:583)
nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS*, nsID const&, void**) (/Users/jwalden/moz/2/js/src/xpconnect/src/xpcwrappedjsclass.cpp:645)
nsXPCWrappedJS::QueryInterface(nsID const&, void**) (/Users/jwalden/moz/2/js/src/xpconnect/src/xpcwrappedjs.cpp:184)
nsXPTCStubBase::QueryInterface(nsID const&, void**) (/Users/jwalden/moz/2/xpcom/reflect/xptcall/src/xptcall.cpp:53)
nsCreateInstanceByContractID::nsCreateInstanceByContractID(char const*, nsISupports*, unsigned int*)+0x00006380  (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/js/src/xpconnect/loader/../../../../dist/include/xpcom/nsISupportsUtils.h:203)
XPCWrappedNative::FlatJSObjectFinalized(JSContext*) (/Users/jwalden/moz/2/js/src/xpconnect/src/xpcwrappednative.cpp:1155)
XPC_WN_NoHelper_Finalize(JSContext*, JSObject*) (/Users/jwalden/moz/2/js/src/xpconnect/src/xpcwrappednativejsops.cpp:639)
js_FinalizeObject (/Users/jwalden/moz/2/js/src/jsobj.cpp:3483)
js_GC (/Users/jwalden/moz/2/js/src/jsgc.cpp:3648)
js_DestroyContext (/Users/jwalden/moz/2/js/src/jscntxt.cpp:544)
JS_DestroyContext (/Users/jwalden/moz/2/js/src/jsapi.cpp:1089)
XPCJSContextStack::~XPCJSContextStack() (/Users/jwalden/moz/2/js/src/xpconnect/src/xpcthreadcontext.cpp:61)
XPCPerThreadData::CleanupAllThreads() (/Users/jwalden/moz/2/js/src/xpconnect/src/xpcthreadcontext.cpp:505)
nsXPConnect::~nsXPConnect() (/Users/jwalden/moz/2/js/src/xpconnect/src/nsXPConnect.cpp:143)
nsXPConnect::Release() (/Users/jwalden/moz/2/js/src/xpconnect/src/nsXPConnect.cpp:56)
nsScriptSecurityManager::Shutdown() (/Users/jwalden/moz/2/caps/src/nsScriptSecurityManager.cpp:3298)
CapsModuleDtor(nsIModule*) (/Users/jwalden/moz/2/caps/src/nsSecurityManagerFactory.cpp:503)
nsGenericModule::Shutdown() (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/xpcom/build/nsGenericFactory.cpp:340)
nsGenericModule::~nsGenericModule() (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/xpcom/build/nsGenericFactory.cpp:237)
nsGenericModule::Release() (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/xpcom/build/nsGenericFactory.cpp:245)
nsSupportsWeakReference::~nsSupportsWeakReference()+0x00001D0A  (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/xpcom/string/src/../../dist/include/xpcom/nsCOMPtr.h:495)
nsSupportsWeakReference::~nsSupportsWeakReference()+0x00001D8C  (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/xpcom/string/src/../../dist/include/xpcom/nsCOMPtr.h:1181)
nsSupportsWeakReference::~nsSupportsWeakReference()+0x00003668  (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/xpcom/string/src/../../dist/include/xpcom/nsTHashtable.h:640)
nsNativeModuleLoader::ReleaserFunc(nsIHashable*, nsNativeModuleLoader::NativeLoadData&, void*) (/Users/jwalden/moz/2/xpcom/components/nsNativeComponentLoader.cpp:240)
nsSupportsWeakReference::~nsSupportsWeakReference()+0x00003459  (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/xpcom/string/src/../../dist/include/xpcom/nsBaseHashtable.h:346)
PL_DHashTableEnumerate (pldhash.c:754)
nsSupportsWeakReference::~nsSupportsWeakReference()+0x000030BE  (/Users/jwalden/moz/2/obj-i386-apple-darwin8.11.1/xpcom/string/src/../../dist/include/xpcom/nsBaseHashtable.h:221)
nsNativeModuleLoader::UnloadLibraries() (/Users/jwalden/moz/2/xpcom/components/nsNativeComponentLoader.cpp:281)
nsComponentManagerImpl::Shutdown() (/Users/jwalden/moz/2/xpcom/components/nsComponentManager.cpp:748)
NS_ShutdownXPCOM_P (/Users/jwalden/moz/2/xpcom/build/nsXPComInit.cpp:847)
NS_ShutdownXPCOM (/Users/jwalden/moz/2/xpcom/stub/nsXPComStub.cpp:175)
main (/Users/jwalden/moz/2/js/src/xpconnect/shell/xpcshell.cpp:1770)
_start (/Users/jwalden/moz/2/js/src/xpconnect/shell/xpcshell.cpp:88)
start (/Users/jwalden/moz/2/js/src/xpconnect/shell/xpcshell.cpp:88)

  <<<<<<<
make: *** [check] Error 1



(gdb) up
#5  0x0193a64f in NS_DebugBreak_P (aSeverity=1, aStr=0x30a8b54 "bad!", aExpr=0x30a7e5c "Error", aFile=0x30a8b14 "/Users/jwalden/moz/2/js/src/xpconnect/src/xpccallcontext.cpp", aLine=88) at /Users/jwalden/moz/2/xpcom/base/nsDebugImpl.cpp:350
350          Abort(buf.buffer);
(gdb) up
#6  0x030113aa in XPCCallContext::XPCCallContext (this=0xbfffe62c, callerLanguage=LANG_NATIVE, cx=0x0, obj=0x0, funobj=0x0, name=0, argc=4294967295, argv=0x0, rval=0x0) at /Users/jwalden/moz/2/js/src/xpconnect/src/xpccallcontext.cpp:88
88              NS_ERROR("bad!");
(gdb) lis
83          XPCJSContextStack* stack = mThreadData->GetJSContextStack();
84          JSContext* topJSContext;
85
86          if(!stack || NS_FAILED(stack->Peek(&topJSContext)))
87          {
88              NS_ERROR("bad!");
89              mJSContext = nsnull;
90              return;
91          }
92
(gdb) up
#7  0x030400fc in GetContextFromObject (obj=0x7aa7e0) at /Users/jwalden/moz/2/js/src/xpconnect/src/xpcwrappedjsclass.cpp:583
583         XPCCallContext ccx(NATIVE_CALLER);
(gdb) lis
578
579         if(stack && NS_SUCCEEDED(stack->Peek(&topJSContext)) && topJSContext)
580             return nsnull;
581
582         // In order to get a context, we need a context.
583         XPCCallContext ccx(NATIVE_CALLER);
584         if(!ccx.IsValid())
585             return nsnull;
586         XPCWrappedNativeScope* scope =
587             XPCWrappedNativeScope::FindInJSObjectScope(ccx, obj);
(gdb) up
#8  0x03041986 in nsXPCWrappedJSClass::DelegatedQueryInterface (this=0x635c50, self=0x635d80, aIID=@0x30d9380, aInstancePtr=0xbfffe930) at /Users/jwalden/moz/2/js/src/xpconnect/src/xpcwrappedjsclass.cpp:645
645         JSContext *context = GetContextFromObject(self->GetJSObject());
(gdb) lis
640             *aInstancePtr = (void*) static_cast<nsIPropertyBag*>(root);
641             return NS_OK;
642         }
643
644
645         JSContext *context = GetContextFromObject(self->GetJSObject());
646         XPCCallContext ccx(NATIVE_CALLER, context);
647         if(!ccx.IsValid())
648         {
649             *aInstancePtr = nsnull;
(gdb) up
#9  0x0303aa62 in nsXPCWrappedJS::QueryInterface (this=0x635d80, aIID=@0x30d9380, aInstancePtr=0xbfffe930) at /Users/jwalden/moz/2/js/src/xpconnect/src/xpcwrappedjs.cpp:184
184         return mClass->DelegatedQueryInterface(this, aIID, aInstancePtr);
(gdb) lis
179         if(outer)
180             return outer->QueryInterface(aIID, aInstancePtr);
181
182         // else...
183
184         return mClass->DelegatedQueryInterface(this, aIID, aInstancePtr);
185     }
186
187
188     // Refcounting is now similar to that used in the chained (pre-flattening)
(gdb) up
#10 0x0194210e in nsXPTCStubBase::QueryInterface (this=0x635d70, aIID=@0x30d9380, aInstancePtr=0xbfffe930) at /Users/jwalden/moz/2/xpcom/reflect/xptcall/src/xptcall.cpp:53
53          return mOuter->QueryInterface(aIID, aInstancePtr);
(gdb) up
#11 0x030bfce8 in CallQueryInterface<nsISupports, nsWrapperCache> (aSource=0x635d70, aDestination=0xbfffe930) at ../../../../dist/include/xpcom/nsISupportsUtils.h:203
203                                        reinterpret_cast<void**>(aDestination));
Flags: blocking1.9.1?
The object in question is XULAppInfo, defined in <http://mxr.mozilla.org/mozilla-central/source/toolkit/components/urlformatter/tests/unit/head_urlformatter.js>.  Should you be bailing earlier when looking at an xpconnecty thing?
Can we please disable the test until this is fixed?
Priority: -- → P1
(making p1, bad crash in GC, should probably block not that I understand what the bug is about)
I disabled the test until someone fixes this.

http://hg.mozilla.org/tracemonkey/rev/1d2bb1304fe4
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
(In reply to comment #6)
> The stack plus a trivial amount of debugging show that having nsWrapperCache
> not implement nsISupports is at least part of the problem:

I don't see what that has to do with it at all.
(In reply to comment #9)
> (making p1, bad crash in GC, should probably block not that I understand what
> the bug is about)

Need to fix the assertion for sure, but I don't see how this crashes? The failure is handled gracefully, we check for a valid call context everywhere.
This is not an assert. This is a crash during GC as the shell shuts down. Observed on macosx.
I made 486585 blocking.
Flags: blocking1.9.1?
(In reply to comment #14)
> This is not an assert. This is a crash during GC as the shell shuts down.

Please give some details about the crash, because I'm not seeing it and so can't fix it. All I see is the abort from the assertion (assertion which in this case is bogus and I can comment out without any harm).
You need to log in before you can comment on or make changes to this bug.