Closed Bug 614472 Opened 14 years ago Closed 14 years ago

###!!! ASSERTION: Potential deadlock between Lock@214fb3c0 and Lock@2602a920: 'Error', file nsAutoLock.cpp, line 318

Categories

(Core :: Networking, defect)

x86_64
macOS
defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 594666

People

(Reporter: khuey, Unassigned)

References

()

Details

(Keywords: intermittent-failure)

Not really sure where else to put this.

REFTEST TEST-START | file:///Users/cltbld/talos-slave/mozilla-central_leopard-o-debug_test-jsreftest/build/jsreftest/tests/jsreftest.html?test=js1_8_5/extensions/destructure-accessor.js
++DOMWINDOW == 26 (0x29e86fc4) [serial = 5852] [outer = 0x1fc66f30]

*** Potential deadlock between Lock@214fb3c0 and Lock@2602a920

Current stack:
nsAutoLockBase::nsAutoLockBase [nsAutoLock.cpp:311]
nsAutoLock::nsAutoLock [nsAutoLock.h:216]
nsThread::Init [xpcom/threads/nsThread.cpp:359]
nsThreadManager::NewThread [xpcom/threads/nsThreadManager.cpp:249]
nsThreadPool::PutEvent [xpcom/threads/nsThreadPool.cpp:112]
nsThreadPool::Dispatch [xpcom/threads/nsThreadPool.cpp:259]
nsStreamTransportService::Dispatch [netwerk/base/src/nsStreamTransportService.cpp:500]
nsAStreamCopier::PostContinuationEvent_Locked [xpcom/io/nsStreamUtils.cpp:471]
nsAStreamCopier::PostContinuationEvent [xpcom/io/nsStreamUtils.cpp:462]
nsAStreamCopier::Start [xpcom/io/nsStreamUtils.cpp:294]
NS_AsyncCopy [xpcom/io/nsStreamUtils.cpp:619]
nsInputStreamTransport::OpenInputStream [netwerk/base/src/nsStreamTransportService.cpp:147]
nsInputStreamPump::AsyncRead [netwerk/base/src/nsInputStreamPump.cpp:344]
nsBaseChannel::BeginPumpingData [netwerk/base/src/nsBaseChannel.cpp:262]
nsBaseChannel::AsyncOpen [netwerk/base/src/nsBaseChannel.cpp:591]
nsScriptLoader::StartLoad [content/base/src/nsScriptLoader.cpp:339]
nsScriptLoader::PreloadURI [content/base/src/nsScriptLoader.cpp:1292]
nsHtml5TreeOpExecutor::PreloadScript [parser/html/nsHtml5TreeOpExecutor.cpp:876]
nsHtml5SpeculativeLoad::Perform [parser/html/nsHtml5SpeculativeLoad.cpp:68]
nsHtml5TreeOpExecutor::FlushSpeculativeLoads [parser/html/nsHtml5TreeOpExecutor.cpp:356]
nsHtml5Parser::Parse [parser/html/nsHtml5Parser.cpp:429]
nsHTMLDocument::WriteCommon [content/html/document/src/nsHTMLDocument.cpp:2209]
nsHTMLDocument::Write [content/html/document/src/nsHTMLDocument.cpp:2223]
nsIDOMHTMLDocument_Write [dom_quickstubs.cpp:16275]
(null) + 0x0
js::mjit::EnterMethodJIT [js/src/methodjit/MethodJIT.cpp:745]
CheckStackAndEnterMethodJIT [js/src/methodjit/MethodJIT.cpp:770]
js::mjit::JaegerShot [js/src/methodjit/MethodJIT.cpp:788]
js::RunScript [js/src/jsinterp.cpp:654]
js::Execute [js/src/jsinterp.cpp:1005]
JS_EvaluateUCScriptForPrincipals [js/src/jsapi.cpp:4884]
JS_EvaluateUCScriptForPrincipalsVersion [js/src/jsapi.cpp:4860]
nsJSContext::EvaluateString [dom/base/nsJSEnvironment.cpp:1731]
nsScriptLoader::EvaluateScript [content/base/src/nsScriptLoader.cpp:873]
nsScriptLoader::ProcessRequest [content/base/src/nsScriptLoader.cpp:772]
nsScriptLoader::ProcessScriptElement [content/base/src/nsScriptLoader.cpp:635]
nsScriptElement::MaybeProcessScript [content/base/src/nsScriptElement.cpp:167]
nsHTMLScriptElement::MaybeProcessScript [content/html/content/src/nsHTMLScriptElement.cpp:583]
nsHTMLScriptElement::DoneAddingChildren [content/html/content/src/nsHTMLScriptElement.cpp:510]
nsHtml5TreeOpExecutor::RunScript [parser/html/nsHtml5TreeOpExecutor.cpp:730]
nsHtml5TreeOpExecutor::RunFlushLoop [parser/html/nsHtml5TreeOpExecutor.cpp:528]
nsHtml5ExecutorReflusher::Run [parser/html/nsHtml5TreeOpExecutor.cpp:91]
nsThread::ProcessNextEvent [xpcom/threads/nsThread.cpp:626]
NS_ProcessPendingEvents_P [nsThreadUtils.cpp:200]
nsBaseAppShell::NativeEventCallback [widget/src/xpwidgets/nsBaseAppShell.cpp:132]
nsAppShell::ProcessGeckoEvents [widget/src/cocoa/nsAppShell.mm:400]
CoreFoundation + 0x733c5
CoreFoundation + 0x73aa8
HIToolbox + 0x302ac
HIToolbox + 0x300c5
HIToolbox + 0x2ff39
AppKit + 0x406d5
AppKit + 0x3ff88
AppKit + 0x38f9f
nsAppShell::Run [widget/src/cocoa/nsAppShell.mm:746]
nsAppStartup::Run [toolkit/components/startup/src/nsAppStartup.cpp:191]
XRE_main [toolkit/xre/nsAppRunner.cpp:3691]
main [browser/app/nsBrowserApp.cpp:158]
firefox-bin + 0x1486

