Audio randomly stops working because of low nfile limit of 1024

Audio randomly stops working when playing videos in Firefox and Brave. KDE’s volume control applet still lists several Firefox windows (applications playing audio) even though most of them have already been closed in the meantime.

This is really just a symptom of a core issue, it has nothing to do with Firefox. Brave would experience the same issue and at some point, even VLC failed (and probably other programs, in the background).

A look in the system log revealed this:
pipewire-pulse[2597]: pw.mem: …: Failed to create memfd: Too many open files

In other words: It seems like Fedora’s default limits are too for pulseaudio to work reliably.

$ cat /proc/$(pidof /usr/bin/pipewire-pulse)/limits

Max open files 1024

Where is the setting to fix this limit?

This does not seem to do it:

# /etc/systemd/system.conf.d/limits.conf
DefaultLimitNOFILE=102400:524288

# /etc/security/limits.d/limits.conf
*	soft	nofile	4194304
*	hard	nofile	4194304

I have found nothing for “ulimit” in the Fedora documentation.

Found it. You need to change the third config file:

# /etc/systemd/user.conf
...
DefaultLimitNOFILE=32767

Now, the new limit is applied:

$ cat /proc/$(pidof /usr/bin/pipewire-pulse)/limits

Max open files 32767