Closed Bug 793738 Opened 13 years ago Closed 4 years ago

ValueObserver not threadsafe

Categories

(Core :: Preferences: Backend, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dzbarsky, Unassigned)

References

Details

Attachments

(1 file)

Assertion failure: _mOwningThread.GetThread() == PR_GetCurrentThread() (ValueObserver not thread-safe), at /Users/dzbarsky/mozilla/inbound/modules/libpref/src/Preferences.cpp:131 [1] 95190 segmentation fault ~/mozilla/obj-inbound/dist/NightlyDebug.app/Contents/MacOS/firefox -P
Attached patch PatchSplinter Review
Roc, you reviewed the last changes to this file, but feel free to pass this off to someone else if you want.
Assignee: nobody → dzbarsky
Status: NEW → ASSIGNED
Attachment #664093 - Flags: review?(roc)
I don't think marking it threadsafe is the right solution. The pref service should _never_ be used off the main thread, and this suggests to me that someone is registering/unregistering off the main thread, which is bad.
Correct. The stack for the assertion should pinpoint the real problem.
(gdb) bt #0 mozilla::ValueObserver::Release (this=0x11863aef0) at /Users/dzbarsky/mozilla/inbound/modules/libpref/src/Preferences.cpp:131 #1 0x0000000101015b5b in nsCOMPtr<nsIObserver>::~nsCOMPtr (this=0x118662b88) at nsCOMPtr.h:492 #2 0x0000000101014c25 in nsCOMPtr<nsIObserver>::~nsCOMPtr (this=0x118662b88) at nsCOMPtr.h:489 #3 0x00000001012ea13e in PrefCallback::~PrefCallback (this=0x118662b60) at nsPrefBranch.h:87 #4 0x00000001012e87d5 in PrefCallback::~PrefCallback (this=0x118662b60) at nsPrefBranch.h:85 #5 0x00000001012e940d in nsAutoPtr<PrefCallback>::~nsAutoPtr (this=0x10a93e538) at nsAutoPtr.h:71 #6 0x00000001012e8965 in nsAutoPtr<PrefCallback>::~nsAutoPtr (this=0x10a93e538) at nsAutoPtr.h:70 #7 0x00000001012ea0e5 in nsBaseHashtableET<PrefCallback, nsAutoPtr<PrefCallback> >::~nsBaseHashtableET (this=0x10a93e500) at nsBaseHashtable.h:385 #8 0x00000001012ea0b5 in nsBaseHashtableET<PrefCallback, nsAutoPtr<PrefCallback> >::~nsBaseHashtableET (this=0x10a93e500) at nsBaseHashtable.h:385 #9 0x00000001012e9dac in nsTHashtable<nsBaseHashtableET<PrefCallback, nsAutoPtr<PrefCallback> > >::s_ClearEntry (table=0x10a61e180, entry=0x10a93e500) at nsTHashtable.h:464 #10 0x00000001032a3c4d in PL_DHashTableRawRemove (table=0x10a61e180, entry=0x10a93e500) at pldhash.cpp:684 #11 0x00000001032a3def in PL_DHashTableEnumerate (table=0x10a61e180, etor=0x1012e90e0 <nsBaseHashtable<PrefCallback, nsAutoPtr<PrefCallback>, PrefCallback*>::s_EnumStub(PLDHashTable*, PLDHashEntryHdr*, unsigned int, void*)>, arg=0x7fff5fbfe618) at pldhash.cpp:718 #12 0x00000001012e8b9c in nsBaseHashtable<PrefCallback, nsAutoPtr<PrefCallback>, PrefCallback*>::Enumerate (this=0x10a61e180, enumFunc=0x1012e7410 <FreeObserverFunc(PrefCallback*, nsAutoPtr<PrefCallback>&, void*)>, userArg=0x0) at nsBaseHashtable.h:221 #13 0x00000001012e3e7a in nsPrefBranch::freeObserverList (this=0x10a61e130) at /Users/dzbarsky/mozilla/inbound/modules/libpref/src/nsPrefBranch.cpp:660 #14 0x00000001012e733a in nsPrefBranch::Observe (this=0x10a61e130, aSubject=0x10a606b58, aTopic=0x1046204d4 "xpcom-shutdown", someData=0x0) at /Users/dzbarsky/mozilla/inbound/modules/libpref/src/nsPrefBranch.cpp:607 #15 0x00000001012e738f in non-virtual thunk to nsPrefBranch::Observe(nsISupports*, char const*, unsigned short const*) () at /Users/dzbarsky/mozilla/inbound/modules/libpref/src/nsPrefBranch.cpp:609 #16 0x00000001032d0e06 in nsObserverList::NotifyObservers (this=0x1009fb740, aSubject=0x10a606b58, aTopic=0x1046204d4 "xpcom-shutdown", someData=0x0) at /Users/dzbarsky/mozilla/inbound/xpcom/ds/nsObserverList.cpp:99 #17 0x00000001032d31d7 in nsObserverService::NotifyObservers (this=0x10a61c940, aSubject=0x10a606b58, aTopic=0x1046204d4 "xpcom-shutdown", someData=0x0) at /Users/dzbarsky/mozilla/inbound/xpcom/ds/nsObserverService.cpp:149 #18 0x00000001032af368 in mozilla::ShutdownXPCOM (servMgr=0x10a606b58) at /Users/dzbarsky/mozilla/inbound/xpcom/build/nsXPComInit.cpp:545 #19 0x00000001032af165 in NS_ShutdownXPCOM_P (servMgr=0x10a606b58) at /Users/dzbarsky/mozilla/inbound/xpcom/build/nsXPComInit.cpp:506 #20 0x000000010100a12f in ScopedXPCOMStartup::~ScopedXPCOMStartup (this=0x10a101de0) at /Users/dzbarsky/mozilla/inbound/toolkit/xre/nsAppRunner.cpp:1111 #21 0x000000010100a055 in ScopedXPCOMStartup::~ScopedXPCOMStartup (this=0x10a101de0) at /Users/dzbarsky/mozilla/inbound/toolkit/xre/nsAppRunner.cpp:1093 #22 0x0000000101011b11 in XREMain::XRE_main (this=0x7fff5fbfea78, argc=3, argv=0x7fff5fbff660, aAppData=0x1000081c0) at /Users/dzbarsky/mozilla/inbound/toolkit/xre/nsAppRunner.cpp:3869 #23 0x0000000101011e8f in XRE_main (argc=3, argv=0x7fff5fbff660, aAppData=0x1000081c0, aFlags=0) at /Users/dzbarsky/mozilla/inbound/toolkit/xre/nsAppRunner.cpp:3923 #24 0x0000000100001ebc in do_main (argc=3, argv=0x7fff5fbff660) at /Users/dzbarsky/mozilla/inbound/browser/app/nsBrowserApp.cpp:174 #25 0x0000000100001785 in main (argc=3, argv=0x7fff5fbff660) at /Users/dzbarsky/mozilla/inbound/browser/app/nsBrowserApp.cpp:279
That doesn't help, unfortunately. Throw an NS_IsMainThread assertion in Prefrences::RegisterCallback and that will tell us where the problem is.
Comment on attachment 664093 [details] [diff] [review] Patch Review of attachment 664093 [details] [diff] [review]: ----------------------------------------------------------------- Not the right fix.
Attachment #664093 - Flags: review?(roc) → review-

The bug assignee didn't login in Bugzilla in the last 7 months.
:KrisWright, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: dzbarsky → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(kwright)

ValueObserver in this state was removed.

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(kwright)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: