Open Bug 1609444 Opened 6 years ago Updated 3 years ago

GMP thread can write to disk (to clear storage or remove plugins) at xpcom-shutdown-threads time

Categories

(Core :: Audio/Video: GMP, task, P3)

task

Tracking

()

Performance Impact medium

People

(Reporter: Gijs, Unassigned)

References

Details

(Keywords: perf:responsiveness)

We're auditing whether we can shut down sooner, to make shutdown shorter. As part of this, we're evaluating what work happens in observers of xpcom-shutdown-threads. This includes GMPServiceParent.cpp

For this to work, we need to be sure we do not in any way rely on writes that happen on this thread, that could therefore be missed / not happen if shutdown goes ahead without "cleanly" shutting down this thread.

In the case of the GMPServiceParent, it seems that we create the thread and offer an abstract mechanism to dispatch tasks to this thread via GMPDispatch.

This includes the following tasks that can write to disk:

One solution here would be for the deletions to have their own shutdown blocker, or to move the shutdown response earlier (e.g. profile-before-change - I suspect this code needs the profile anyway?). I'm also a little puzzled because this comment in XPCOMInit suggests media code will shut down before xpcom-shutdown-threads, so perhaps there's something else that already guarantees all these deletions have finished before we shut down?

FWIW it looks like that comment in XPCOMInit used to be before xpcom-shutdown-threads.

Taking a second look at this - it looks like this already ensures that everything is cleared out of mGMPThread's queue during the profile-change-teardown event. In UnloadPlugins it adds an event to the back of its queue which sets the mWaitingForPluginsSyncShutdown flag to false, which the main thread spins the event loop waiting for. I think this might not be airtight, but it looks like it's trying to not do anything past that point, so if we give it a little bit of extra sealing we probably won't break anything.

Whiteboard: [fxperf] → [fxperf:p2]
No longer blocks: 1606879
Performance Impact: --- → P2
Whiteboard: [fxperf:p2]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.