Bug 216745 - [GTK][WPE] WKTR has lost access to Pulseaudio
Summary: [GTK][WPE] WKTR has lost access to Pulseaudio
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-20 10:10 PDT by Philippe Normand
Modified: 2020-09-21 12:27 PDT (History)
7 users (show)

See Also:


Attachments
crash log (119.44 KB, text/plain)
2020-09-20 10:10 PDT, Philippe Normand
no flags Details
Patch (2.69 KB, patch)
2020-09-20 10:15 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Normand 2020-09-20 10:10:23 PDT
I was trying to debug #216716 so I locally un-flagged it and ran it in loop, after noticing a consistent crash after 24 or 25 successful iterations, I dug in another debug black hole...

The crash happens when I run:
run-webkit-tests --gtk --exit-after-n-failures=1 --iterations=200 --no-retry-failures --no-show-results fast/mediastream/mediastreamtrack-video-clone.html

24th or 25th iteration will crash. Then check the crash log attached to this bug, snippet:

STDERR: shm_open() failed: No such file or directory
STDERR: shm_open() failed: No such file or directory
STDERR: shm_open() failed: No such file or directory
STDERR: shm_open() failed: No such file or directory
STDERR: shm_open() failed: No such file or directory
STDERR: shm_open() failed: No such file or directory
STDERR: shm_open() failed: No such file or directory
STDERR: shm_open() failed: No such file or directory
STDERR: shm_open() failed: Too many open files
STDERR: The per-process limit on the number of open file descriptors has been reached.
STDERR: ERROR: cannot create wakeup pipe
STDERR: The per-process limit on the number of open file descriptors has been reached.
STDERR: ERROR: cannot create wakeup pipe
STDERR: shm_open() failed: Too many open files
STDERR: The per-process limit on the number of open file descriptors has been reached.
STDERR: ERROR: cannot create wakeup pipe
STDERR: shm_open() failed: Too many open files
STDERR: The per-process limit on the number of open file descriptors has been reached.
STDERR: ERROR: cannot create wakeup pipe
STDERR: 
STDERR: (WebKitWebProcess:133): GStreamer-CRITICAL **: 10:00:18.403: gst_poll_write_control: assertion 'set != NULL' failed

Strangely, this doesn't happen when I downgrade PulseAudio from v13 to v12.2 in the SDK, so there might be a regression in their SHM support, I haven't found it yet though...

Anyway.

env GST_DEBUG="pulse:6" run-webkit-tests --gtk --no-retry-failures --no-show-results fast/mediastream/mediastreamtrack-video-clone.html
less -R WebKitBuild/GTK/Release/layout-test-results/fast/mediastream/mediastreamtrack-video-clone-stderr.txt
...
0:00:00.682512514   133       0x61be10 LOG                    pulse pulsesink.c:549:gst_pulseringbuffer_open_device:<autoaudiosink1-actual-sink-pulse> connect to server (NULL)
0:00:00.682548463   133       0x61be10 LOG                    pulse pulsesink.c:426:gst_pulsering_context_state_cb: got new context state 1
0:00:00.682607837   133       0x61be10 LOG                    pulse pulsesink.c:572:gst_pulseringbuffer_open_device:<autoaudiosink1-actual-sink-pulse> context state is now 1
0:00:00.682612609   133       0x61be10 LOG                    pulse pulsesink.c:581:gst_pulseringbuffer_open_device:<autoaudiosink1-actual-sink-pulse> waiting..
0:00:00.683023557   133       0xd20330 LOG                    pulse pulsesink.c:426:gst_pulsering_context_state_cb: got new context state 2
0:00:00.684308385   133       0xd20330 LOG                    pulse pulsesink.c:426:gst_pulsering_context_state_cb: got new context state 3
shm_open() failed: No such file or directory
0:00:00.684485267   133       0xd20330 LOG                    pulse pulsesink.c:426:gst_pulsering_context_state_cb: got new context state 5
0:00:00.684495839   133       0xd20330 LOG                    pulse pulsesink.c:432:gst_pulsering_context_state_cb: signaling
0:00:00.684541232   133       0x61be10 LOG                    pulse pulsesink.c:572:gst_pulseringbuffer_open_device:<autoaudiosink1-actual-sink-pulse> context state is now 5
0:00:00.684552988   133       0x61be10 WARN                   pulse pulsesink.c:614:gst_pulseringbuffer_open_device:<autoaudiosink1-actual-sink-pulse> error: Failed to connect: Protocol error

So this fails, but `webkit-flatpak -c gst-launch-1.0 audiotestsrc num-buffers=1 ! queue ! pulsesink` works fine. After comparing strace logs between WKTR and this gst-launch line, in the latter case, enable-shm=no appears in the pulseaudio config file (in the strace log):

openat(AT_FDCWD, "/run/user/1000/pulse/config", O_RDONLY|O_CLOEXEC) = 8
...
fstat(8, {st_mode=S_IFREG|0600, st_size=14, ...}) = 0
read(8, "enable-shm=no\n", 4096)        = 14
read(8, "", 4096)                       = 0

but not in WKTR's. So this lead me in flatpak-run.c which sets 2 PULSEAUDIO env vars in the sandbox:

flatpak_bwrap_set_env (bwrap, "PULSE_SERVER", pulse_server, TRUE);
flatpak_bwrap_set_env (bwrap, "PULSE_CLIENTCONFIG", config_path, TRUE);

And of course our GTK and WPE test drivers don't set these vars...
Comment 1 Philippe Normand 2020-09-20 10:10:53 PDT
Created attachment 409235 [details]
crash log
Comment 2 Philippe Normand 2020-09-20 10:15:47 PDT
Created attachment 409236 [details]
Patch
Comment 4 EWS 2020-09-21 12:00:51 PDT
Committed r267351: <https://trac.webkit.org/changeset/267351>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 409236 [details].
Comment 5 Radar WebKit Bug Importer 2020-09-21 12:27:26 PDT
<rdar://problem/69319866>