pulseaudio 8.0 drops connections after playing audio in a firejail

Bug #1572493 reported by Ivan Kozik
56
This bug affects 12 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Confirmed
High
Unassigned

Bug Description

After upgrading from Ubuntu 15.10 to 16.04 (pulseaudio 6 -> 8), I notice that my audio output stops working every few hours. When this happens, if I run pavucontrol, it seems to wait forever trying to connect to pulseaudio. Killing pulseaudio and starting it again fixes the problem for a little while.

I don't think anything fancy is needed to cause a hang; usually, I'm just using Chrome.

This never happened with pulseaudio 6 over hundreds of hours of use.

I am using the default pulseaudio config files on an HP EliteBook 8460p, which has this audio sink:

1 sink(s) available.
  * index: 0
 name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
 driver: <module-alsa-card.c>
 flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
 state: IDLE
 suspend cause:
 priority: 9959
 volume: front-left: 61870 / 94% / -1.50 dB, front-right: 61870 / 94% / -1.50 dB
         balance 0.00
 base volume: 65536 / 100% / 0.00 dB
 volume steps: 65537
 muted: no
 current latency: 38.86 ms
 max request: 6 KiB
 max rewind: 64 KiB
 monitor source: 0
 sample spec: s16le 2ch 44100Hz
 channel map: front-left,front-right
              Stereo
 used by: 0
 linked by: 1
 configured latency: 40.00 ms; range is 0.50 .. 371.52 ms
 card: 1 <alsa_card.pci-0000_00_1b.0>
 module: 7
 properties:
  alsa.resolution_bits = "16"
  device.api = "alsa"
  device.class = "sound"
  alsa.class = "generic"
  alsa.subclass = "generic-mix"
  alsa.name = "92HD81B1X5 Analog"
  alsa.id = "92HD81B1X5 Analog"
  alsa.subdevice = "0"
  alsa.subdevice_name = "subdevice #0"
  alsa.device = "0"
  alsa.card = "0"
  alsa.card_name = "HDA Intel PCH"
  alsa.long_card_name = "HDA Intel PCH at 0xd4520000 irq 40"
  alsa.driver_name = "snd_hda_intel"
  device.bus_path = "pci-0000:00:1b.0"
  sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
  device.bus = "pci"
  device.vendor.id = "8086"
  device.vendor.name = "Intel Corporation"
  device.product.id = "1c20"
  device.product.name = "6 Series/C200 Series Chipset Family High Definition Audio Controller"
  device.form_factor = "internal"
  device.string = "front:0"
  device.buffering.buffer_size = "65536"
  device.buffering.fragment_size = "32768"
  device.access_mode = "mmap+timer"
  device.profile.name = "analog-stereo"
  device.profile.description = "Analog Stereo"
  device.description = "Built-in Audio Analog Stereo"
  alsa.mixer_name = "IDT 92HD81B1X5"
  alsa.components = "HDA:111d7605,103c3588,00100105 HDA:11c11040,103c3066,00100200"
  module-udev-detect.discovered = "1"
  device.icon_name = "audio-card-pci"
 ports:
  analog-output-lineout: Line Out (priority 9900, latency offset 0 usec, available: no)
   properties:

  analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
   properties:
    device.icon_name = "audio-speakers"
  analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: no)
   properties:
    device.icon_name = "audio-headphones"
 active port: <analog-output-speaker>

# dpkg -l | grep pulse
ii libpulse-mainloop-glib0:amd64 1:8.0-0ubuntu3 amd64 PulseAudio client libraries (glib support)
ii libpulse0:amd64 1:8.0-0ubuntu3 amd64 PulseAudio client libraries
ii libpulse0:i386 1:8.0-0ubuntu3 i386 PulseAudio client libraries
ii libpulsedsp:amd64 1:8.0-0ubuntu3 amd64 PulseAudio OSS pre-load library
ii pulseaudio 1:8.0-0ubuntu3 amd64 PulseAudio sound server
ii pulseaudio-utils 1:8.0-0ubuntu3 amd64 Command line tools for the PulseAudio sound server

# uname -a
Linux laptop 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

# lsb_release -rd
Description: Ubuntu 16.04 LTS
Release: 16.04

Tags: xenial
Revision history for this message
Luke Yelavich (themuso) wrote : Re: [Bug 1572493] [NEW] pulseaudio 8.0 server frequently hangs

Do you think you could possibly get a log from PulseAudio for this issue? https://wiki.ubuntu.com/PulseAudio/Log

Revision history for this message
Ivan Kozik (ludios) wrote : Re: pulseaudio 8.0 server frequently hangs

Thanks, I am now logging and will hopefully see a hang.

Revision history for this message
Ivan Kozik (ludios) wrote :
Download full text (9.7 KiB)

I have no idea what's going on now: pulseaudio doesn't actually hang and keeps playing audio, but pavucontrol fails to connect.

# pavucontrol
shm_open() failed: No such file or directory
shm_open() failed: No such file or directory
shm_open() failed: No such file or directory
shm_open() failed: No such file or directory
shm_open() failed: No such file or directory
shm_open() failed: No such file or directory
shm_open() failed: No such file or directory

strace shows:

readlink("/proc/self/exe", "/usr/bin/pavucontrol", 99) = 20
open("/etc/machine-id", O_RDONLY|O_CLOEXEC) = 19
fcntl(19, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fstat(19, {st_mode=S_IFREG|0444, st_size=33, ...}) = 0
read(19, "ca5fda75d3e5458682e02384d9bb0707"..., 4096) = 33
close(19) = 0
sendto(10, "\0\0\0027\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0", 20, MSG_NOSIGNAL, NULL, 0) = 20
sendto(10, "L\0\0\0\tL\0\0\0\1Ptapplication.name\0L\0\0"..., 567, MSG_NOSIGNAL, NULL, 0) = 567
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
recvmsg(3, 0x7ffe2e836ec0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=10, events=POLLIN}], 4, 0) = 2 ([{fd=4, revents=POLLIN}, {fd=10, revents=POLLIN}])
read(4, "\2\0\0\0\0\0\0\0", 16) = 8
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
recvmsg(3, 0x7ffe2e836ec0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=10, events=POLLIN}], 4, 0) = 2 ([{fd=4, revents=POLLIN}, {fd=10, revents=POLLIN}])
read(4, "\2\0\0\0\0\0\0\0", 16) = 8
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
recvmsg(10, {msg_name(0)=NULL, msg_iov(1)=[{"\0\0\0\n\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0", 20}], msg_controllen=56, [{cmsg_len=28, cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS, {pid=13230, uid=1000, gid=1000}}, {cmsg_len=24, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, [19, 20]}], msg_flags=0}, 0) = 20
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
recvmsg(3, 0x7ffe2e836ec0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=10, events=POLLIN}], 4, 0) = 2 ([{fd=4, revents=POLLIN}, {fd=10, revents=POLLIN}])
read(4, "\2\0\0\0\0\0\0\0", 16) = 8
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
recvmsg(10, {msg_name(0)=NULL, msg_iov(1)=[{"L\0\0\0eL\0\237;p", 10}], msg_controllen=32, [{cmsg_len=28, cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS, {pid=13230, uid=1000, gid=1000}}], msg_flags=0}, 0) = 10
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
recvmsg(3, 0x7ffe2e836ec0, 0) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=10, events=POLLIN}], 4, 0) = 2 ([{fd=4, revents=POLLIN}, {fd=10, revents=POLLIN}])
read(4, "\2\0\0\0\0\0\0\0", 16) = 8
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
recvmsg(10, {msg_name(0)=NULL, msg_iov(1)=[{"\0\0\0\20\0\0\0\0\0\0\0\0\0\0\0\0\200\200\0\0", 20}], msg_controllen=32, [{cmsg_len=28, cmsg_level=SO...

Read more...

Revision history for this message
Luke Yelavich (themuso) wrote : Re: [Bug 1572493] Re: pulseaudio 8.0 server frequently hangs

Well it may be something local to your system. I just installed and ran pavucontrol with no such errors, although my install is a fresh 16.04 install from back in December.

Are there any files in /dev/shm related to pulseaudio and your user? They should be owned by your user, even though your user ID or name is not in the file names.

Revision history for this message
Luke Yelavich (themuso) wrote :

Forgot to add that you could try cleaning out your pulseaudio configuration in ~/.config/pulse. You could also check your syslog or other logs to see if there is any problem with the kernel or systemd setting up the /dev/shm mount point.

Revision history for this message
Ivan Kozik (ludios) wrote :

After it goes into a bad state, connections from Chrome also die immediately:

(2264.888| 0.801) I: [pulseaudio] client.c: Created 208 "Native client (UNIX socket client)"
(2264.888| 0.000) I: [pulseaudio] client.c: Freed 208 "Native client (UNIX socket client)"
(2264.888| 0.000) I: [pulseaudio] protocol-native.c: Connection died.
(2264.889| 0.001) I: [pulseaudio] client.c: Created 209 "Native client (UNIX socket client)"
(2264.890| 0.000) D: [pulseaudio] protocol-native.c: Protocol version: remote 30, local 30
(2264.890| 0.000) I: [pulseaudio] protocol-native.c: Got credentials: uid=1000 gid=1000 success=1
(2264.890| 0.000) D: [pulseaudio] protocol-native.c: SHM possible: yes
(2264.890| 0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: yes
(2264.890| 0.000) D: [pulseaudio] srbchannel.c: SHM block is 65472 bytes, ringbuffer capacity is 2 * 32712 bytes
(2264.890| 0.000) D: [pulseaudio] protocol-native.c: Enabling srbchannel...
(2264.890| 0.000) D: [pulseaudio] module-augment-properties.c: Looking for .desktop file for chrome
(2264.890| 0.000) I: [pulseaudio] client.c: Freed 209 "ALSA plug-in [chrome]"
(2264.890| 0.000) I: [pulseaudio] protocol-native.c: Connection died.
(2264.891| 0.001) I: [pulseaudio] client.c: Created 210 "Native client (UNIX socket client)"
(2264.907| 0.015) D: [pulseaudio] protocol-native.c: Protocol version: remote 30, local 30
(2264.907| 0.000) I: [pulseaudio] protocol-native.c: Got credentials: uid=1000 gid=1000 success=1
(2264.907| 0.000) D: [pulseaudio] protocol-native.c: SHM possible: yes
(2264.907| 0.000) D: [pulseaudio] protocol-native.c: Negotiated SHM: yes
(2264.907| 0.000) D: [pulseaudio] srbchannel.c: SHM block is 65472 bytes, ringbuffer capacity is 2 * 32712 bytes
(2264.907| 0.000) D: [pulseaudio] protocol-native.c: Enabling srbchannel...
(2264.911| 0.004) D: [pulseaudio] module-augment-properties.c: Looking for .desktop file for chrome
(2264.927| 0.015) I: [pulseaudio] client.c: Freed 210 "ALSA plug-in [chrome]"
(2264.927| 0.000) I: [pulseaudio] protocol-native.c: Connection died.

but somehow connections from foobar2000 in wine-staging work just fine.

Revision history for this message
Ivan Kozik (ludios) wrote : Re: pulseaudio 8.0 server frequently hangs

I think I have narrowed this down: pulseaudio 8 goes into its degraded connection-dropping state after playing some audio in foobar2000 in wine-staging 1.9.8. I will try to make this fully reproducible.

Revision history for this message
Ivan Kozik (ludios) wrote :

Attaching a pulseaudio log wherein foobar2000 1.3.9/wine-staging somehow breaks pulseaudio 8, even though foobar2000 never has problems playing through it, even after restarting foobar2000.

summary: - pulseaudio 8.0 server frequently hangs
+ pulseaudio 8.0 drops connections after using foobar2000
Revision history for this message
Ivan Kozik (ludios) wrote : Re: pulseaudio 8.0 drops connections after using foobar2000

> Are there any files in /dev/shm related to pulseaudio and your user? They should be owned by your user, even though your user ID or name is not in the file names.

The /dev/shm/pulse-shm-* files seem to be removed immediately after foobar2000 starts playing music. (Not when wine-staging is started or when foobar2000 is busy loading.)

Revision history for this message
Ivan Kozik (ludios) wrote :

Oh, duh, this happens only because I have wine running in firejail. Not sure why pulseaudio 8 decides to break so spectacularly in this scenario, though.

I think this can be closed. I'll file a better bug upstream if this warrants a bug.

Revision history for this message
Ivan Kozik (ludios) wrote :
summary: - pulseaudio 8.0 drops connections after using foobar2000
+ pulseaudio 8.0 drops connections after playing audio in a firejail
Changed in pulseaudio (Ubuntu):
status: New → Invalid
Revision history for this message
Alberto Salvia Novella (es20490446e) wrote :

@ Michael Hudson-Doyle

If you are about to invalidate this report, please provide a reason for doing so.

tags: added: xenail
tags: added: xenial
removed: xenail
Changed in pulseaudio (Ubuntu):
status: Invalid → Confirmed
importance: Undecided → High
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Ah sorry, I invalidated it because the original reporter asked me to.

Revision history for this message
rewind (ttanev) wrote :

Confirming that I experience the same issue with multiple firejail-ed applications using pulseaudio. Attaching a snippet from `pulseaudio -vvv` output after the issue was reproduced (only a snippet, because it was in what seems to be an infinite loop).

Revision history for this message
Steve Dodd (anarchetic) wrote :

I'm seeing this in a slightly different situation .. I'm running an xpra server which starts its own pulseaudio server; something to do with running Chrome and attempting to play video randomly results in everything in /dev/shm getting deleted, which leads the shm errors reported above.

I made sure to set RemoveIPC=no in /etc/systemd/logind.conf, but systemd does not seem to be the culprit. I've tried using auditd to see what is wiping the files, but nothing is showing.

Did anyone ever make any headway with this?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.