IndexedDB: Transaction thread observer isn't quite safe

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
9 years ago
7 years ago

People

(Reporter: philor, Assigned: bent.mozilla)

Tracking

({intermittent-failure})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1289966685.1289968654.11894.gz&fulltext=1
WINNT 5.2 mozilla-central debug test mochitests-2/5 on 2010/11/16 20:04:45
s: w32-ix-slave33

2482 INFO TEST-PASS | /tests/dom/indexedDB/test/test_writer_starvation.html | Correct mode - 1 should equal 1
###!!! ASSERTION: Wrong thread!: 'NS_IsMainThread()', file e:/builds/moz2_slave/mozilla-central-win32-debug/build/dom/indexedDB/IDBTransaction.cpp, line 834
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004920CF
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049209D
xul!gfxMatrix::GetTranslation+0x0000000000350217
xul!XRE_AddJarManifestLocation+0x000000000001066F
xul!XRE_AddJarManifestLocation+0x0000000000010852
xul!gfxMatrix::GetTranslation+0x000000000053C7C0
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004B14E1
xul!XRE_AddJarManifestLocation+0x000000000000E81F
xul!XRE_AddJarManifestLocation+0x0000000000010D9A
xul!gfxMatrix::GetTranslation+0x000000000053C9CF
xul!XRE_AddJarManifestLocation+0x000000000000FDFE
nspr4!PR_LockOrderedLock+0x000000000002ABF1
nspr4!PR_LockOrderedLock+0x000000000002F27F
MSVCR80D!beginthreadex+0x0000000000000221
MSVCR80D!beginthreadex+0x00000000000001C7
kernel32!GetModuleHandleA+0x00000000000000DF
###!!! ASSERTION: Unprocessed transactions!: 'mTransactions[i].transactions.IsEmpty()', file e:/builds/moz2_slave/mozilla-central-win32-debug/build/dom/indexedDB/IDBTransaction.cpp, line 840
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004920CF
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049209D
xul!gfxMatrix::GetTranslation+0x0000000000350217
xul!XRE_AddJarManifestLocation+0x000000000001066F
xul!XRE_AddJarManifestLocation+0x0000000000010852
xul!gfxMatrix::GetTranslation+0x000000000053C7C0
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004B14E1
xul!XRE_AddJarManifestLocation+0x000000000000E81F
xul!XRE_AddJarManifestLocation+0x0000000000010D9A
xul!gfxMatrix::GetTranslation+0x000000000053C9CF
xul!XRE_AddJarManifestLocation+0x000000000000FDFE
nspr4!PR_LockOrderedLock+0x000000000002ABF1
nspr4!PR_LockOrderedLock+0x000000000002F27F
MSVCR80D!beginthreadex+0x0000000000000221
MSVCR80D!beginthreadex+0x00000000000001C7
kernel32!GetModuleHandleA+0x00000000000000DF
###!!! ASSERTION: nsDOMEventTargetHelper not thread-safe: '_mOwningThread.GetThread() == PR_GetCurrentThread()', file e:/builds/moz2_slave/mozilla-central-win32-debug/build/content/events/src/nsDOMEventTargetHelper.cpp, line 92
xul!mozilla::layers::LayerManagerOGL::operator=+0x0000000000490FDD
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000047A961
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004941EF
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004941BD
xul!mozilla::layers::LayerManagerOGL::operator=+0x0000000000493D82
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004936B1
xul!mozilla::layers::LayerManagerOGL::operator=+0x0000000000492C9A
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049433F
xul!mozilla::layers::LayerManagerOGL::operator=+0x0000000000494322
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004942BF
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049429D
xul!mozilla::layers::LayerManagerOGL::operator=+0x0000000000494132
xul!mozilla::layers::LayerManagerOGL::operator=+0x0000000000493E51
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049387A
xul!mozilla::layers::LayerManagerOGL::operator=+0x0000000000492CCF
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049199F
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049197F
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049196A
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004920CF
xul!mozilla::layers::LayerManagerOGL::operator=+0x000000000049209D
xul!gfxMatrix::GetTranslation+0x0000000000350217
xul!XRE_AddJarManifestLocation+0x000000000001066F
xul!XRE_AddJarManifestLocation+0x0000000000010852
xul!gfxMatrix::GetTranslation+0x000000000053C7C0
xul!mozilla::layers::LayerManagerOGL::operator=+0x00000000004B14E1
xul!XRE_AddJarManifestLocation+0x000000000000E81F
xul!XRE_AddJarManifestLocation+0x0000000000010D9A
xul!gfxMatrix::GetTranslation+0x000000000053C9CF
xul!XRE_AddJarManifestLocation+0x000000000000FDFE
nspr4!PR_LockOrderedLock+0x000000000002ABF1
nspr4!PR_LockOrderedLock+0x000000000002F27F
MSVCR80D!beginthreadex+0x0000000000000221
MSVCR80D!beginthreadex+0x00000000000001C7
kernel32!GetModuleHandleA+0x00000000000000DF
###!!! ABORT: Main-thread-only object used off the main thread: file e:/builds/moz2_slave/mozilla-central-win32-debug/build/xpcom/base/nsCycleCollector.cpp, line 1159
2483 INFO TEST-PASS | /tests/dom/indexedDB/test/test_writer_starvation.html | Correct mode - 1 should equal 1
2484 INFO TEST-PASS | /tests/dom/indexedDB/test/test_writer_starvation.html | Correct mode - 1 should equal 1
2485 INFO TEST-PASS | /tests/dom/indexedDB/test/test_writer_starvation.html | Correct mode - 1 should equal 1
2486 INFO TEST-PASS | /tests/dom/indexedDB/test/test_writer_starvation.html | Correct mode - 1 should equal 1
2487 INFO TEST-PASS | /tests/dom/indexedDB/test/test_writer_starvation.html | Correct mode - 1 should equal 1
2488 INFO TEST-PASS | /tests/dom/indexedDB/test/test_writer_starvation.html | Correct mode - 1 should equal 1
nsStringStats
 => mAllocCount:         557903
 => mReallocCount:        30760
 => mFreeCount:          511621  --  LEAKED 46282 !!!
 => mShareCount:         729380
 => mAdoptCount:          51519
 => mAdoptFreeCount:      51517  --  LEAKED 2 !!!
