Closed Bug 686342 Opened 9 years ago Closed 9 years ago

Cycle collector collects nsXULTemplateBuilder too late during the shutdown process, resulting in this assertion: "Using observer service after XPCOM shutdown!"

Categories

(Core :: XUL, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: ehsan, Assigned: ehsan)

Details

(Keywords: assertion)

Attachments

(1 file, 1 obsolete file)

STR: make -C objdir crashtest TEST_PATH=editor/

This is a test path which doesn't include reftest.list, which causes the Firefox window to be closed immediately, which is followed by this assertion:

Breakpoint 1, NS_DebugBreak_P (aSeverity=1, aStr=0x1030fadf0 "Using observer service after XPCOM shutdown!", aExpr=0x102f63788 "Error", aFile=0x1030fad98 "../../../xpcom/ds/nsObserverService.cpp", aLine=143) at ../../../xpcom/base/nsDebugImpl.cpp:263
263	              const char *aFile, PRInt32 aLine)
(gdb) bt
#0  NS_DebugBreak_P (aSeverity=1, aStr=0x1030fadf0 "Using observer service after XPCOM shutdown!", aExpr=0x102f63788 "Error", aFile=0x1030fad98 "../../../xpcom/ds/nsObserverService.cpp", aLine=143) at ../../../xpcom/base/nsDebugImpl.cpp:263
#1  0x00000001027138e5 in nsObserverService::RemoveObserver (this=0x106e2f7f0, anObserver=0x11b416ac8, aTopic=0x10300ee10 "dom-window-destroyed") at ../../../xpcom/ds/nsObserverService.cpp:143
#2  0x0000000101e3b2b0 in nsXULTemplateBuilder::Uninit (this=0x11b416ac0, aIsFinal=1) at ../../../../../content/xul/templates/src/nsXULTemplateBuilder.cpp:226
#3  0x0000000101e3b9a1 in nsXULTemplateBuilder::~nsXULTemplateBuilder (this=0x11b416ac0) at ../../../../../content/xul/templates/src/nsXULTemplateBuilder.cpp:175
#4  0x0000000101e27b31 in nsXULContentBuilder::~nsXULContentBuilder (this=0x11b416ac0) at ../../../../../content/xul/templates/src/nsXULContentBuilder.cpp:105
#5  0x0000000101e3a894 in nsXULTemplateBuilder::Release (this=0x11b416ac0) at ../../../../../content/xul/templates/src/nsXULTemplateBuilder.cpp:311
#6  0x00000001026ed2e2 in nsXPCOMCycleCollectionParticipant::Unroot (this=0x103e91e90, p=0x11b416ac0) at nsCycleCollectionParticipant.cpp:76
#7  0x000000010277994b in nsCycleCollector::CollectWhite (this=0x107802800, aListener=0x0) at ../../../xpcom/base/nsCycleCollector.cpp:2044
#8  0x00000001027799b3 in nsCycleCollector::FinishCollection (this=0x107802800, aListener=0x0) at ../../../xpcom/base/nsCycleCollector.cpp:2852
#9  0x000000010277a019 in nsCycleCollector::Collect (this=0x107802800, aTryCollections=5, aListener=0x0) at ../../../xpcom/base/nsCycleCollector.cpp:2697
#10 0x000000010277a8cd in nsCycleCollector::Shutdown (this=0x107802800) at ../../../xpcom/base/nsCycleCollector.cpp:2915
#11 0x000000010277a999 in nsCycleCollector_shutdown () at ../../../xpcom/base/nsCycleCollector.cpp:3630
#12 0x00000001026f5e86 in mozilla::ShutdownXPCOM (servMgr=0x0) at ../../../xpcom/build/nsXPComInit.cpp:659
#13 0x00000001026f6235 in NS_ShutdownXPCOM_P (servMgr=0x106e17838) at ../../../xpcom/build/nsXPComInit.cpp:561
#14 0x0000000101007d8a in ScopedXPCOMStartup::~ScopedXPCOMStartup (this=0x7fff5fbfdc70) at ../../../toolkit/xre/nsAppRunner.cpp:1084
#15 0x000000010100f02d in XRE_main (argc=7, argv=0x7fff5fbfe9f0, aAppData=0x100118b00) at ../../../toolkit/xre/nsAppRunner.cpp:3586
#16 0x0000000100001b66 in do_main (exePath=0x7fff5fbfe5c0 "/Users/ehsanakhgari/moz/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/libxpcom.dylib", argc=7, argv=0x7fff5fbfe9f0) at ../../../browser/app/nsBrowserApp.cpp:198
#17 0x0000000100001dcd in main (argc=7, argv=0x7fff5fbfe9f0) at ../../../browser/app/nsBrowserApp.cpp:281
(gdb) bt full
#0  NS_DebugBreak_P (aSeverity=1, aStr=0x1030fadf0 "Using observer service after XPCOM shutdown!", aExpr=0x102f63788 "Error", aFile=0x1030fad98 "../../../xpcom/ds/nsObserverService.cpp", aLine=143) at ../../../xpcom/base/nsDebugImpl.cpp:263
	buf = {
  buffer = "\000|\001\000\001\000\000\000\020?@\033\001\000\000\000\t\000\000\000\000\000\000\000\000|\001\000\001\000\000\0000T?_?\000\000)P\v\000\001\000\000\000@S?_?\000\000?N\v\000\001\000\000\000??@\033\001\000\000\000?F\020\003\001\000\000\000`S?_?\000\000?F\020\003\001\000\000\0000?\021\000\001\000\000\000??\021\000\001\000\000\000 ?\021\000\001", '\0' <repeats 11 times>, "`S?_?\000\000kO\v\000\001\000\000\000\000b\021\000\001\000\000\000\002\000\000\000\000\000\000\000\000J\001\000\001\000\000\000P?\033\000\001\000\000\000\002\000\000\000\000\000\000\000\000J\001\000\001\000\000\000?T?_?\000\000?"..., 
  curlen = 40815616
}
	ll = PR_LOG_NONE
	sevString = 0x0
#1  0x00000001027138e5 in nsObserverService::RemoveObserver (this=0x106e2f7f0, anObserver=0x11b416ac8, aTopic=0x10300ee10 "dom-window-destroyed") at ../../../xpcom/ds/nsObserverService.cpp:143
	observerList = (nsObserverList *) 0x11b416bc8
	kungFuDeathGrip = {
  mRawPtr = 0x11b416d10
}
#2  0x0000000101e3b2b0 in nsXULTemplateBuilder::Uninit (this=0x11b416ac0, aIsFinal=1) at ../../../../../content/xul/templates/src/nsXULTemplateBuilder.cpp:226
No locals.
#3  0x0000000101e3b9a1 in nsXULTemplateBuilder::~nsXULTemplateBuilder (this=0x11b416ac0) at ../../../../../content/xul/templates/src/nsXULTemplateBuilder.cpp:175
No locals.
#4  0x0000000101e27b31 in nsXULContentBuilder::~nsXULContentBuilder (this=0x11b416ac0) at ../../../../../content/xul/templates/src/nsXULContentBuilder.cpp:105
No locals.
#5  0x0000000101e3a894 in nsXULTemplateBuilder::Release (this=0x11b416ac0) at ../../../../../content/xul/templates/src/nsXULTemplateBuilder.cpp:311
	base = (nsXULTemplateBuilder *) 0x11b416ac0
	count = 0
#6  0x00000001026ed2e2 in nsXPCOMCycleCollectionParticipant::Unroot (this=0x103e91e90, p=0x11b416ac0) at nsCycleCollectionParticipant.cpp:76
	s = (nsXULTemplateBuilder *) 0x11b416ac0
