RESOLVED FIXED 275165
REGRESSION(278498@main) [Skia] getUserMedia(deviceID) frequently freezing in media stream tests under debug
https://bugs.webkit.org/show_bug.cgi?id=275165
Summary REGRESSION(278498@main) [Skia] getUserMedia(deviceID) frequently freezing in ...
Lauro Moura
Reported 2024-06-05 09:01:31 PDT
Created attachment 471594 [details] GST_DEBUG=2 output of running the test Affects multiple MediaStream-related tests, leading to early exits on both GTK and WPE debug bots since early May 2024. Bisecting with fast/mediastream/get-user-media-device-id.html led to 278498@main, the commit enabling Skia by default in place of Cairo. And indeed building WebKit with `--cmakeargs=-DUSE_SKIA=0` makes the test pass even in that commit. Further investigation of the test shows it's getting stuck in the last test case of this file, "Ideal deviceId constraints": ``` await navigator.mediaDevices.getUserMedia({video: true}); const devices = await navigator.mediaDevices.enumerateDevices(); for (let device of devices) { if (device.kind === "audioinput") { const stream = await navigator.mediaDevices.getUserMedia({audio: {deviceId: device.deviceId}}); assert_equals(stream.getAudioTracks()[0].getSettings().deviceId, device.deviceId, "Matching audio device id"); } else if (device.kind === "videoinput") { const stream = await navigator.mediaDevices.getUserMedia({video: {deviceId: device.deviceId}}); assert_equals(stream.getVideoTracks()[0].getSettings().deviceId, device.deviceId, "Matching video device id"); } } ``` The test is getting stuck in one of the `await navigator.mediaDevices.getUserMedia(...)` inside the loop, trying to access a specific deviceID, sometimes a video device, sometimes an audio device. Running with `GST_DEBUG=2` showed these lines among others, not sure if related (full log attached) ``` 0:00:01.009301531 47 0x588f78236650 ERROR pulse pulsedeviceprovider.c:466:gst_pulse_device_provider_probe:<pulsedeviceprovider0> Failed to connect: Invalid argument Audio capture was requested but no device was found amongst 3 devices BooleanConstraint 9, exact -1, ideal 1 MediaConstraint 10 of type 3 Audio capture was requested but no device was found amongst 3 devices BooleanConstraint 9, exact -1, ideal 1 MediaConstraint 10 of type 3 ```
Attachments
GST_DEBUG=2 output of running the test (102.84 KB, text/plain)
2024-06-05 09:01 PDT, Lauro Moura
no flags
Detailed logs for skia run (704.99 KB, text/x-log)
2024-06-06 03:15 PDT, Lauro Moura
no flags
Detailed logs for cairo run (198.30 KB, text/x-log)
2024-06-06 03:19 PDT, Lauro Moura
no flags
Lauro Moura
Comment 1 2024-06-05 09:12:12 PDT
Update: It's timing out in this test case when running after the other test cases in the same file.
Lauro Moura
Comment 2 2024-06-05 09:29:05 PDT
Looks like the issue is related to multiple calls to getUserMedia. The following test fails on the 6th or 7th iteration, before the other tests promise_test(async (test) => { for (let i = 0; i < 10; i++) { console.log(`Dummy getusermedia starting ${i}`); await navigator.mediaDevices.getUserMedia({ audio: true, video: true }); console.log(`Dummy getusermedia returning ${i}`); } }, "Repeated getusermedia calls"); This passes with a Cairo build. A similar standalone html file iterates normally with MiniBrowser in a Skia build.
Philippe Normand
Comment 3 2024-06-06 00:26:39 PDT
Is that failing on 2 bots? This looks suspicious...: Failed to create secure directory (/run/user/1000/pulse): Too many levels of symbolic links
Philippe Normand
Comment 4 2024-06-06 00:56:17 PDT
Seems odd this would be related to Skia/Cairo too :( I can't reproduce this here and can't do debug builds on this laptop.
Lauro Moura
Comment 5 2024-06-06 01:29:55 PDT
(In reply to Philippe Normand from comment #3) > Is that failing on 2 bots? Yeah: https://results.webkit.org/?suite=layout-tests&test=fast%2Fmediastream%2Fget-user-media-device-id.html > > This looks suspicious...: > > Failed to create secure directory (/run/user/1000/pulse): Too many levels of > symbolic links Oh, I think it comes from my laptop, running ubuntu 23.10. I did not see it in the bots, and it's still present if I do a cairo build, with the test not timing out.
Lauro Moura
Comment 6 2024-06-06 02:28:50 PDT
(In reply to Philippe Normand from comment #4) > Seems odd this would be related to Skia/Cairo too :( > I can't reproduce this here and can't do debug builds on this laptop. Is there any set of variables like GST_DEBUG that I could run to help debugging it?
Philippe Normand
Comment 7 2024-06-06 02:30:38 PDT
GST_DEBUG="3,webkit*:9" GST_DEBUG_FILE=/path/to/logfile.log
Lauro Moura
Comment 8 2024-06-06 03:15:29 PDT
Created attachment 471603 [details] Detailed logs for skia run (In reply to Philippe Normand from comment #7) > GST_DEBUG="3,webkit*:9" GST_DEBUG_FILE=/path/to/logfile.log This is a log for a skia debug build using the above logging options, alongside GST_DEBUG_NO_COLOR=1 In the next comment I'll add the same for cairo.
Lauro Moura
Comment 9 2024-06-06 03:19:06 PDT
Created attachment 471604 [details] Detailed logs for cairo run Cairo version.
Lauro Moura
Comment 10 2024-06-06 03:57:39 PDT
(In reply to Lauro Moura from comment #2) > Looks like the issue is related to multiple calls to getUserMedia. The > following test fails on the 6th or 7th iteration, before the other tests > > > promise_test(async (test) => { > for (let i = 0; i < 10; i++) { > console.log(`Dummy getusermedia starting ${i}`); > await navigator.mediaDevices.getUserMedia({ audio: true, video: true > }); > console.log(`Dummy getusermedia returning ${i}`); > } > }, "Repeated getusermedia calls"); > Note: The logs were generated from this test above, with the repeated getUserMedia calls.
Philippe Normand
Comment 11 2024-06-10 04:48:04 PDT
In MockRealtimeVideoSource::generateFrameInternal() if you "return null" before creating the GraphicsContextStateSaver instance, the timeout doesn't happen. Something looks incorrect in the skia GraphicsContextSkia::save() and/or GraphicsContextSkia::restore() implementations? Maybe? I don't know about graphics, I can't go any further.
Carlos Garcia Campos
Comment 12 2024-06-11 05:30:14 PDT
So, does this only happen in debug builds? or it's just easy to reproduce? What tests should I run to try to reproduce it?
Philippe Normand
Comment 13 2024-06-11 06:39:30 PDT
I could reproduce this only in Debug builds. Add the promise_test from comment 2 to the top (before existing promise_test calls) of fast/mediastream/get-user-media-device-id.html and then the test will time out.
Carlos Garcia Campos
Comment 14 2024-06-12 02:35:13 PDT
Vitaly Dyackhov
Comment 15 2024-06-12 05:06:15 PDT
Radar WebKit Bug Importer
Comment 16 2024-06-12 09:02:14 PDT
EWS
Comment 17 2024-06-28 02:31:56 PDT
Committed 280450@main (abd2c22d3e30): <https://commits.webkit.org/280450@main> Reviewed commits have been landed. Closing PR #29739 and removing active labels.
EWS
Comment 18 2024-07-06 13:22:35 PDT
Committed 280712@main (c85534cb863a): <https://commits.webkit.org/280712@main> Reviewed commits have been landed. Closing PR #29745 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.