Firefox doesn't release wakelock/idle-inhibit on Linux when video stops playing (regression)
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox144 | --- | unaffected |
| firefox145 | --- | unaffected |
| firefox146 | --- | fixed |
People
(Reporter: simonp.bugzilla, Assigned: stransky)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression, reporter-external, sec-low)
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0
Steps to reproduce:
Steps:
- Navigate to any URL with a video element (e.g. Youtube)
- Start playback
- Pause playback
Actual results:
After pausing, the video-playing WakeLock is held until Firefox is closed.
Expected results:
Pausing immediately releases the WakeLock.
This is a recent regression reproducible on the 20251026204257 deb package. 20251021202405 is good.
I suspect https://hg-edge.mozilla.org/integration/autoland/rev/3f521cbac21c8dad5ca4a71300534d0a504f6ea0 is the probable cause.
Checking logs (attached) makes it pretty clear what goes wrong.
The video-playing lock is created using FreeDesktopScreensaver. The browser subsequently also attempts to create the audio-playing lock, but FreeDesktopScreensaver doesn't work for that, so type is switched to FreeDesktopPortal without releasing the already held FreeDesktopScreensaver lock, leaking it.
env MOZ_WAKE_LOCK_TYPE=FreeDesktopPortal to use FreeDesktopPortal to begin with works around the problem.
Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=39b59ec314a5f93aee4ede2680255fe7050bc41a&tochange=3f521cbac21c8dad5ca4a71300534d0a504f6ea0
Regressed by Bug 1665986.
Comment 5•4 months ago
|
||
:stransky, since you are the author of the regressor, bug 1665986, could you take a look?
For more information, please visit BugBot documentation.
env MOZ_WAKE_LOCK_TYPE=FreeDesktopPortalto useFreeDesktopPortalto begin with works around the problem.
Note: This workaround is incomplete. The video-playing lock doesn't seem to be held anymore while a video is playing so only sleep is inhibited (because the audio-playing lock is held).
The regressor should be backed out if this is not going to be fixed soon since it is a significant security concern for screens not to automatically lock anymore.
| Assignee | ||
Comment 8•4 months ago
|
||
There are two wake locks - foreground (idle inhibit) and background (sleep inhibit), both independents. If audio wake lock is help (as on the log) it should dim screen but it prevents Firefox from sleep so it can play music with screen off (you can see different WakeLockTopic addresses in the log).
So what's the problem here? Is Firefox screen hold on even for audio lock or so?
Thanks.
| Assignee | ||
Comment 9•4 months ago
•
|
||
| Reporter | ||
Comment 10•4 months ago
|
||
So what's the problem here? Is Firefox screen hold on even for audio lock or so?
The first problem is that in a clean environment the video-playing foreground lock is leaked when a video is played and then stopped. (Paused, tab closed, doesn't matter. Only terminating Firefox releases the lock.)
The second problem is that if MOZ_WAKE_LOCK_TYPE=FreeDesktopPortal, then video-playing is created as a background lock so the screensaver is not inhibited. The log shows this:
[Parent 516492: Main Thread]: D/LinuxWakeLock [7f8ebf6861c0] WakeLockTopic::WakeLockTopic() created video-playing on background 1
| Assignee | ||
Comment 12•4 months ago
|
||
Looks like we need to update the strategy a bit. Looks like:
[Parent 19704: Main Thread]: D/LinuxWakeLock [7f876309a9c0] WakeLockListener::Callback() topic video-playing state locked-foreground
Screen playback is on
[Parent 19704: Main Thread]: D/LinuxWakeLock [7f876309a9c0] WakeLockListener::Callback() topic video-playing state locked-background
Video is hidden but audio is here
[Parent 19704: Main Thread]: D/LinuxWakeLock [7f876309a9c0] WakeLockListener::Callback() topic video-playing state locked-foreground
Screen playback is back on
[Parent 19704: Main Thread]: D/LinuxWakeLock [7f876309a9c0] WakeLockListener::Callback() topic video-playing state unlocked
Tab is closed - all locks are removed.
So we're moving between locked-background / locked-foreground fluently here and unlock state should remove all locks.
| Assignee | ||
Comment 13•4 months ago
|
||
Updated•4 months ago
|
| Assignee | ||
Updated•4 months ago
|
Comment 14•4 months ago
|
||
Comment 15•4 months ago
|
||
| bugherder | ||
| Reporter | ||
Comment 16•4 months ago
|
||
Seems good now, thanks.
Updated•4 months ago
|
Updated•4 months ago
|
Description
•