Bug 1678330 Comment 8 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

FWIW, I [cracked up a dump](https://crash-stats.mozilla.org/report/index/5198e96a-f713-4628-a96a-298270210218#tab-rawdump) and it seems, we are executing some JS on the main thread that somehow calls `nsThreadManager::SpinEventLoopUntil` directly from JS:

```
...
 	xul.dll!nsThreadManager::SpinEventLoopUntilInternal(nsINestedEventLoopCondition * aCondition, bool aCheckingShutdown) Zeile 727	C++
 	xul.dll!nsThreadManager::SpinEventLoopUntil(nsINestedEventLoopCondition * aCondition) Zeile 706	C++
 	xul.dll!_NS_InvokeByIndex()	Unbekannt
 	[Inlineframe] xul.dll!CallMethodHelper::Invoke() Zeile 1620	C++
 	[Inlineframe] xul.dll!CallMethodHelper::Call() Zeile 1176	C++
 	xul.dll!XPCWrappedNative::CallMethod(XPCCallContext & ccx, XPCWrappedNative::CallMode mode) Zeile 1142	C++
 	xul.dll!XPC_WN_CallMethod(JSContext * cx, unsigned int argc, JS::Value * vp) Zeile 926	C++
 	[Inlineframe] xul.dll!CallJSNative(JSContext * cx, bool(*)(JSContext *, unsigned int, JS::Value *) native, js::CallReason reason, const JS::CallArgs & args) Zeile 503	C++
 	xul.dll!js::InternalCallOrConstruct(JSContext * cx, const JS::CallArgs & args, js::MaybeConstruct construct, js::CallReason reason) Zeile 594	C++
 	[Inlineframe] xul.dll!InternalCall(JSContext * cx, const js::AnyInvokeArgs & args, js::CallReason reason) Zeile 647	C++
 	[Inlineframe] xul.dll!js::CallFromStack(JSContext * cx, const JS::CallArgs & args) Zeile 651	C++
 	xul.dll!Interpret(JSContext * cx, js::RunState & state) Zeile 3309	C++
 	[Inlineframe] xul.dll!js::RunScript(JSContext * cx, js::RunState & state) Zeile 473	C++
...
``` 

From the `MOZ_CRASH(Shutdown hanging before starting any known phase.)` I deduce, that we just called the observer notification ["profile-before-change"](https://searchfox.org/mozilla-central/rev/8432d4fe31245ae9121231d7c0335aaa342675d2/toolkit/components/terminator/nsTerminator.cpp#483) which started the terminator watchdog, but the terminator did never receive another [shutdown heartbeat notification out of these](https://searchfox.org/mozilla-central/rev/8432d4fe31245ae9121231d7c0335aaa342675d2/toolkit/components/terminator/nsTerminator.cpp#86-94).

So I would look out for any Javascript executed on the main thread that reacts on `"profile-before-change"` and potentially calls `nsThreadManager::SpinEventLoopUntil` directly from JS.
FWIW, I [cracked up a dump](https://crash-stats.mozilla.org/report/index/5198e96a-f713-4628-a96a-298270210218#tab-rawdump) and it seems, we are executing some JS on the main thread that somehow calls `nsThreadManager::SpinEventLoopUntil` directly from JS:

```
...
 	xul.dll!nsThreadManager::SpinEventLoopUntilInternal(nsINestedEventLoopCondition * aCondition, bool aCheckingShutdown) Zeile 727	C++
 	xul.dll!nsThreadManager::SpinEventLoopUntil(nsINestedEventLoopCondition * aCondition) Zeile 706	C++
 	xul.dll!_NS_InvokeByIndex()	Unbekannt
 	[Inlineframe] xul.dll!CallMethodHelper::Invoke() Zeile 1620	C++
 	[Inlineframe] xul.dll!CallMethodHelper::Call() Zeile 1176	C++
 	xul.dll!XPCWrappedNative::CallMethod(XPCCallContext & ccx, XPCWrappedNative::CallMode mode) Zeile 1142	C++
 	xul.dll!XPC_WN_CallMethod(JSContext * cx, unsigned int argc, JS::Value * vp) Zeile 926	C++
 	[Inlineframe] xul.dll!CallJSNative(JSContext * cx, bool(*)(JSContext *, unsigned int, JS::Value *) native, js::CallReason reason, const JS::CallArgs & args) Zeile 503	C++
 	xul.dll!js::InternalCallOrConstruct(JSContext * cx, const JS::CallArgs & args, js::MaybeConstruct construct, js::CallReason reason) Zeile 594	C++
 	[Inlineframe] xul.dll!InternalCall(JSContext * cx, const js::AnyInvokeArgs & args, js::CallReason reason) Zeile 647	C++
 	[Inlineframe] xul.dll!js::CallFromStack(JSContext * cx, const JS::CallArgs & args) Zeile 651	C++
 	xul.dll!Interpret(JSContext * cx, js::RunState & state) Zeile 3309	C++
 	[Inlineframe] xul.dll!js::RunScript(JSContext * cx, js::RunState & state) Zeile 473	C++
...
``` 

From the `MOZ_CRASH(Shutdown hanging before starting any known phase.)` I deduce, that we just called the observer notification ["profile-after-change"](https://searchfox.org/mozilla-central/rev/8432d4fe31245ae9121231d7c0335aaa342675d2/toolkit/components/terminator/nsTerminator.cpp#483) which started the terminator watchdog, but the terminator did never receive another [shutdown heartbeat notification out of these](https://searchfox.org/mozilla-central/rev/8432d4fe31245ae9121231d7c0335aaa342675d2/toolkit/components/terminator/nsTerminator.cpp#86-94).

So I would look out for any Javascript executed on the main thread that reacts on `"profile-before-change"` and potentially calls `nsThreadManager::SpinEventLoopUntil` directly from JS.
FWIW, I [cracked up a dump](https://crash-stats.mozilla.org/report/index/5198e96a-f713-4628-a96a-298270210218#tab-rawdump) and it seems, we are executing some JS on the main thread that somehow calls `nsThreadManager::SpinEventLoopUntil` directly from JS:

```
...
 	xul.dll!nsThreadManager::SpinEventLoopUntilInternal(nsINestedEventLoopCondition * aCondition, bool aCheckingShutdown) Zeile 727	C++
 	xul.dll!nsThreadManager::SpinEventLoopUntil(nsINestedEventLoopCondition * aCondition) Zeile 706	C++
 	xul.dll!_NS_InvokeByIndex()	Unbekannt
 	[Inlineframe] xul.dll!CallMethodHelper::Invoke() Zeile 1620	C++
 	[Inlineframe] xul.dll!CallMethodHelper::Call() Zeile 1176	C++
 	xul.dll!XPCWrappedNative::CallMethod(XPCCallContext & ccx, XPCWrappedNative::CallMode mode) Zeile 1142	C++
 	xul.dll!XPC_WN_CallMethod(JSContext * cx, unsigned int argc, JS::Value * vp) Zeile 926	C++
 	[Inlineframe] xul.dll!CallJSNative(JSContext * cx, bool(*)(JSContext *, unsigned int, JS::Value *) native, js::CallReason reason, const JS::CallArgs & args) Zeile 503	C++
 	xul.dll!js::InternalCallOrConstruct(JSContext * cx, const JS::CallArgs & args, js::MaybeConstruct construct, js::CallReason reason) Zeile 594	C++
 	[Inlineframe] xul.dll!InternalCall(JSContext * cx, const js::AnyInvokeArgs & args, js::CallReason reason) Zeile 647	C++
 	[Inlineframe] xul.dll!js::CallFromStack(JSContext * cx, const JS::CallArgs & args) Zeile 651	C++
 	xul.dll!Interpret(JSContext * cx, js::RunState & state) Zeile 3309	C++
 	[Inlineframe] xul.dll!js::RunScript(JSContext * cx, js::RunState & state) Zeile 473	C++
...
``` 

From the `MOZ_CRASH(Shutdown hanging before starting any known phase.)` I deduce, that we just called the observer notification ["profile-after-change"](https://searchfox.org/mozilla-central/rev/8432d4fe31245ae9121231d7c0335aaa342675d2/toolkit/components/terminator/nsTerminator.cpp#483) which started the terminator watchdog, but the terminator did never receive another [shutdown heartbeat notification out of these](https://searchfox.org/mozilla-central/rev/8432d4fe31245ae9121231d7c0335aaa342675d2/toolkit/components/terminator/nsTerminator.cpp#86-94).

So I would look out for any Javascript executed on the main thread that reacts on `"profile-after-change"` and potentially calls `nsThreadManager::SpinEventLoopUntil` directly from JS.

Back to Bug 1678330 Comment 8