Previous stack:
nsAutoLockBase::nsAutoLockBase [nsAutoLock.cpp:289]
nsAutoLock::nsAutoLock [nsAutoLock.h:216]
nsThread::Init [xpcom/threads/nsThread.cpp:359]
nsThreadManager::NewThread [xpcom/threads/nsThreadManager.cpp:249]
nsThreadPool::PutEvent [xpcom/threads/nsThreadPool.cpp:112]
nsThreadPool::Dispatch [xpcom/threads/nsThreadPool.cpp:259]
nsStreamTransportService::Dispatch [netwerk/base/src/nsStreamTransportService.cpp:500]
nsAStreamCopier::PostContinuationEvent_Locked [xpcom/io/nsStreamUtils.cpp:471]
nsAStreamCopier::PostContinuationEvent [xpcom/io/nsStreamUtils.cpp:462]
nsAStreamCopier::Start [xpcom/io/nsStreamUtils.cpp:294]
NS_AsyncCopy [xpcom/io/nsStreamUtils.cpp:619]
nsInputStreamTransport::OpenInputStream [netwerk/base/src/nsStreamTransportService.cpp:147]
nsInputStreamPump::AsyncRead [netwerk/base/src/nsInputStreamPump.cpp:344]
nsBaseChannel::BeginPumpingData [netwerk/base/src/nsBaseChannel.cpp:262]
nsBaseChannel::AsyncOpen [netwerk/base/src/nsBaseChannel.cpp:591]
nsScriptLoader::StartLoad [content/base/src/nsScriptLoader.cpp:339]
nsScriptLoader::PreloadURI [content/base/src/nsScriptLoader.cpp:1292]
nsHtml5TreeOpExecutor::PreloadScript [parser/html/nsHtml5TreeOpExecutor.cpp:876]
nsHtml5SpeculativeLoad::Perform [parser/html/nsHtml5SpeculativeLoad.cpp:68]
nsHtml5TreeOpExecutor::FlushSpeculativeLoads [parser/html/nsHtml5TreeOpExecutor.cpp:356]
nsHtml5Parser::Parse [parser/html/nsHtml5Parser.cpp:429]
nsHTMLDocument::WriteCommon [content/html/document/src/nsHTMLDocument.cpp:2209]
nsHTMLDocument::Write [content/html/document/src/nsHTMLDocument.cpp:2223]
nsIDOMHTMLDocument_Write [dom_quickstubs.cpp:16275]
(null) + 0x0
js::mjit::EnterMethodJIT [js/src/methodjit/MethodJIT.cpp:745]
CheckStackAndEnterMethodJIT [js/src/methodjit/MethodJIT.cpp:770]
js::mjit::JaegerShot [js/src/methodjit/MethodJIT.cpp:788]
js::RunScript [js/src/jsinterp.cpp:654]
js::Execute [js/src/jsinterp.cpp:1005]
JS_EvaluateUCScriptForPrincipals [js/src/jsapi.cpp:4884]
JS_EvaluateUCScriptForPrincipalsVersion [js/src/jsapi.cpp:4860]
nsJSContext::EvaluateString [dom/base/nsJSEnvironment.cpp:1731]
nsScriptLoader::EvaluateScript [content/base/src/nsScriptLoader.cpp:873]
nsScriptLoader::ProcessRequest [content/base/src/nsScriptLoader.cpp:772]
nsScriptLoader::ProcessScriptElement [content/base/src/nsScriptLoader.cpp:635]
nsScriptElement::MaybeProcessScript [content/base/src/nsScriptElement.cpp:167]
nsHTMLScriptElement::MaybeProcessScript [content/html/content/src/nsHTMLScriptElement.cpp:583]
nsHTMLScriptElement::DoneAddingChildren [content/html/content/src/nsHTMLScriptElement.cpp:510]
nsHtml5TreeOpExecutor::RunScript [parser/html/nsHtml5TreeOpExecutor.cpp:730]
nsHtml5TreeOpExecutor::RunFlushLoop [parser/html/nsHtml5TreeOpExecutor.cpp:528]
nsHtml5ExecutorReflusher::Run [parser/html/nsHtml5TreeOpExecutor.cpp:91]
nsThread::ProcessNextEvent [xpcom/threads/nsThread.cpp:626]
NS_ProcessPendingEvents_P [nsThreadUtils.cpp:200]
nsBaseAppShell::NativeEventCallback [widget/src/xpwidgets/nsBaseAppShell.cpp:132]
nsAppShell::ProcessGeckoEvents [widget/src/cocoa/nsAppShell.mm:400]
CoreFoundation + 0x733c5
CoreFoundation + 0x73aa8
HIToolbox + 0x302ac
HIToolbox + 0x300c5
HIToolbox + 0x2ff39
AppKit + 0x406d5
AppKit + 0x3ff88
AppKit + 0x38f9f
nsAppShell::Run [widget/src/cocoa/nsAppShell.mm:746]
nsAppStartup::Run [toolkit/components/startup/src/nsAppStartup.cpp:191]
XRE_main [toolkit/xre/nsAppRunner.cpp:3691]
main [browser/app/nsBrowserApp.cpp:158]
firefox-bin + 0x1486
Maybe bug 614480 is related.
Sigh sigh sigh, the new deadlock detector would make debugging this much easier.  Ah well.  First off,

