Closed Bug 1236384 Opened 9 years ago Closed 9 years ago

MediaDecoder shutting down after gfx has been shutdown

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1207220
Tracking Status
firefox46 --- affected

People

(Reporter: jya, Assigned: jya)

References

Details

Attachments

(1 file)

The issue was properly described by Nicolas in bug 1223193. When shutting down, ShutdownXPCOM is called which notifies its observers with NS_XPCOM_SHUTDOWN_OBSERVER_ID so that they can shutdown. XPCOM expects these operations to be synchronous. One of those observers is the MediaShutdownManager which will loop over all its registered MediaDecoders and call MediaDecoder::Shutdown(), expecting things to be synchronous too. Once the XPCOM observers have been notified , gfxPlatform::ShutdownLayersIPC() is called. However, MediaDecoder::Shutdown() itself isn't synchronous. Internally it will call MediaDecoderStateMachine::Shutdown() which is async which itself calls MediaDecoderReader::Shutdown() also async. So when the MediaShutdownManager loop over the registered MediaDecoder, there are still potentially tasks running. Should those tasks happen to run after gfxPlatform::ShutdownLayersIPC() has been called: we'll typically get some crashes. The gfx team has papered over the issue for years, but fundamentally the issue is that shutting down of the MediaDecoder / MediaShutdownManager is asyncronous. Ideally we would want to use MozPromise/AllPromiseHolder to continue shutting down XPCOM once all the decoders have completed their shutdown. However this is likely too big of a task. so in the mean time, MediaShutdownManager should block until all decoders have fully shutdown.
Blocks: 1214462
This is the likely underlying cause of bug 1236167
Blocks: 1236167
Unfortunately it isn't what's causing bug 1236167. It does fix assertion #4, but not the others which seem to be genuine races.
No longer blocks: 1236167
PCOM when shutting down expects all tasks to be run synchronously. As such, we must ensure that the remaining MediaDecoder are shut down before continuing on the next task. In particular destroying gfxPlatforms must only ever happen after, as it is possible for the MediaDecoderReader to make use of gfx resources during shutdown.
Attachment #8703502 - Flags: review?(cpearce)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Comment on attachment 8703502 [details] [diff] [review] Ensure MediaShutdownManager waits until all MediaDecoder have completed their shutdown. Given this bug is duped, I'll clear the review request.
Attachment #8703502 - Flags: review?(cpearce)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: