Crash in [@ mozilla::Maybe<T>::operator* | nsIWidget::TouchSwipeState::GetDelta]
Categories
(Core :: Panning and Zooming, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr153 | --- | unaffected |
| firefox159 | --- | unaffected |
| firefox160 | --- | unaffected |
| firefox161 | --- | fixed |
People
(Reporter: clouseau-bot, Assigned: canalun)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: crash, regression)
Crash Data
Attachments
(1 external file)
Crash report: https://crash-stats.mozilla.org/report/index/de5b19d9-a95c-4839-ad34-154800261103
MOZ_CRASH Reason:
MOZ_RELEASE_ASSERT(isSome())
Top 10 frames:
0 xul.dll nsIWidget::MayStartSwipeForTouchInput(mozilla::MultiTouchInput const&, mozilla::... widget/nsIWidget.cpp:1345
1 xul.dll nsIWidget::DispatchTouchInput(mozilla::MultiTouchInput&) widget/nsIWidget.cpp:1507
2 xul.dll nsWindow::OnTouch(unsigned long long, long long) widget/windows/nsWindow.cpp:6931
3 xul.dll nsWindow::ProcessMessageInternal(unsigned int, unsigned long long&, long long&, ... widget/windows/nsWindow.cpp:5950
4 xul.dll nsWindow::WindowProcInternal(HWND__*, unsigned int, unsigned long long, long lon... widget/windows/nsWindow.cpp:4776
5 xul.dll nsWindow::WindowProc(HWND__*, unsigned int, unsigned long long, long long) widget/windows/nsWindow.cpp:4733
6 user32.dll UserCallWinProcCheckWow(_ACTIVATION_CONTEXT*, int64_t (*)(tagWND*, unsigned int,...
7 user32.dll SendMessageWorker(tagWND*, unsigned int, uint64_t, int64_t, int)
8 user32.dll SendMessageInternal(HWND__*, unsigned int, uint64_t, int64_t, int)
9 user32.dll SendMessageW
There is 1 crash in nightly 161 with buildid 20261103080110.
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:
nsIWidget::MayStartSwipeForTouchInput dereferences an empty TouchSwipeState::previousTouchPoint in GetDelta when a non-consumed MULTITOUCH_MOVE arrives while the touch-swipe phase is Idle.
eea5a3340120(bug 2085126) added the touchscreen swipe-to-nav state machine and turned it on by default in Nightly viawidget.swipe.touchscreen.enabled=@IS_NIGHTLY_BUILD@.- In
MayStartSwipeForTouchInput, theMULTITOUCH_MOVEcase checks forIdleonly withMOZ_ASSERT, and the only early return is forRejected, so release builds continue toGetDeltainIdle. previousTouchPointisSomeonly afterStart();Reset()sets it back toNothingand the phase toIdle.- The state can probably become
Idlewhile a finger is still down. On Windows,nsWindow::OnTouchputs DOWN/MOVE contacts in one START/MOVE event and UP contacts in a separate END. When one finger lifts and another goes down in the same frame,TouchCounter::Updatecounts only the new finger on START and subtracts the lifted one on END. The count reaches 0, and the END path added in64937b3aab8dcallsReset(). - The remaining finger's next move then reaches
GetDeltawithpreviousTouchPoint == Nothingand tripsMOZ_RELEASE_ASSERT(isSome()).
The crash reason MOZ_RELEASE_ASSERT(isSome()), the inlined Maybe::operator* / TouchSwipeState::GetDelta at widget/nsIWidget.cpp:1345, and the nsWindow::OnTouch caller match this path. The build is the first Nightly to contain the series. Step 4 is an inferred trigger: a two-finger touchpad START converted to a pan gesture, so the widget never records it, would also leave the phase Idle.
Blame at the build revision shows the crashing lines (widget/nsIWidget.cpp 1345-1346) and the Rejected-only early return came from eea5a3340120. The count-based Reset() came from 64937b3aab8d, and the EventsAreControllingSwipe check just above came from 11e385cb5285. All are bug 2085126, landed 2026-11-02, and appear in build 20261103080110, which is this crash's build and the signature's first report. The pref that enables the path is on by default in Nightly in the same patch. Neither the hardware flags nor the Nimbus recipes point anywhere else.
Suspected regressor: eea5a3340120 (gh) (bug 2085126) by :canalun.
Impact
The parent process crashes, so the whole browser closes. Debug builds would first fire the MOZ_ASSERT that the phase is Pending or Rejected in the MULTITOUCH_MOVE case; release builds skip it and hit the release assert in Maybe::operator*.
Possible fixes
- In
MayStartSwipeForTouchInput, possibly treatMULTITOUCH_MOVEinPhase::Idle(or any state wherepreviousTouchPointisNothing) as rejected or ignored, instead of relying on the debug-onlyMOZ_ASSERT. - Possibly make
TouchSwipeState's finger counting match WindowsWM_TOUCHframing, where the START/MOVE event leaves out contacts lifted in the same frame, soReset()does not run while a finger is still down. - Possibly make the swipe state ignore touch sequences whose START was never seen by
DispatchTouchInput, such as two-finger touchpad STARTs converted to a pan gesture.
How to confirm
Add a test to browser_test_touchscreen_swipe_gesture_with_multitouch.js that, through nsIWidget::DispatchTouchInput, sends finger A START, then a frame with A UP and B DOWN (START [B] followed by END [A]), then a horizontal MOVE [B] outside the slop. A release build is expected to hit MOZ_RELEASE_ASSERT(isSome()) in GetDelta; a debug build should fail the Phase::Pending || Phase::Rejected assert first.
Code references:
- widget/nsIWidget.cpp:1303
- widget/nsIWidget.cpp:1314
- modules/libpref/init/StaticPrefList.yaml:21808
- widget/nsIWidget.cpp:1306
- mozilla::layers::TouchCounter::Update
- modules/libpref/init/StaticPrefList.yaml:21806
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 mechanism — That the phase was
Idleat the crash follows from the build source (the only states withpreviousTouchPoint == NothingareIdle/afterReset, andRejectedreturns early). The exact touch sequence that led toIdlewith a finger down (a mixed UP/DOWN frame miscounted byTouchCounter, or a two-finger touchpad START converted to a pan gesture) is inferred and not observed in this report. - unverifiable hunk2 — Same series. It adds the count-based
Reset()on END, a plausible route toIdlewith a finger still down. Even without it,eea5a3340120's unconditionalReset()on END already allowed the same state. - unverifiable other — Different bug (2086760), score 0. Nothing ties it to the touch-swipe state machine. Not diffed.
- pass hunk0 — Blame at the build revision attributes the crashing lines 1345-1346 (
GetDeltacall), theRejected-only early return at 1326, and the debug-only phase assert at 1318 toeea5a3340120. The code did not exist before this series. - pass other — Adds the
mSwipeTracker->EventsAreControllingSwipe()reject just before the crashing line. It cannot produce anIdlephase. It is the same series, so a co-candidate, not a separate cause.
: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•24 days ago
|
||
Set release status flags based on info from the regressing bug 2085126
| Assignee | ||
Updated•24 days ago
|
Comment 2•24 days ago
|
||
:canalun, since you are the author of the regressor, bug 2085126, could you take a look?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 3•24 days ago
|
||
Crash stack:
MOZ_RELEASE_ASSERT(isSome())
mozilla::Maybe<ScreenIntPoint>::operator*()
nsIWidget::TouchSwipeState::GetDelta()
nsIWidget::MayStartSwipeForTouchInput()
nsIWidget::DispatchTouchInput()
nsWindow::OnTouch()
Likely cause:
I couldn't reproduce this crash, but the following is a likely cause
considering the stack trace.
nsWindow::OnTouch splits one WM_TOUCH into two inputs and dispatches
them in this order:
(https://searchfox.org/firefox-main/rev/2b71df5bf2e07525d1129be46e0ee02ec70d34d8/widget/windows/nsWindow.cpp#6929-6936)
- MULTITOUCH_START (or MOVE) with the DOWN and MOVE contacts
- MULTITOUCH_END with the UP contacts
Therefore, if the user lifts finger A up and puts finger B down
in the same WM_TOUCH (i.e., almost at the same time), the inputs
are split and delivered in the below order:
(Note MULTITOUCH_START[B] comes first.)
Input Count Phase previousTouchPoint
(A is on the screen) 1 Pending A
MULTITOUCH_START[B] 1 Pending B (Start() is called again)
MULTITOUCH_END[A] 0 Idle Nothing (Reset() is called)
MULTITOUCH_MOVE[B] 0 Idle Nothing
-> GetDelta() crashes
The count becomes 0 while B is still down, so the phase goes back
to Idle. The next move of B then reaches GetDelta() with no previous
point.
Fix:
- When the phase is Idle, accept only MULTITOUCH_START. Other
inputs mean the count doesn't reflect the actual finger
arrangement, so skip them. - When the phase is not Idle, at least one finger is already
down. So a MULTITOUCH_START with only one finger should not
happen. Skip it as well.
Note that only swipe handling is skipped. APZ and content still
receive these inputs.
Test:
This patch doesn't have a test. The crash needs one WM_TOUCH that
has an UP contact and a DOWN contact together. Our test helpers
can't make it.
(e.g. nsWindow::InjectTouchPoint injects one contact per
InjectTouchInput() call.)
Updated•24 days ago
|
| Assignee | ||
Updated•23 days ago
|
Updated•18 days ago
|
Description
•