$ diff -u prev.txt cur.txt
--- prev.txt	2010-11-23 22:07:17.000000000 -0600
+++ cur.txt	2010-11-23 22:07:02.000000000 -0600
@@ -1,4 +1,4 @@
-nsAutoLockBase::nsAutoLockBase [nsAutoLock.cpp:289]
+nsAutoLockBase::nsAutoLockBase [nsAutoLock.cpp:311]
 nsAutoLock::nsAutoLock [nsAutoLock.h:216]
 nsThread::Init [xpcom/threads/nsThread.cpp:359]
 nsThreadManager::NewThread [xpcom/threads/nsThreadManager.cpp:249]

The acquisitions that set off the deadlock detector were made from the same calling context.  From scanning the stack, it looks like the two locks involved are nsThread's and nsAStreamCopier's; I'm not sure if other calls on the stack are made within mutexes.  If those are the only two, then something odd is afoot, because the nsThread's mutex is created when the nsThread is, so it shouldn't be possible for the deadlock detector to create an order-violating cycle (regardless of whether the stream copier (and its mutex) is the same).  So, *if* those are the only two mutexes involved, this looks like a false positive set off by an A/B/A pointer problem: the old detector was forced to keep around orderings for raw PRLocks created directly with PR_NewLock(), not created by nsAutoLock::NewLock, as both nsThread's and nsAStreamCopier's are.  That means it's possible for multiple, distinct PRLock* to have the same entry in the deadlock detector, if two separate PR_NewLock() calls return the same pointer value.  So, if the stars aligned and in one round nsThread got mLock=A and nsAStreamCopier got mLock=B, then in another round nsThread got mLock=B and nsAStreamCopier got mLock=A, the deadlock detector would erroneously flag a potential deadlock.  (There are many other scenarios in which this A/B/A problem could also arise.)