#7  0x000000010277994b in nsCycleCollector::CollectWhite (this=0x107802800, aListener=0x0) at ../../../xpcom/base/nsCycleCollector.cpp:2044
	pinfo = (PtrInfo *) 0x11cc750e8
	rv = 0
	etor = {
  mFirstBlock = 0x11cc72000, 
  mCurBlock = 0x11cc72000, 
  mNext = 0x11cc968c8, 
  mBlockEnd = 0x11ccb2008, 
  mLast = @0x107802880
}
	i = 365
	count = 4608
#8  0x00000001027799b3 in nsCycleCollector::FinishCollection (this=0x107802800, aListener=0x0) at ../../../xpcom/base/nsCycleCollector.cpp:2852
	collected = 11
#9  0x000000010277a019 in nsCycleCollector::Collect (this=0x107802800, aTryCollections=5, aListener=0x0) at ../../../xpcom/base/nsCycleCollector.cpp:2697
	whiteNodes = {
  <nsAutoArrayBase<nsTArray<PtrInfo*, nsTArrayDefaultAllocator>,4000u>> = {
    <nsTArray<PtrInfo*,nsTArrayDefaultAllocator>> = {
      <nsTArray_base<nsTArrayDefaultAllocator>> = {
        mHdr = 0x10887ea00
      }, 
      <nsTArray_SafeElementAtHelper<PtrInfo*,nsTArray<PtrInfo*, nsTArrayDefaultAllocator> >> = {<No data fields>}, <No data fields>}, 
    members of nsAutoArrayBase<nsTArray<PtrInfo*, nsTArrayDefaultAllocator>,4000u>: 
    {
      mAutoBuf = "\000\000\000\000?\017\000?p?\021\000\001\000\000\000??\b??\000\000p?\021\000\001", '\0' <repeats 11 times>, "pY?_?\000\000??\005\000\001\000\000\000\000\000\000\000\001\000\000\000\020[?_?\000\000?Y?_?\000\000`?2\b\001\000\000\000?Y?_?\000\000\n\035?\001\001\000\000\000?Y?_\001\000\000\000`Z?_?\000\000\001\000\000\000\001\000\000\000??2\b\001\000\000\000?Y?_?\000\000?U?\001\001\000\000\000?Y?_?\000\000`Z?_?\000\000\020Z?_\001\000\000\000 W?\006\001\000\000\000\020Z?_?\000\000??\001\001\000\000\000\020"..., 
      dummy = 9223389216723959808
    }
  }, <No data fields>}
	totalCollections = 0
#10 0x000000010277a8cd in nsCycleCollector::Shutdown (this=0x107802800) at ../../../xpcom/base/nsCycleCollector.cpp:2915
	listener = {
  mRawPtr = 0x0
}
#11 0x000000010277a999 in nsCycleCollector_shutdown () at ../../../xpcom/base/nsCycleCollector.cpp:3630
No locals.
#12 0x00000001026f5e86 in mozilla::ShutdownXPCOM (servMgr=0x0) at ../../../xpcom/build/nsXPComInit.cpp:659
	rv = 0
	moduleLoaders = {
  mRawPtr = 0x1083a14a0
}
#13 0x00000001026f6235 in NS_ShutdownXPCOM_P (servMgr=0x106e17838) at ../../../xpcom/build/nsXPComInit.cpp:561
No locals.
#14 0x0000000101007d8a in ScopedXPCOMStartup::~ScopedXPCOMStartup (this=0x7fff5fbfdc70) at ../../../toolkit/xre/nsAppRunner.cpp:1084
	pool = {
  mPool = 0x106b0b250
}
	appStartup = {
  mRawPtr = 0x108311ea0
}
#15 0x000000010100f02d in XRE_main (argc=7, argv=0x7fff5fbfe9f0, aAppData=0x100118b00) at ../../../toolkit/xre/nsAppRunner.cpp:3586
	xpcom = {
  mServiceManager = 0x106e17838, 
  static gNativeAppSupport = 0x0
}
	prefs = {
  mRawPtr = 0x106e2fe20
}
	flagFile = {
  mRawPtr = 0x106b030b0
}
	appInitiatedRestart = 0
	nativeApp = {
  mRawPtr = 0x106b02de0
}
	startOffline = 0
	profLD = {
  mRawPtr = 0x106b02aa0
}
	fFlagFile = {
  mRawPtr = 0x106b030b0
}
	cachesOK = 0
	updRoot = {
  mRawPtr = 0x100118d20
}
	profD = {
  mRawPtr = 0x106b02aa0
}
	canRun = 1
	persistent = 1
	profileLock = {
  mRawPtr = 0x106b02fb0
}
	profileName = {
  <nsFixedCString> = {
    <nsCString> = {
      <nsACString_internal> = {
        mData = 0x7fff5fbfdf20 "", 
        mLength = 0, 
        mFlags = 65553
      }, <No data fields>}, 
    members of nsFixedCString: 
    mFixedCapacity = 63, 
    mFixedBuf = 0x7fff5fbfdf20 ""
  }, 
  members of nsCAutoString: 
  mStorage = "\000߿_?\000\000?\021\000\001\000\000\000z\016??????p\000\000\000\000\000\000\000P߿_?\000\000??t\002\001\000\000\000 ?\021\000\001\000\000\000\000\000\000\000\000\000\000"
}
	version = {
  <nsFixedCString> = {
    <nsCString> = {
      <nsACString_internal> = {
        mData = 0x7fff5fbfdec0 "9.0a1_20110912152142/20110908170925", 
        mLength = 35, 
        mFlags = 65553
      }, <No data fields>}, 
    members of nsFixedCString: 
    mFixedCapacity = 63, 
    mFixedBuf = 0x7fff5fbfdec0 "9.0a1_20110912152142/20110908170925"
  }, 
  members of nsCAutoString: 
  mStorage = "9.0a1_20110912152142/20110908170925\000\001\000\000\000\000?\021\000\001\000\000\000?߿_?\000\000??\001\001\001\000\000"
}
	osABI = {
  <nsCString> = {
    <nsACString_internal> = {
      mData = 0x102f646a1 "Darwin_x86_64-gcc3", 
      mLength = 18, 
      mFlags = 1
    }, <No data fields>}, <No data fields>}
	versionOK = 1
	rv = 0
	ar = ARG_NONE
	home = 0x7fff5fbff346 "/Users/ehsanakhgari"
	override = 0x0
	appData = {
  <nsXREAppData> = {
    size = 112, 
    directory = 0x100118d20, 
    vendor = 0x100118fe0 "Mozilla", 
    name = 0x100118900 "Firefox", 
    version = 0x100118910 "9.0a1", 
    buildID = 0x100119000 "20110912152142", 
    ID = 0x100119010 "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", 
    copyright = 0x0, 
    flags = 14, 
    xreDirectory = 0x100119190, 
    minVersion = 0x100119040 "9.0a1", 
    maxVersion = 0x100119090 "9.0a1", 
    crashReporterURL = 0x100118de0 "https://crash-reports.mozilla.com/submit?id=ec8030f7-c20a-464f-9b0e-13a3a9e97384&version=9.0a1&buildid=20110912152142", 
    profile = 0x0
  }, <No data fields>}
	log = {<No data fields>}
	dirProvider = (nsXREDirProvider) {
  <nsIDirectoryServiceProvider2> = {
    <nsIDirectoryServiceProvider> = {
      <nsISupports> = {
        _vptr$nsISupports = 0x103bf2ef0
      }, <No data fields>}, <No data fields>}, 
  <nsIProfileStartup> = {
    <nsISupports> = {
      _vptr$nsISupports = 0x103bf2f38
    }, <No data fields>}, 
  members of nsXREDirProvider: 
  mAppProvider = {
    mRawPtr = 0x0
  }, 
  mGREDir = {
    mRawPtr = 0x100119190
  }, 
  mXULAppDir = {
    mRawPtr = 0x100118d20
  }, 
  mProfileDir = {
    mRawPtr = 0x106b02aa0
  }, 
  mProfileLocalDir = {
    mRawPtr = 0x106b02aa0
  }, 
  mProfileNotified = 0 '\0', 
  mAppBundleDirectories = {
    <nsCOMArray_base> = {
      mArray = {
        mImpl = 0x0
      }
    }, <No data fields>}, 
  mExtensionDirectories = {
    <nsCOMArray_base> = {
      mArray = {
        mImpl = 0x106bc7400
      }
    }, <No data fields>}, 
  mThemeDirectories = {
    <nsCOMArray_base> = {
      mArray = {
        mImpl = 0x106bc8d20
      }
    }, <No data fields>}
}
	i = 6
