Crash in [@ mozilla::detail::MutexImpl::~MutexImpl | mozilla::AudioCallbackDriver::~AudioCallbackDriver]
Categories
(Core :: Audio/Video: MediaStreamGraph, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr78 | --- | unaffected |
firefox86 | --- | wontfix |
firefox87 | --- | wontfix |
firefox88 | --- | fixed |
firefox89 | --- | fixed |
People
(Reporter: gsvelto, Assigned: padenot)
References
(Regressed 1 open bug)
Details
(Keywords: crash, Whiteboard: qa-not-actionable)
Crash Data
Attachments
(1 file, 2 obsolete files)
48 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
Crash report: https://crash-stats.mozilla.org/report/index/f16151a3-a57b-4dce-98a6-b95c10201218
MOZ_CRASH Reason: MOZ_CRASH(mozilla::detail::MutexImpl::~MutexImpl: pthread_mutex_destroy failed)
Top 10 frames of crashing thread:
0 libmozglue.dylib mozilla::detail::MutexImpl::~MutexImpl mozglue/misc/Mutex_posix.cpp:90
1 XUL mozilla::AudioCallbackDriver::~AudioCallbackDriver dom/media/GraphDriver.cpp:545
2 XUL mozilla::AudioCallbackDriver::~AudioCallbackDriver dom/media/GraphDriver.cpp:536
3 XUL mozilla::AudioCallbackDriver::Release dom/media/GraphDriver.h:560
4 XUL mozilla::detail::RunnableFunction<mozilla::AudioCallbackDriver::DeviceChangedCallback xpcom/threads/nsThreadUtils.h:568
5 XUL mozilla::Runnable::Release xpcom/threads/nsThreadUtils.cpp:65
6 XUL nsThreadPool::Run xpcom/threads/nsThreadPool.cpp:301
7 XUL nsThread::ProcessNextEvent xpcom/threads/nsThread.cpp:1197
8 libsystem_malloc.dylib _malloc_zone_calloc
9 libobjc.A.dylib cache_getImp
It seems like we're attempting to destroy a mutex that's still being held. You can see the crashing stack in thread 45 above, at the same time the stack in thread 0 looks like this:
0 libsystem_kernel.dylib kevent_id
1 libdispatch.dylib _dispatch_event_loop_wait_for_ownership
2 libdispatch.dylib __DISPATCH_WAIT_FOR_QUEUE__
3 libdispatch.dylib _dispatch_sync_f_slow
4 XUL core::ptr::drop_in_place src/libcore/ptr/mod.rs:177
5 XUL cubeb_backend::capi::capi_stream_destroy third_party/rust/cubeb-backend/src/capi.rs:174
6 XUL mozilla::AudioCallbackDriver::~AudioCallbackDriver() dom/media/GraphDriver.cpp:545
7 XUL mozilla::AudioCallbackDriver::~AudioCallbackDriver() dom/media/GraphDriver.cpp:536
8 XUL mozilla::AudioCallbackDriver::Release() dom/media/GraphDriver.h:560
9 XUL mozilla::(anonymous namespace)::MediaTrackGraphShutDownRunnable::Run() dom/media/MediaTrackGraph.cpp:1586
10 XUL mozilla::AutoTaskDispatcher::TaskGroupRunnable::Run() xpcom/threads/TaskDispatcher.h:228
So the main thread was waiting to get a lock on the mutex suggesting that it was already held by some other thread. Maybe thread 45 itself?
Comment 1•3 years ago
|
||
Hi, paul,
It crashed in the graph driver, and all of them happened on MacOS. Do you get any idea what's happened?
Thank you.
Assignee | ||
Comment 2•3 years ago
|
||
This is related to the fallback driver probably, it's the only lock there is when using an AudioCallbackDriver
. This also looks like a shutdown crash ?
Comment 3•3 years ago
|
||
The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.
Comment 4•3 years ago
|
||
Looks to me like a double-destroy by two different threads.
This is in release, so we don't hit RefPtr asserts.
Something like:
- Main: ACD::Release()
- Main: ACD::~ACD()
- Main ~ACD() blocked on IO, destroying the cubeb stream (and clearing the DeviceChangeCallback)
- AudioIPC: DeviceChangeCallback() -> ACD::AddRef()
- AudioIPC: Dispatch to Background
- Background: ACD::Release()
- Background: ACD::~ACD()
Do we have a racy situation wrt releasing the cubeb stream? If the above is correct we should be able to mitigate this if we unhook the DeviceChangeCallback before we engage the dtor.
Assignee | ||
Comment 5•3 years ago
|
||
It seems to me that we shouldn't be doing cubeb_stream_destroy
on the main thread either, but your suggestion also would work.
We need to support device change events in the mock cubeb backend to test this.
Assignee | ||
Comment 6•3 years ago
|
||
Assignee | ||
Comment 7•3 years ago
|
||
Depends on D101177
Updated•3 years ago
|
Assignee | ||
Comment 8•3 years ago
|
||
Depends on D101178
Updated•3 years ago
|
Updated•3 years ago
|
Pushed by padenot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a7dd0f81f5ea Unregister the device changed callback before destroying an AudioCallbackDriver. r=pehrsons
Comment 10•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Comment 11•3 years ago
|
||
The patch landed in nightly and beta is affected.
:padenot, is this bug important enough to require an uplift?
If not please set status_beta
to wontfix
.
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 12•3 years ago
|
||
Comment on attachment 9196089 [details]
Bug 1683822 - Unregister the device changed callback before destroying an AudioCallbackDriver. r?pehrsons
Beta/Release Uplift Approval Request
- User impact if declined: A few crashes a day on macOS
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): It's clear that this is the right thing to do, but it's too low traffic and the timing is too hard to reproduce to have a test ready right now, this is worked on in 1700592.
- String changes made/needed:
Comment 13•3 years ago
|
||
Comment on attachment 9196089 [details]
Bug 1683822 - Unregister the device changed callback before destroying an AudioCallbackDriver. r?pehrsons
Approved for 88.0b5.
Comment 14•3 years ago
|
||
bugherder uplift |
Updated•3 years ago
|
Description
•