WebCodecs VideoDecoder frequent reset & close causes tab crash
Categories
(Core :: Audio/Video: Web Codecs, defect, P2)
Tracking
()
People
(Reporter: andreas, Assigned: aosmond)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression)
Crash Data
Attachments
(4 files, 1 obsolete file)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr140+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-release+
|
Details | Review |
|
210.51 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0
Steps to reproduce:
I have a wasm app that makes use of WebCodec for video decoding. Both upon close and reset of the VideoDecoder I experience tab crashes.
There's no actionable information in the log - my own logs indicate that close/reset is the last thing that happened.
I unfortunately do not have a minimal repro case at this point, but I have a build that repros it very well here:
https://rerun.io/viewer/pr/10590?url=https%3A%2F%2Fstatic.rerun.io%2Frrd%2F0.23.0%2Ftest_video_00d14499a43e355706609cb7f8f902e2b9718b71.rrd
After the application & file is loaded scrub on the timeline. This reliably repros the crash for me on Windows and I have reports from coworkers getting it on Linux as well.
Actual results:
Intermittent tab crashes, as far as I can tell from logs these happen right after a call to either close or reset
Something I forgot to mention: I haven't checked if the codec is relevant, but it's an H264 Annex B video in this case with codec string avc1.640015
Comment 2•11 months ago
|
||
I was able to reproduce the tab crash on Win11x64 using Firefox build 140.0.4 and the link from description (https://rerun.io/viewer/pr/10590?url=https%3A%2F%2Fstatic.rerun.io%2Frrd%2F0.23.0%2Ftest_video_00d14499a43e355706609cb7f8f902e2b9718b71.rrd)
Mark issue as new for engineering input. Thank you.
Updated•10 months ago
|
Comment 3•10 months ago
|
||
The severity field is not set for this bug.
:padenot, could you have a look please?
For more information, please visit BugBot documentation.
Comment 4•10 months ago
|
||
Reporter, thanks for filing!
Would you mind getting us a couple of those crashes from about:crashes, and paste them here? This will get us stacks so we can assign the right person to look into this. Usually we can match them up by time it occurred. Thanks!
Sure!
A few older one on 140.0.4:
https://crash-stats.mozilla.org/report/index/8d01567b-f57a-45ba-8d81-f96e10250711
https://crash-stats.mozilla.org/report/index/c1d1f835-f0ee-4523-b889-91fe30250805
And a fresh one on 141:
https://crash-stats.mozilla.org/report/index/4b8248fe-62bb-4153-ad69-ea5530250711
Comment 6•10 months ago
|
||
Chun-Min, something funny with promises in the `MediaChangeMonitor```, can you have a look
Updated•10 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
Updated•9 months ago
|
Updated•9 months ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 7•5 months ago
|
||
I am able to consistently reproduce this in CI trying to land some ffmpeg + Android work....
The owner decides to call MediaChangeMonitor::Decode, after which we call MediaChangeMonitor::CheckForChange:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#972
If we don't have a decoder yet, we create one:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#1279
After which we ensure a promise is stored in mDecodePromise:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#986
When the underlying decoder is initialized, we call MediaChangeMonitor::DecodeFirstSample:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#1197
Which calls Decode on the underlying decoder, which is probably running on another thread and/or in another process:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#1261
The owner decides to call MediaChangeMonitor::Shutdown, which rejects mDecodePromise:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#1075
The Decode promise from earlier finally returns with a result, but mDecodePromise was already rejected:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#1267
| Assignee | ||
Updated•5 months ago
|
Updated•5 months ago
|
| Assignee | ||
Comment 9•5 months ago
|
||
My first thought is to just delay rejecting the promises:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#1072-1079
To happen when the shutdown promise returns:
https://searchfox.org/firefox-main/rev/33bba5cfe4a89dda0ee07fa9fbac578353713fd3/dom/media/platforms/wrappers/MediaChangeMonitor.cpp#1087
But maybe that causes other problems further up in the state machine, because they might resolve the promise instead of reject....
The alternative is to just stop using MozPromiseHolder::Resolve and MozPromiseHolder::Reject, at least without checking if the promise is empty first. That is probably okay.
| Assignee | ||
Comment 10•5 months ago
|
||
Since the owner can call MediaChangeMonitor::Shutdown and reject any
outstanding promises, we shouldn't assume mDecodePromise will still be
set in any promise chains after dispatching. This will allow us to
shutdown gracefully.
Updated•5 months ago
|
| Assignee | ||
Updated•5 months ago
|
| Assignee | ||
Comment 11•5 months ago
|
||
The patch uplifts cleanly to ESR115, I think it is impacted, even if we aren't getting crash reports for it.
| Assignee | ||
Comment 12•5 months ago
|
||
Since the owner can call MediaChangeMonitor::Shutdown and reject any
outstanding promises, we shouldn't assume mDecodePromise will still be
set in any promise chains after dispatching. This will allow us to
shutdown gracefully.
Updated•5 months ago
|
| Assignee | ||
Comment 13•5 months ago
|
||
Since the owner can call MediaChangeMonitor::Shutdown and reject any
outstanding promises, we shouldn't assume mDecodePromise will still be
set in any promise chains after dispatching. This will allow us to
shutdown gracefully.
Updated•5 months ago
|
| Assignee | ||
Comment 14•5 months ago
|
||
Since the owner can call MediaChangeMonitor::Shutdown and reject any
outstanding promises, we shouldn't assume mDecodePromise will still be
set in any promise chains after dispatching. This will allow us to
shutdown gracefully.
Original Revision: https://phabricator.services.mozilla.com/D278077
Updated•5 months ago
|
Comment 15•5 months ago
|
||
firefox-release Uplift Approval Request
- User impact if declined: High volume content process crash
- Code covered by automated testing: yes
- Fix verified in Nightly: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: N/A
- Risk associated with taking this patch: low
- Explanation of risk level: Just adds a check to only fulfill valid promises. Well understood on how we got into that state.
- String changes made/needed: N/A
- Is Android affected?: yes
Comment 16•5 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined: High volume content process crash
- Code covered by automated testing: yes
- Fix verified in Nightly: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: N/A
- Risk associated with taking this patch: low
- Explanation of risk level: Just adds a check to only fulfill valid promises. Well understood on how we got into that state.
- String changes made/needed: N/A
- Is Android affected?: yes
Comment 17•5 months ago
|
||
firefox-esr115 Uplift Approval Request
- User impact if declined: High volume content process crash
- Code covered by automated testing: yes
- Fix verified in Nightly: no
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: N/A
- Risk associated with taking this patch: low
- Explanation of risk level: Just adds a check to only fulfill valid promises. Well understood on how we got into that state.
- String changes made/needed: N/A
- Is Android affected?: yes
| Assignee | ||
Comment 18•5 months ago
|
||
I only added 147 because of the fix-optional tag. It should be low risk, but could easily ride a dot release because we've lived with this crash for a long time, what's one more release :).
Comment 19•5 months ago
|
||
Comment 20•5 months ago
|
||
| bugherder | ||
Updated•5 months ago
|
Updated•5 months ago
|
Comment 21•5 months ago
|
||
The patch landed in nightly and beta is affected.
:aosmond, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox147towontfix.
For more information, please visit BugBot documentation.
Updated•4 months ago
|
Updated•4 months ago
|
Updated•4 months ago
|
Comment 23•4 months ago
|
||
| uplift | ||
Updated•4 months ago
|
Updated•4 months ago
|
Comment 24•4 months ago
|
||
| uplift | ||
Comment 25•4 months ago
•
|
||
I was able to reproduce the tab crash on Win11x64 using FF build 140.0.4 (crashID: https://crash-stats.mozilla.org/report/index/eb85364a-740b-4894-98b0-63fdd0260116 )
Verified issue as fixed meaning that tab is not crashing on Win11x64 using Firefox builds: 149.0a1, 148.0b2 and 147.0.1 (build from Treeherder).
Comment 26•4 months ago
|
||
I have a question though, even if it does not crash anymore, the link from description is not playing on latest builds like it did on 140.0.4.
Andrew, is this expected? Thank you.
| Assignee | ||
Comment 27•4 months ago
|
||
I would not have expected my patch to fix a playback issue unless it was the crash itself that was stopping the playback. Please file a new bug about the playback failing, and if you are able to find a regression window for this, that would be awesome! Thanks.
Comment 28•4 months ago
|
||
Logged bug 2011428 for comment#27.
Marking this as verified as tab is not crashing anymore on 148.0b4, 149.0a1, 147.0.1 and 140.8.0esr(20260119133002)- from treeherder.
Not marking as verified as release 140.8.0esr is still pending.
Description
•