#16 0x0000000100001b66 in do_main (exePath=0x7fff5fbfe5c0 "/Users/ehsanakhgari/moz/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/libxpcom.dylib", argc=7, argv=0x7fff5fbfe9f0) at ../../../browser/app/nsBrowserApp.cpp:198
	appini = {
  mRawPtr = 0x1001187e0
}
	rv = 0
	appDataFile = 0x0
	appData = (nsXREAppData *) 0x100118b00
	result = 1148560
#17 0x0000000100001dcd in main (argc=7, argv=0x7fff5fbfe9f0) at ../../../browser/app/nsBrowserApp.cpp:281
	log = {<No data fields>}
	exePath = "/Users/ehsanakhgari/moz/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/libxpcom.dylib", '\0' <repeats 386 times>, "???_?\000\000??_?\000\000\006\003???\000\000??_?\000\000?&?_?", '\0' <repeats 18 times>, "???_?\000\000\000?_?\000\000??_?\000\000?\005?_?\000\000gcnN\000\000\000\000"...
	rv = 0
	lastSlash = 0x7fff5fbfe618 "libxpcom.dylib"
	gotCounters = 1
	initialRUsage = {
  ru_utime = {
    tv_sec = 0, 
    tv_usec = 8000
  }, 
  ru_stime = {
    tv_sec = 0, 
    tv_usec = 7142
  }, 
  ru_maxrss = 6041600, 
  ru_ixrss = 0, 
  ru_idrss = 0, 
  ru_isrss = 0, 
  ru_minflt = 2339, 
  ru_majflt = 0, 
  ru_nswap = 0, 
  ru_inblock = 0, 
  ru_oublock = 0, 
  ru_msgsnd = 0, 
  ru_msgrcv = 0, 
  ru_nsignals = 0, 
  ru_nvcsw = 0, 
  ru_nivcsw = 14
}
	result = 0
Sounds like it should be observing xpcom-shutdown and do its observer removal then.
Component: XPCOM → XUL
QA Contact: xpcom → xptoolkit.widgets
Attached patch Patch (v1) (obsolete) — Splinter Review
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Attachment #559977 - Flags: review?(bzbarsky)
You should potentially call UninitTrue so that mRoot gets cleared.
Attached patch Patch (v2)Splinter Review
Ah right...
Attachment #559977 - Attachment is obsolete: true
Attachment #559977 - Flags: review?(bzbarsky)
Attachment #559983 - Flags: review?(bzbarsky)
Try run for 9178dd64b268 is complete.
Detailed breakdown of the results available here:
    http://tbpl.allizom.org/?tree=Try&usebuildbot=1&rev=9178dd64b268
Results (out of 252 total builds):
    exception: 6
    success: 216
    warnings: 8
    failure: 22
Builds available at http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/eakhgari@mozilla.com-9178dd64b268
Comment on attachment 559983 [details] [diff] [review]
Patch (v2)

r=me
Attachment #559983 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/871bb87303e3
Target Milestone: --- → mozilla9
https://hg.mozilla.org/mozilla-central/rev/871bb87303e3
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.