Crash in [@ mozilla::MustConsumeMicroTask::~MustConsumeMicroTask]
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
People
(Reporter: clouseau-bot, Assigned: mgaudet)
References
(Blocks 1 open bug)
Details
(Keywords: crash)
Crash Data
Attachments
(1 external file)
Crash report: https://crash-stats.mozilla.org/report/index/e4b56f5a-0948-408f-8dec-d995e0261020
MOZ_CRASH Reason:
MOZ_CRASH(Didn't consume MicroTask)
Top 10 frames:
0 xul.dll mozilla::MustConsumeMicroTask::~MustConsumeMicroTask() xpcom/base/CycleCollectedJSContext.h:148
1 xul.dll mozilla::SuppressedMicroTaskList::~SuppressedMicroTaskList() xpcom/base/CycleCollectedJSContext.cpp:755
2 xul.dll mozilla::SuppressedMicroTaskList::~SuppressedMicroTaskList() xpcom/base/CycleCollectedJSContext.cpp:752
3 xul.dll mozilla::RunMicroTask(JSContext*, mozilla::CycleCollectedJSContext*, JS::Mutable... xpcom/base/CycleCollectedJSContext.cpp:770
4 xul.dll mozilla::CycleCollectedJSContext::PerformMicroTaskCheckPoint(bool) xpcom/base/CycleCollectedJSContext.cpp:1295
5 xul.dll JS::AutoDebuggerJobQueueInterruption::runJobs() js/src/builtin/Promise.cpp:8677
6 xul.dll js::DebugAPI::slowPathOnNewGlobalObject(JSContext*, JS::Handle<js::GlobalObject ... js/src/debugger/Debugger.cpp:3012
7 xul.dll JS_FireOnNewGlobalObject(JSContext*, JS::Handle<JSObject *>) js/src/jsapi.cpp:1940
8 xul.dll xpc::CreateSandboxObject(JSContext*, JS::MutableHandle<JS::Value>, nsISupports*,... js/xpconnect/src/Sandbox.cpp:1556
9 xul.dll nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative*, JSCon... js/xpconnect/src/Sandbox.cpp:2208
There are 2 crashes (from 1 installation) in nightly 160 with buildid 20261019215902.
In the last 30 days, Firefox has 2 crashes (from 2 installations) on beta/DevEdition, 2 crashes (from 1 installation) on nightly and 2 crashes (from 2 installations) on release with this signature.
This signature has been reported since build 20251202094558 (2025-12-02), 322 days before the build above.
This bug looks actionable because:
-
A
SuppressedMicroTaskListis destroyed while it still holds unconsumedMustConsumeMicroTaskentries, soMOZ_CRASH("Didn't consume MicroTask")fires in~MustConsumeMicroTaskatCycleCollectedJSContext.h:150.- A
SuppressedMicroTaskListthat still holds suppressed tasks is in the microtask queue whileCycleCollectedJSContext::mSuppressedMicroTaskListno longer points to it, and no sync operation is active. PerformMicroTaskCheckPointcallsIsSuppressed(job)only whenIsInSyncOperation() || mSuppressedMicroTaskList(CycleCollectedJSContext.cpp:1262), soSuppressedMicroTaskList::Suppressed(), the only code that hands the stored tasks back to the queue and clears the vector, is skipped.- The job is passed to
RunMicroTask(cpp:1295).MaybeConsumeAsOwnedRunnabletakes the queue's reference, and the list'sRun()is a no-op (CycleCollectedJSContext.h:252-255). - The
RefPtr<MicroTaskRunnable>goes out of scope atcpp:770. With no other owner,~SuppressedMicroTaskListdestroysmSuppressedMicroTaskRunnables, whose remaining entries are unconsumed and crash. The checks that would catch this (cpp:733,cpp:754) are debug-onlyMOZ_ASSERTs.
Frames #0-#4 match this chain exactly. The crash fires inside
~SuppressedMicroTaskListreached from theRefPtrrelease inRunMicroTask, so the list was non-empty when its last reference dropped. The checkpoint here runs underJS::AutoDebuggerJobQueueInterruption::runJobs, triggered by a DebuggeronNewGlobalObjecthook whileExtensionPolicyService::CheckContentScriptscreates a sandbox. How the list lost the context's reference is not shown by this report. One plausible route:PerformMicroTaskCheckPointre-enqueuesmSuppressedMicroTaskListat the end of every checkpoint, nested debugger checkpoints included (cpp:1313, whose comment notes nothing prevents duplicates), andSavedMicroTaskQueue::~SavedMicroTaskQueuemoves it back into the restored queue. A stale duplicate list reachingSuppressed()while a newer list is current would then runmContext->mSuppressedMicroTaskList = nullptr(cpp:744) against the wrong list. Look first at whether a list can reachRunMicroTaskwithout being drained: either drain or release-assert at thecpp:1262gate for anySuppressedMicroTaskListjob, and makeSuppressed()only null the context pointer when it equalsthis. - A
-
The failing code comes from ba06cca1f77c (gh) (bug 1990842) by :mgaudet.
Code references:
- mozilla::CycleCollectedJSContext::PerformMicroTaskCheckPoint
- mozilla::SuppressedMicroTaskList
- mozilla::SuppressedMicroTaskList::Suppressed
- mozilla::CycleCollectedJSContext::PerformMicroTaskCheckPoint
:mgaudet, can you have a look please?
Filed automatically by Clouseau, which analyses nightly crashes with an LLM. Nothing above was written or checked by a human. Please close it as INVALID if it is wrong — that is useful feedback, not a nuisance.
This is not an independent Mozilla discovery: the crash is known here only because somebody submitted the crash report linked at the top. If this duplicates an existing report, please resolve THIS bug as the duplicate and leave the credit with the earlier reporter.
Comment 1•1 month ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.
Updated•1 month ago
|
| Assignee | ||
Comment 2•1 month ago
|
||
This kind of issue has been around for a while; pre-SM owned microtask
I believe it would have been just duplicate promise handler runs.
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
Comment 3•20 days ago
|
||
There is an r+ patch which didn't land and no activity in this bug for 1 week.
:mgaudet, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
Comment 5•19 days ago
|
||
| bugherder | ||
Comment 6•19 days ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.
Updated•19 days ago
|
Comment 7•19 days ago
|
||
The patch landed in nightly and beta is affected.
:mgaudet, please make an uplift decision for beta:
- For beta, nominate the patch for beta uplift approval if the fix should be included in this release, or set
status-firefox161towontfixif the fix can wait for the next release.
Uplift requests can be submitted from Lando: D336189.
See Requesting an Uplift for documentation on how to request an uplift.
For more information, please visit BugBot documentation.
Updated•19 days ago
|
Updated•16 days ago
|
Description
•