Audio power request prevents sleep on Windows 11 on Aliexpress pages
Categories
(Core :: Web Audio, defect)
Tracking
()
People
(Reporter: brahman.calf, Assigned: karlt)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0
Steps to reproduce:
- Go to https://www.aliexpress.us/item/3256805048523628.html (or any other product page on Aliexpress)
- Click anywhere on page after it has fully loaded
- Run "powercfg /requests"
Actual results:
Powercfg reports a persistent request for the audio device even though the site has no audio playing (i.e. no "PLAYING" displayed on tab) . This prevents sleep entry from idle timer expiration. Closing the tab causes the audio request to get removed and sleep happens normally.
SYSTEM:
[DRIVER] NVIDIA High Definition Audio (HDAUDIO\FUNC_01&VEN_10DE&DEV_00A7&SUBSYS_FFFFFFFF&REV_1001\5&3568b81e&0&0001)
An audio stream is currently in use.
Expected results:
As no audio is playing from the site the system should enter sleep normally from the idle timer.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Win32' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•2 years ago
|
||
Pinging :handyman for initial investigation, since it's a Windows audio issue.
Comment 3•2 years ago
|
||
I don't know how they are getting around reporting as playing sound but I believe the request for the audio device is coming from here
Comment 4•2 years ago
|
||
The component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit BugBot documentation.
Updated•2 years ago
|
If it helps, here is another website that causes similar issues:
https://www.classicalwcrb.org/, click the play button at the top. Then pause the audio. "powercfg /requests" shows a persistent "An audio stream is currently in use." even though no music is playing.
From what I can tell this website does not intend to use any tricks -- this is a website for a radio station intended to play audio.
I can create a separate ticket if necessary. (I was about to do that until I found this ticket)
| Assignee | ||
Comment 6•2 years ago
|
||
MOZ_LOG=WebAudioAPI:4 shows Web Audio API usage on Aliexpress that looks pointless, unless used for fingerprinting purposes.
0.000000: frequency for 1 SetValue value=440 time=0.000000 constant=0
0.000000: detune for 1 SetValue value=0 time=0.000000 constant=0
0.000000: gain for 3 SetValue value=1 time=0.000000 constant=0
0.000000: OscillatorNode 1 Connect() to AnalyserNode 2
0.000000: gain for 3 SetValue value=0 time=0.000000 constant=0
0.000000: AnalyserNode 2 Connect() to ScriptProcessorNode 4
0.000000: ScriptProcessorNode 4 Connect() to GainNode 3
0.000000: GainNode 3 Connect() to AudioDestinationNode 0
0.000000: frequency for 6 SetValue value=440 time=0.000000 constant=0
0.000000: detune for 6 SetValue value=0 time=0.000000 constant=0
0.000000: gain for 8 SetValue value=1 time=0.000000 constant=0
0.000000: gain for 8 SetValue value=0 time=0.000000 constant=0
0.000000: OscillatorNode 6 Connect() to AnalyserNode 7
0.000000: AnalyserNode 7 Connect() to ScriptProcessorNode 9
0.000000: ScriptProcessorNode 9 Connect() to GainNode 8
0.000000: GainNode 8 Connect() to AudioDestinationNode 5
0.080000: AnalyserNode 2 Disconnect()
0.080000: ScriptProcessorNode 4 Disconnect()
0.080000: GainNode 3 Disconnect()
0.098667: AnalyserNode 7 Disconnect()
0.098667: ScriptProcessorNode 9 Disconnect()
0.098667: GainNode 8 Disconnect()
Chrome shows the similar audio device usage indefinitely (but I'm not able to check powercfg on this system).
Aliexpress could stop the audio device usage on both sites with AudioContext.suspend().
| Assignee | ||
Comment 7•2 years ago
|
||
https://www.classicalwcrb.org/ could also resolve with AudioContext.suspend().
API usage is more conventional:
0.000000: gain for 1 SetValue value=1 time=0.000000 constant=0
0.000000: gain for 1 SetValueAtTime value=1 time=0.000000 constant=0
0.000000: GainNode 1 Connect() to AudioDestinationNode 0
0.000000: gain for 3 SetValue value=1 time=0.000000 constant=0
0.000000: gain for 3 SetValueAtTime value=1 time=0.000000 constant=0
0.000000: GainNode 3 Connect() to AudioDestinationNode 2
0.000000: detune for 4 SetValue value=0 time=0.000000 constant=0
0.000000: playbackRate for 4 SetValue value=1 time=0.000000 constant=0
0.000000: AudioBufferSourceNode 4 Connect() to AudioDestinationNode 2
0.000000: AudioBufferSourceNode 4 Start(0.000000, 0, 2.22507e-308)
0.024000: AudioBufferSourceNode 4 Disconnect()
In Chrome the audio device usage stops after several seconds.
I don't know exactly what makes Chrome behave differently from on aliexpress.
| Assignee | ||
Comment 8•2 years ago
•
|
||
Bug 1771179 intends to release the audio device in both cases. I'll leave this open for now, until we know exactly what will be done for bug 1771179.
| Assignee | ||
Comment 9•7 months ago
|
||
https://share.firefox.dev/3UY4F7F captures the first click on aliexpress.com at about 3.5s and a "Minimize memory usage" in about:memory at about 6s, with additional logging for bug 1987066.
Searching for WebAudio in the marker table for the aliexpress.com main thread shows that the site creates a few AudioNodes and then disconnects() some of them, as in comment 6.
The ScriptProcessorNode is destroyed on GC/CC.
OscillatorNode 1 remains running connected to an AnalyzerNode 2.
stop() has not been called on OscillatorNode 1.
The output of AnalyzerNode 2 has been disconnected.
ProcessBlock() continues to be called on OscillatorNode 1 and AnalyzerNode 2 even though their output is not consumed, because their output might be connected in the future.
If no JS references remain, then we know that their output will not be connected in the future.
The proposal in bug 1771179 comment 0 would still leave these nodes consuming CPU even when the cubeb stream is paused.
Bug 897796 discussed general solutions to garbage collect such nodes.
Perhaps a simpler solution is possible for this site, given no audio processing cycles are involved.
Description
•