Closed Bug 1234756 Opened 9 years ago Closed 9 years ago

ASSERTION: Double-freezing?: '!IsFrozen()' when running webide tests with debugger enabled

Categories

(DevTools :: Debugger, defect)

40 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1132501

People

(Reporter: jlong, Unassigned)

References

Details

One of the last blocking test failures for bug 1132501 is https://treeherder.mozilla.org/#/jobs?repo=try&revision=0986c2e5bdbe&selectedJob=14821767. Bug 1132501 attaches the thread whenever the toolbox is opened, so the page is running with a debugger attached. Most of those failures are running webide tests and getting this assertion failure:

###!!! ASSERTION: Double-freezing?: '!IsFrozen()', file /builds/slave/try-m64-d-00000000000000000000/build/src/dom/base/nsGlobalWindow.h, line 1525

If you look at the stack, it's happening in the debugger's `fireNewScript` method, which eventually calls `SuspendTimeouts` for some reason. I need help figuring this out, it's over my head and we want to land bug 1132501.

 10:33:34     INFO -  #01: nsDOMWindowUtils::SuspendTimeouts() [xpcom/glue/nsCOMPtr.h:403]
 10:33:34     INFO -  #02: NS_InvokeByIndex [xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_unix.cpp:174]
 10:33:34     INFO -  #03: CallMethodHelper::Call() [js/xpconnect/src/XPCWrappedNative.cpp:1414]
 10:33:34     INFO -  #04: XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) [js/xpconnect/src/XPCWrappedNative.cpp:1381]
 10:33:34     INFO -  #05: XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) [js/xpconnect/src/XPCWrappedNativeJSOps.cpp:1115]
 10:33:34     INFO -  #06: js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) [js/src/jscntxtinlines.h:236]
 10:33:34     INFO -  #07: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:448]
 10:33:34     INFO -  #08: Interpret [js/src/vm/Interpreter.cpp:2786]
 10:33:34     INFO -  #09: js::RunScript(JSContext*, js::RunState&) [js/src/vm/Interpreter.cpp:407]
 10:33:34     INFO -  #10: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:478]
 10:33:34     INFO -  #11: js::CallOrConstructBoundFunction(JSContext*, unsigned int, JS::Value*) [js/src/jsfun.cpp:1574]
 10:33:34     INFO -  #12: js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) [js/src/jscntxtinlines.h:236]
 10:33:34     INFO -  #13: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:448]
 10:33:34     INFO -  #14: Interpret [js/src/vm/Interpreter.cpp:2786]
 10:33:34     INFO -  #15: js::RunScript(JSContext*, js::RunState&) [js/src/vm/Interpreter.cpp:407]
 10:33:34     INFO -  #16: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:478]
 10:33:34     INFO -  #17: js::CallOrConstructBoundFunction(JSContext*, unsigned int, JS::Value*) [js/src/jsfun.cpp:1574]
 10:33:34     INFO -  #18: js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) [js/src/jscntxtinlines.h:236]
 10:33:34     INFO -  #19: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:448]
 10:33:34     INFO -  #20: js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value const*, JS::MutableHandle<JS::Value>) [js/src/vm/Interpreter.cpp:512]
 10:33:34     INFO -  #21: js::DirectProxyHandler::call(JSContext*, JS::Handle<JSObject*>, JS::CallArgs const&) const [js/public/RootingAPI.h:719]
 10:33:34     INFO -  #22: js::CrossCompartmentWrapper::call(JSContext*, JS::Handle<JSObject*>, JS::CallArgs const&) const [js/src/proxy/CrossCompartmentWrapper.cpp:291]
 10:33:34     INFO -  #23: js::Proxy::call(JSContext*, JS::Handle<JSObject*>, JS::CallArgs const&) [js/src/proxy/Proxy.cpp:391]
 10:33:34     INFO -  #24: js::proxy_Call(JSContext*, unsigned int, JS::Value*) [js/public/RootingAPI.h:719]
 10:33:34     INFO -  #25: js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) [js/src/jscntxtinlines.h:236]
 10:33:34     INFO -  #26: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:448]
 10:33:34     INFO -  #27: js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value const*, JS::MutableHandle<JS::Value>) [js/src/vm/Interpreter.cpp:512]
 10:33:34     INFO -  #28: js::Debugger::fireNewScript(JSContext*, JS::Handle<JSScript*>) [js/src/vm/Debugger.cpp:1313]
 10:33:34     INFO -  #29: js::Debugger::slowPathOnNewScript(JSContext*, JS::Handle<JSScript*>) [js/src/vm/Debugger.cpp:1461]
 10:33:34     INFO -  #30: js::CloneFunctionAndScript(JSContext*, JS::Handle<JSFunction*>, JS::Handle<JSObject*>, JS::Handle<JSObject*>, js::gc::AllocKind, JS::Handle<JSObject*>) [js/public/RootingAPI.h:719]
 10:33:34     INFO -  #31: CloneFunctionObject [js/src/jsapi.cpp:3537]
 10:33:34     INFO -  #32: JS::CloneFunctionObject(JSContext*, JS::Handle<JSObject*>) [js/public/RootingAPI.h:719]
 10:33:34     INFO -  #33: nsXBLProtoImplProperty::InstallMember(JSContext*, JS::Handle<JSObject*>) [dom/xbl/nsXBLProtoImplProperty.cpp:147]
 10:33:34     INFO -  #34: nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding*, nsXBLBinding*) [dom/xbl/nsXBLProtoImpl.cpp:132]
 10:33:34     INFO -  #35: nsXBLBinding::InstallImplementation() [dom/xbl/nsXBLBinding.cpp:566]
 10:33:34     INFO -  #36: nsXBLService::LoadBindings(nsIContent*, nsIURI*, nsIPrincipal*, nsXBLBinding**, bool*) [dom/xbl/nsXBLService.cpp:495]
 10:33:34     INFO -  #37: nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState&, nsIContent*, nsContainerFrame*, nsIAtom*, int, bool, nsStyleContext*, unsigned int, nsTArray<nsIAnonymousContentCreator::ContentInfo>*, nsCSSFrameConstructor::FrameConstructionItemList&) [layout/base/nsCSSFrameConstructor.cpp:5481]
 10:33:34     INFO -  #38: nsCSSFrameConstructor::AddFCItemsForAnonymousContent(nsFrameConstructorState&, nsContainerFrame*, nsTArray<nsIAnonymousContentCreator::ContentInfo>&, nsCSSFrameConstructor::FrameConstructionItemList&, unsigned int) [layout/base/nsCSSFrameConstructor.cpp:10288]
 10:33:34     INFO -  #39: nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState&, nsIContent*, nsStyleContext*, nsContainerFrame*, bool, nsFrameItems&, bool, PendingBinding*, nsIFrame*) [layout/base/nsCSSFrameConstructor.cpp:10365]
 10:33:34     INFO -  #40: nsCSSFrameConstructor::ConstructDocElementFrame(mozilla::dom::Element*, nsILayoutHistoryState*) [layout/base/nsCSSFrameConstructor.cpp:2566]
 10:33:34     INFO -  #41: nsCSSFrameConstructor::ContentRangeInserted(nsIContent*, nsIContent*, nsIContent*, nsILayoutHistoryState*, bool) [layout/base/nsCSSFrameConstructor.cpp:7462]
 10:33:34     INFO -  #42: PresShell::Initialize(int, int) [mfbt/RefPtr.h:240]
 10:33:34     INFO -  #43: mozilla::dom::XULDocument::StartLayout() [dom/xul/XULDocument.cpp:1904]
 10:33:34     INFO -  #44: mozilla::dom::XULDocument::DoneWalking() [dom/xul/XULDocument.cpp:3022]
 10:33:34     INFO -  #45: non-virtual thunk to mozilla::dom::XULDocument::StyleSheetLoaded(mozilla::CSSStyleSheet*, bool, nsresult) [dom/xul/XULDocument.cpp:3096]
 10:33:34     INFO -  #46: mozilla::css::Loader::SheetComplete(mozilla::css::SheetLoadData*, nsresult) [xpcom/glue/nsTObserverArray.h:284]
 10:33:34     INFO -  #47: mozilla::css::Loader::HandleLoadEvent(mozilla::css::SheetLoadData*) [layout/style/Loader.cpp:2473]
 10:33:34     INFO -  #48: mozilla::css::SheetLoadData::Run() [layout/style/Loader.cpp:432]
 10:33:34     INFO -  #49: nsThread::ProcessNextEvent(bool, bool*) [xpcom/glue/nsCOMPtr.h:403]
 10:33:34     INFO -  #50: NS_ProcessNextEvent(nsIThread*, bool) [xpcom/glue/nsThreadUtils.cpp:297]
 10:33:34     INFO -  #51: mozilla::jsinspector::nsJSInspector::EnterNestedEventLoop(JS::Handle<JS::Value>, unsigned int*) [devtools/server/nsJSInspector.cpp:78]
 10:33:34     INFO -  #52: NS_InvokeByIndex [xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_unix.cpp:174]
 10:33:34     INFO -  #53: CallMethodHelper::Call() [js/xpconnect/src/XPCWrappedNative.cpp:1414]
 10:33:34     INFO -  #54: XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) [js/xpconnect/src/XPCWrappedNative.cpp:1381]
 10:33:34     INFO -  #55: XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) [js/xpconnect/src/XPCWrappedNativeJSOps.cpp:1115]
 10:33:34     INFO -  #56: js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) [js/src/jscntxtinlines.h:236]
 10:33:34     INFO -  #57: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:448]
 10:33:34     INFO -  #58: Interpret [js/src/vm/Interpreter.cpp:2786]
 10:33:34     INFO -  #59: js::RunScript(JSContext*, js::RunState&) [js/src/vm/Interpreter.cpp:407]
 10:33:34     INFO -  #60: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:478]
 10:33:34     INFO -  #61: js::CallOrConstructBoundFunction(JSContext*, unsigned int, JS::Value*) [js/src/jsfun.cpp:1574]
 10:33:34     INFO -  #62: js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) [js/src/jscntxtinlines.h:236]
 10:33:34     INFO -  #63: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:448]
 10:33:34     INFO -  #64: Interpret [js/src/vm/Interpreter.cpp:2786]
 10:33:34     INFO -  #65: js::RunScript(JSContext*, js::RunState&) [js/src/vm/Interpreter.cpp:407]
 10:33:34     INFO -  #66: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:478]
 10:33:34     INFO -  #67: js::CallOrConstructBoundFunction(JSContext*, unsigned int, JS::Value*) [js/src/jsfun.cpp:1574]
 10:33:34     INFO -  #68: js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) [js/src/jscntxtinlines.h:236]
 10:33:34     INFO -  #69: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [js/src/vm/Interpreter.cpp:448]
 10:33:34     INFO -  #70: js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value const*, JS::MutableHandle<JS::Value>) [js/src/vm/Interpreter.cpp:512]
 10:33:34     INFO -  #71: js::jit::DoCallFallback [js/src/jit/BaselineIC.cpp:6164]




devtools/client/webide/test/test_runtime.html
Blocks: 1132501
CCing people who might be able to help out.
Removing the `unsafeSynchronize` call here fixes the issue: https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/script.js#1935

`unsafeSynchronize` spins up an event loop, which calls SuspendTimeouts on the window, which freezes the window. For some reason, the event loop is being properly exited to the window is frozen multiple times, hence the assert error.

I added some logging throughout `unsafeSynchronize` like here: https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/script.js#1061 Strangely, it seems like the promise is never executed. It's as if enter the event loop at the end of the function pauses this promise code as well.

Strangely, it works fine with a normal page. For some reason this happens with webide tests.
Alright, I have a fix. The `_addSource` method does not need to be calling `unsafeSynchronize` at all if there are no breakpoints. I've refactored the code so that it doesn't do that. That means we'll never be calling it for all of these tests that don't actually use the debugger, which is great because it's a nasty little thing that seems to mess things up.

The fix will be implemented in bug 1132501, this was just a child bug of that.

(Not really sure what the set the status of this bug as, but I guess a duplicate makes the most sense)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.