It would be nice if someone familiar with this code could check that those are the only two locks involved.  If so, I would chalk this up to freak chance, with the only solutions being use nsAutoLock::NewLock() for these guys (boo!), or migrate to the new deadlock detector, which doesn't support raw PR_Lock() and so isn't susceptible to this A/B/A problem.  But, as this appeared near bug 614480, another possibility might be memory corruption or who knows what else.
http://tinderbox.mozilla.org/showlog.cgi?tree=Firefox&errorparser=unittest&logfile=1290613063.1290614590.5870.gz&buildtime=1290613063&buildname=Rev3%20MacOSX%20Snow%20Leopard%2010.6.2%20mozilla-central%20debug%20test%20jsreftest&fulltext=1#err0

###!!! ASSERTION: Potential deadlock between Lock@1202e72e0 and Lock@1202e29e0: 'Error', file nsAutoLock.cpp, line 318
nsAutoLockBase::nsAutoLockBase [nsAutoLock.cpp:323]
nsAutoLock::nsAutoLock [nsAutoLock.h:216]
nsThread::GetObserver [xpcom/threads/nsThread.cpp:698]
nsThread::GetObserver [xpcom/threads/nsThread.h:93]
nsThread::PutEvent [xpcom/threads/nsThread.cpp:393]
nsThread::Dispatch [xpcom/threads/nsThread.cpp:433]
nsThreadPool::PutEvent [xpcom/threads/nsThreadPool.cpp:131]
nsThreadPool::Dispatch [xpcom/threads/nsThreadPool.cpp:259]
nsStreamTransportService::Dispatch [netwerk/base/src/nsStreamTransportService.cpp:500]
nsAStreamCopier::PostContinuationEvent_Locked [xpcom/io/nsStreamUtils.cpp:471]
nsAStreamCopier::PostContinuationEvent [xpcom/io/nsStreamUtils.cpp:462]
nsAStreamCopier::Start [xpcom/io/nsStreamUtils.cpp:294]
NS_AsyncCopy [xpcom/io/nsStreamUtils.cpp:619]
nsInputStreamTransport::OpenInputStream [netwerk/base/src/nsStreamTransportService.cpp:147]
nsInputStreamPump::AsyncRead [netwerk/base/src/nsInputStreamPump.cpp:344]
nsBaseChannel::BeginPumpingData [netwerk/base/src/nsBaseChannel.cpp:262]
nsBaseChannel::AsyncOpen [netwerk/base/src/nsBaseChannel.cpp:591]
nsScriptLoader::StartLoad [content/base/src/nsScriptLoader.cpp:339]
nsScriptLoader::PreloadURI [content/base/src/nsScriptLoader.cpp:1292]
nsHtml5TreeOpExecutor::PreloadScript [parser/html/nsHtml5TreeOpExecutor.cpp:876]
nsHtml5SpeculativeLoad::Perform [parser/html/nsHtml5SpeculativeLoad.cpp:68]
nsHtml5TreeOpExecutor::FlushSpeculativeLoads [parser/html/nsHtml5TreeOpExecutor.cpp:356]
nsHtml5Parser::Parse [parser/html/nsHtml5Parser.cpp:429]
nsHTMLDocument::WriteCommon [content/html/document/src/nsHTMLDocument.cpp:2209]
nsHTMLDocument::Write [content/html/document/src/nsHTMLDocument.cpp:2223]
nsIDOMHTMLDocument_Write [dom_quickstubs.cpp:16275]
BUGNUMBER: 341675
STATUS: Iterators: still infinite loop during GC
Blocks: 438871
http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1291167431.1291169068.30487.gz
Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test jsreftest on 2010/11/30 17:37:11
s: talos-r3-leopard-047
http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1291180123.1291181551.17597.gz
Rev3 MacOSX Leopard 10.5.8 mozilla-central debug test jsreftest on 2010/11/30 21:08:43
s: talos-r3-leopard-015

REFTEST TEST-UNEXPECTED-FAIL | file:///Users/cltbld/talos-slave/mozilla-central_leopard-o-debug_test-jsreftest/build/jsreftest/tests/jsreftest.html?test=js1_5/Regress/regress-89443.js | assertion count 3 is more than expected 0 assertions
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Whiteboard: [orange]
You need to log in before you can comment on or make changes to this bug.