Closed Bug 459581 Opened 16 years ago Closed 13 years ago

Recursive invocation of XPCCycleCollectGCCallback

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: igor, Assigned: igor)

Details

During development for the bug 455548 I observed a recursive call to XPCCycleCollectGCCallback from js/src/xpconnect/src/nsXPConnect.cpp. It happens when the cycle collector triggers a release of nsJSContext when running in XPCCycleCollectGCCallback. That in turns leads to JS_DestroyContext call which in turns triggers the GC leading to a nested call to XPCCycleCollectGCCallback. Although it seems harmless on the pristine trunk, this may lead to some bad iterations with the cycle collector. Here is a typical stack trace: #2 0x04d11ece in XPCCycleCollectGCCallback (cx=0xb7b0be00, status=JSGC_BEGIN) at /home/igor/m/31-ff/js/src/xpconnect/src/nsXPConnect.cpp:363 #3 0x001ddfeb in js_GC (cx=0xb7b0be00, gckind=GC_NORMAL) at /home/igor/m/31-ff/js/src/jsgc.cpp:3193 #4 0x001acd97 in js_DestroyContext (cx=0xb7b0be00, mode=JSDCM_FORCE_GC) at /home/igor/m/31-ff/js/src/jscntxt.cpp:462 #5 0x00193cf4 in JS_DestroyContext (cx=0xb7b0be00) at /home/igor/m/31-ff/js/src/jsapi.cpp:1058 #6 0x04d0ede7 in nsXPConnect::ReleaseJSContext (this=0xb7b15cf0, aJSContext=0xb7b0be00, noGC=0) at /home/igor/m/31-ff/js/src/xpconnect/src/nsXPConnect.cpp:2010 #7 0x03679309 in nsJSContext::Unlink (this=0xb367a740) at /home/igor/m/31-ff/dom/src/base/nsJSEnvironment.cpp:1286 #8 0x036793be in nsJSContext::cycleCollection::Unlink (this=0x3b6f788, p=0xb367a740) at /home/igor/m/31-ff/dom/src/base/nsJSEnvironment.cpp:1297 #9 0x003eddbf in nsCycleCollector::CollectWhite (this=0xb7bc1000) at /home/igor/m/31-ff/xpcom/base/nsCycleCollector.cpp:1666 #10 0x003ede93 in nsCycleCollector::FinishCollection (this=0xb7bc1000) at /home/igor/m/31-ff/xpcom/base/nsCycleCollector.cpp:2440 #11 0x003edf16 in nsCycleCollector_finishCollection () at /home/igor/m/31-ff/xpcom/base/nsCycleCollector.cpp:2922 #12 0x04d11f8e in XPCCycleCollectGCCallback (cx=0xb7b0a000, status=JSGC_END) at /home/igor/m/31-ff/js/src/xpconnect/src/nsXPConnect.cpp:387 #13 0x001df01b in js_GC (cx=0xb7b0a000, gckind=GC_NORMAL) at /home/igor/m/31-ff/js/src/jsgc.cpp:3734 #14 0x00190282 in JS_GC (cx=0xb7b0a000) at /home/igor/m/31-ff/js/src/jsapi.cpp:2477 #15 0x04d11e33 in nsXPConnect::Collect (this=0xb7b15cf0) at /home/igor/m/31-ff/js/src/xpconnect/src/nsXPConnect.cpp:466 #16 0x003ee463 in nsCycleCollector::Collect (this=0xb7bc1000, aTryCollections=1) at /home/igor/m/31-ff/xpcom/base/nsCycleCollector.cpp:2256 #17 0x003ee544 in nsCycleCollector_collect () at /home/igor/m/31-ff/xpcom/base/nsCycleCollector.cpp:2904 #18 0x036732bf in nsJSContext::CC () at /home/igor/m/31-ff/dom/src/base/nsJSEnvironment.cpp:3400 #19 0x036733f8 in nsJSContext::MaybeCC (aHigherProbability=0) at /home/igor/m/31-ff/dom/src/base/nsJSEnvironment.cpp:3452 #20 0x03673932 in nsUserActivityObserver::Observe (this=0xb6167ca0, aSubject=0x0, aTopic=0x3a54e6e "user-interaction-active", aData=0x0) at /home/igor/m/31-ff/dom/src/base/nsJSEnvironment.cpp:285 #21 0x0037ad7f in nsObserverList::NotifyObservers (this=0xb4a4bb3c, aSubject=0x0, aTopic=0x3a54e6e "user-interaction-active", someData=0x0) at /home/igor/m/31-ff/xpcom/ds/nsObserverList.cpp:128 #22 0x0037c221 in nsObserverService::NotifyObservers (this=0xb7b81b80, aSubject=0x0, aTopic=0x3a54e6e "user-interaction-active", someData=0x0) at /home/igor/m/31-ff/xpcom/ds/nsObserverService.cpp:181 #23 0x034a5dda in nsUITimerCallback::Notify (this=0xb60dd920, aTimer=0xb608c740) at /home/igor/m/31-ff/content/events/src/nsEventStateManager.cpp:221 #24 0x003dbdbd in nsTimerImpl::Fire (this=0xb608c740) at /home/igor/m/31-ff/xpcom/threads/nsTimerImpl.cpp:423 #25 0x003dbfd3 in nsTimerEvent::Run (this=0xae2d88a0) at /home/igor/m/31-ff/xpcom/threads/nsTimerImpl.cpp:512 #26 0x003d5841 in nsThread::ProcessNextEvent (this=0xb7b36ec0, mayWait=1, result=0xbf917c40) at /home/igor/m/31-ff/xpcom/threads/nsThread.cpp:510 #27 0x00363d90 in NS_ProcessNextEvent_P (thread=0xb7b36ec0, mayWait=1) at nsThreadUtils.cpp:227 #28 0x0523959e in nsBaseAppShell::Run (this=0xb7a6f6f0) at /home/igor/m/31-ff/widget/src/xpwidgets/nsBaseAppShell.cpp:170 #29 0x05358737 in nsAppStartup::Run (this=0xb7a9fac0) at /home/igor/m/31-ff/toolkit/components/startup/src/nsAppStartup.cpp:182 #30 0x0013e228 in XRE_main (argc=2, argv=0xbf918344, aAppData=0xb7b0e380) at /home/igor/m/31-ff/toolkit/xre/nsAppRunner.cpp:3263 #31 0x080496f2 in main (argc=2, argv=0xbf918344) at /home/igor/m/31-ff/browser/app/nsBrowserApp.cpp:156
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.