Closed Bug 1816852 Opened 2 years ago Closed 2 years ago

Crash in [@ mozilla::MediaFormatReader::OnVideoSeekCompleted]

Categories

(Core :: Audio/Video: Playback, defect, P3)

Unspecified
All
defect

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox111 --- wontfix
firefox112 --- wontfix
firefox113 --- wontfix
firefox114 --- fixed

People

(Reporter: gsvelto, Assigned: alwu)

References

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

Crash report: https://crash-stats.mozilla.org/report/index/bca9f683-2fed-4cfe-840d-e9ee00230122

Reason: EXCEPTION_ACCESS_VIOLATION_WRITE

Top 10 frames of crashing thread:

0  ntdll.dll  RtlAcquireSRWLockExclusive  
1  xul.dll  mozilla::OffTheBooksMutex::Lock  xpcom/threads/Mutex.h:65
1  xul.dll  mozilla::detail::BaseAutoLock<mozilla::Mutex&>::BaseAutoLock  xpcom/threads/Mutex.h:236
1  xul.dll  mozilla::MozPromise<mozilla::media::TimeUnit, mozilla::SeekRejectValue, 1>::Private::Resolve<mozilla::media::TimeUnit>  xpcom/threads/MozPromise.h:1215
2  xul.dll  mozilla::MozPromiseHolderBase<mozilla::MozPromise<mozilla::media::TimeUnit, mozilla::SeekRejectValue, 1>, mozilla::MozPromiseHolder<mozilla::MozPromise<mozilla::media::TimeUnit, mozilla::SeekRejectValue, 1> > >::Resolve  xpcom/threads/MozPromise.h:1372
2  xul.dll  mozilla::MediaFormatReader::OnVideoSeekCompleted  dom/media/MediaFormatReader.cpp:2992
3  xul.dll  mozilla::MozPromise<mozilla::media::TimeUnit, mozilla::MediaResult, 1>::ThenValue<mozilla::MediaFormatReader*, void   xpcom/threads/MozPromise.h:730
4  xul.dll  mozilla::MozPromise<nsTAutoStringN<char16_t, 64>, nsresult, 0>::ThenValueBase::ResolveOrRejectRunnable::Run  xpcom/threads/MozPromise.h:489
5  xul.dll  mozilla::TaskQueue::Runner::Run  xpcom/threads/TaskQueue.cpp:259
6  xul.dll  nsThreadPool::Run  xpcom/threads/nsThreadPool.cpp:309

This crash seems to be caused by mSeekPromise being NULL when it's accessed. Note: there are no crashes under this signatures because we first need to land bug 1816846 for them to appear, the stack above however represents the problem. Once bug 1816846 several different signatures will collapse here amounting to several 10s of crashes per week.

Adding two more signatures that will appear here after bug 1816846. This seems to affect all platforms.

Crash Signature: [@ mozilla::MediaFormatReader::OnVideoSeekCompleted] → [@ mozilla::MediaFormatReader::OnVideoSeekCompleted] [@ mozilla::MediaFormatReader::OnSeekFailed] [@ mozilla::MediaFormatReader::OnAudioSeekCompleted]
Depends on: 1816846
OS: Windows → All

Hi Gabriele, do you know how to reproduce it reliably? It seems OnVideoSeekCompleted has remained unchanged for years. If there is a particular test we can run or a regression window, that will be very helpful for further investigation of this issue.

Flags: needinfo?(gsvelto)

Looking at the comments in the crash reports doesn't help, but these particular crashes started to have significant volume in version 109. Given they're all the same type of crash I suspect the reason must be the same everywhere and might be related to the asynchronous nature of this code. I can crack open a minidump to check to what object the NULL pointer being accessed belongs, though as I said in comment 0, it appears to be the promise itself.

Flags: needinfo?(gsvelto)

I've opened a minidump and I can confirm that the issue is caused by mSeekPromise being NULL here. The other crashes that will fall under this signature once bug 1816846 lands are the same, the promise is NULL leading to the crash. This means that the promise has already been resolved, or rejected - which cleared the pointer in the MozPromiseHolder object, and we're rejecting or resolving it a second time leading to the crash.

Blocks: media-triage

Hey Alastor, can you have a look?

No longer blocks: media-triage
Flags: needinfo?(alwu)

No idea for now, but keep NI. Will take a look again later

Severity: -- → S3
Priority: -- → P3

I guess this is somehow related with bug 1815798. We can see the crash rate significantly dropped on Fx111 where we landed some changes. Let's see if the crash would be fixed completely after landing the another fix in bug 1815798.

Assignee: nobody → alwu
Flags: needinfo?(alwu)
See Also: → 1815798
Crash Signature: [@ mozilla::MediaFormatReader::OnVideoSeekCompleted] [@ mozilla::MediaFormatReader::OnSeekFailed] [@ mozilla::MediaFormatReader::OnAudioSeekCompleted] → [@ mozilla::MediaFormatReader::OnVideoSeekCompleted] [@ mozilla::MediaFormatReader::OnSeekFailed]
Flags: needinfo?(alwu)

When a new seeking starts, we always reset the demuxer which should be
able to prevent the former seeking callback from being invoked.
So ideally we shouldn't resolve/reject same promise twice.

The situation of causing this problem is still unknown. Therefore, use a
workaround to resolve/reject a promise only when it exists, and add
more assertions to help diagnose the problem.

Flags: needinfo?(alwu)
Pushed by alwu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/aade104e461f don't resolve/reject same promise twice. r=media-playback-reviewers,padenot
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch

The patch landed in nightly and beta is affected.
:alwu, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox113 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(alwu)

Crash volume is low, let it ride with the train of Fx114.

Flags: needinfo?(alwu)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: