Crash in [@ mozilla::Maybe<T>::operator* | mozilla::TouchSwipeState::GetDelta]
Categories
(Core :: Panning and Zooming, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr153 | --- | unaffected |
| firefox160 | --- | unaffected |
| firefox161 | --- | unaffected |
| firefox162 | --- | fixed |
People
(Reporter: clouseau-bot, Assigned: canalun)
References
(Blocks 2 open bugs, Regression)
Details
(Keywords: crash, regression)
Crash Data
Attachments
(1 external file, 1 obsolete file)
Crash report: https://crash-stats.mozilla.org/report/index/f55ec5d5-9b88-45d2-821a-037160261116
MOZ_CRASH Reason:
MOZ_RELEASE_ASSERT(isSome())
Top 10 frames:
0 xul.dll nsIWidget::MayStartSwipeForTouchInput(mozilla::MultiTouchInput const&, mozilla::... widget/nsIWidget.cpp:1367
1 xul.dll nsIWidget::ReceiveTouchSwipableDirections(unsigned long long, mozilla::SideBits) widget/nsIWidget.cpp:1505
2 xul.dll mozilla::detail::RunnableMethodImpl<nsCOMPtr<nsIWidget>,void (nsIWidget::*)(unsi... xpcom/threads/nsThreadUtils.h:1124
3 xul.dll mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail... xpcom/threads/TaskController.cpp:1401
4 xul.dll NS_ProcessNextEvent(nsIThread*, bool) xpcom/threads/nsThreadUtils.cpp:471
5 xul.dll mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:83
6 xul.dll MessageLoop::RunHandler() ipc/chromium/src/base/message_loop.cc:371
7 xul.dll nsAppShell::Run() widget/windows/nsAppShell.cpp:632
8 xul.dll nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:308
9 xul.dll XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:6771
There is 1 crash in nightly 162 with buildid 20261115213519.
Crash-stats has no report of this signature on any earlier build, and Socorro's all-time signature index has no entry for it yet — as far as we can tell it is new with this build.
Clouseau analysis (automated, 72% worth investigating — a calibrated estimate that this is worth someone's time, not that the changeset below caused it). The mechanism below fits the evidence but is not proven end-to-end:
TouchSwipeState::GetDelta probably dereferences an empty previousTouchPoint in nsIWidget::MayStartSwipeForTouchInput (nsIWidget.cpp:1367) when a queued touchmove is replayed after an earlier queued touchend reset the swipe state.
- 7a86a3cd2ed4 added
nsIWidget::ReceiveTouchSwipableDirections, which callsStart()and then replays every queued input throughHandleTouchInputForSwipewithout checking the phase. - On Windows a single
WM_TOUCHcan deliverMULTITOUCH_STARTfor a new finger and thenMULTITOUCH_ENDfor a lifted one, as the bug 2088553 comment inDispatchTouchInputdocuments. If this happens whileWaitingForAPZ, the 1-touch START callsReset()and may start a new wait, and the END and later moves are queued. - During replay,
TouchCounter::Updatedrops the count to 0 on the queued END, andMayStartSwipeForTouchInputcallsTouchSwipeState::Reset(), leavingpreviousTouchPointasNothingandphaseasIdle. - The next queued MOVE (finger still down) reaches
MayStartSwipeForTouchInputinIdle. Its result carries the defaultSome(SideBits::eNone), so the branch at line 1352 is skipped andGetDeltadereferencesNothing.
The frames fit this chain: frame 1 is the replay call at nsIWidget.cpp:1505 and frame 0 the GetDelta dereference at 1367, not the other dereference at 1356. The live path already ignores non-START input in Idle through ignoreForSwipe (bug 2088553), but the replay loop has no equivalent. The exact input sequence (END followed by MOVE in the queue) is inferred from the code and cannot be seen in this single report.
The crash is on a frame that 7a86a3cd2ed4 wrote: frame 1 at nsIWidget.cpp:1505 blames to 7a86a3cd2ed4 (landed 2026-11-13). The first and only report is from build 20261115213519, two days later, and the signature has no earlier history. The report is from Windows 11 in the parent process, matching the Windows-only touchscreen swipe path, with no bit-flip annotation and no Raptor Lake CPU. The other bug 2085128 parts were checked. ab5eaf433784's re-queue fires only in WaitingForAPZ, so it is not on the crashing path after a reset. 47803bb27822 adds another way into WaitingForAPZ, which widens exposure. 07487bac6f80 is a refactor that split out HandleTouchInputForSwipe.
Suspected regressor: 7a86a3cd2ed4 (gh) (bug 2085128) by :canalun.
Impact
The parent process crashes, so the whole browser closes. Only the MOZ_ASSERTs in MayStartSwipeForTouchInput and GetDelta are debug-only. The Maybe::operator* dereference is a MOZ_RELEASE_ASSERT, so every build crashes at line 1367.
Possible fixes
- In the
ReceiveTouchSwipableDirectionsreplay loop, apply the same rule as the live path'signoreForSwipe: once the phase is back toIdle, skip queued non-START inputs (or stop replaying the rest of the queue). - Make
MayStartSwipeForTouchInputreturn early forMULTITOUCH_MOVEwhen the phase isIdleorpreviousTouchPointisNothing, instead of relying on the debug-onlyMOZ_ASSERTat line 1325. - Possibly revisit the
Reset()on a 1-touchMULTITOUCH_STARTwhileWaitingForAPZ, since the Windows START-then-END ordering (bug 2089005) leaves a lifted-finger END behind it in the queue.
How to confirm
Extend browser_test_touchscreen_swipe_gesture_while_waiting.js: keep content busy so the target is unconfirmed, then dispatch START(finger A), START(finger B only), END(finger A), MOVE(finger B) via nsIWidget::DispatchTouchInput, and let the swipable directions arrive. A debug build should hit the MOZ_ASSERT at line 1325 in MayStartSwipeForTouchInput, and an opt build should crash at line 1367.
Code references:
- widget/nsIWidget.cpp:1478
- widget/nsIWidget.cpp:1560
- mozilla::layers::TouchCounter::Update
- widget/nsIWidget.cpp:1499
- widget/nsIWidget.cpp:1456
What the automated skeptic pass checked
In its own words (a pass means the check succeeded, which is not always support for the conclusion):
- unverifiable step4 — The END-then-MOVE queue needs the Windows START(new finger)-then-END(lifted finger) ordering while
WaitingForAPZ, and APZ returningNothingfor the new START so the widget waits again. Both are plausible from the code (bug 2088553 comment,TouchCounter::Updateon START sets count =mTouches.Length()), but neither is visible in the crash report. - unverifiable alt_47803bb27822 — Adds a second way into
WaitingForAPZ(Pending to WaitingForAPZ on the first move). It widens exposure to the same replay hole but is not a separate cause. - pass step1 —
TouchSwipeState::Reset()is*this = TouchSwipeState{}. The defaultpreviousTouchPointisNothingand the defaultphaseisIdle.GetDeltaonly has a debugMOZ_ASSERTbefore*previousTouchPoint. - pass edge0 — The replay loop at lines 1504-1505 (blamed to 7a86a3cd2ed4) calls
HandleTouchInputForSwipewith noIdleguard. The only phase check in the loop is ab5eaf433784'sWaitingForAPZre-queue. Frames 0 and 1 match. - pass step3 — A count-0 END resets mid-replay. A queued MOVE keeps
Some(eNone), so it crashes at 1367 and not 1356. Nothing in a release build blocks anIdleMOVE apart from the touchpad-swipe check at 1339, which only applies if a touchpad swipe is in progress. - pass alt_ab5eaf433784 — The re-queue fires only in
WaitingForAPZ. After a mid-replayReset()the phase isIdle, so it neither causes nor prevents the crash. It only edited the loop.
:canalun, can you have a look please?
Filed automatically by Clouseau with an LLM, from a submitted crash report: not an independent Mozilla discovery
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•11 days ago
|
||
Set release status flags based on info from the regressing bug 2085128
Comment 2•10 days ago
|
||
:canalun, since you are the author of the regressor, bug 2085128, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 3•9 days ago
|
||
The crash caused by a Windows widget bug (bug 2089005) can happen when
replaying the queued inputs in ReceiveTouchSwipableDirections() as well.
So the guard is necessary at that time, too.
This patch doesn't include a test case for the same reason explained on
https://phabricator.services.mozilla.com/D339398 .
Updated•9 days ago
|
| Assignee | ||
Comment 4•9 days ago
|
||
This patch doesn't change the behavior.
This patch moves the guard for Windows widget bugs into HandleTouchInputForSwipe().
One of the three call sites of that function currently doesn't have the guard. But
that call site works with the guard as well.
| Assignee | ||
Updated•9 days ago
|
Updated•9 days ago
|
Comment 6•9 days ago
|
||
| bugherder | ||
Updated•2 hours ago
|
Description
•