###!!! ASSERTION: nsScriptCacheCleaner not thread-safe: '_mOwningThread.GetThread() == PR_GetCurrentThread()', file e:/builds/moz2_slave/mozilla-central-win32-debug/build/content/base/src/nsFrameMessageManager.cpp, line 723
TEST-UNEXPECTED-FAIL | /tests/dom/indexedDB/test/test_writer_starvation.html | application timed out after 330 seconds with no output

command timed out: 1200 seconds without output
Summary: Intermittent test_writer_starvation.html | application timed out after 330 seconds with no output following multiple assertion failures → Intermittent test_writer_starvation.html | application timed out after 330 seconds with no output, or, Exited with code -2147483645 after ###!!! ABORT: Main-thread-only object used off the main thread
Assignee: nobody → bent.mozilla
Status: NEW → ASSIGNED
Summary: Intermittent test_writer_starvation.html | application timed out after 330 seconds with no output, or, Exited with code -2147483645 after ###!!! ABORT: Main-thread-only object used off the main thread → IndexedDB: Transaction thread observer isn't quite safe
Posted patch Patch, v1Splinter Review
The basic issue is that IDBTransaction::ThreadObserver isn't quite safe due to the way thread observers work in general. The attached patch adds a simpler observer interface to nsThread and uses that instead.
Attachment #491643 - Flags: review?(jst)
Comment on attachment 491643 [details] [diff] [review]
Patch, v1

Looks good, r=jst with the following minor thing fixed:

+nsThread::AddObserver(nsIThreadObserver *observer)
+{
+  NS_ENSURE_ARG_POINTER(observer);
+  NS_ENSURE_STATE(PR_GetCurrentThread() == mThread);
+
+  if (mEventObservers.Contains(observer)) {
+    NS_WARNING("Adding an observer twice!");
+  }

This should use NS_WARN_IF_FALSE to avoid calling Contains() in opt builds.
Attachment #491643 - Flags: review?(jst) → review+
Blocking beta8 on this.
blocking2.0: --- → beta8+
http://hg.mozilla.org/mozilla-central/rev/30484d51bb7b
Status: ASSIGNED → RESOLVED
blocking2.0: beta8+ → ---
Closed: 9 years ago
Resolution: --- → FIXED
Component: DOM → DOM: IndexedDB
Version: Trunk → unspecified
Whiteboard: [orange]
You need to log in before you can comment on or make changes to this bug.