[Pkg-utopia-maintainers] Bug#1036912: pipewire-pulse: "address already in use" when enabling tcp server due to race condition on user switching

Micha Moskovic michamos at gmail.com
Mon May 29 11:59:34 BST 2023


Package: pipewire-pulse
Version: 0.3.65-3
Severity: normal
X-Debbugs-Cc: michamos at gmail.com

Dear Maintainer,

I want to have pipewire-pulse listen on a TCP socket in order to be able
to play music from an mpd deamon running as a different user, which is
configured to use pulseaudio output on localhost (there might be a
better way to play sound from a different user now with pipewire but
couldn't find anything conclusive online).

I enabled it by modifying the example configuration and setting the
following in /etc/pipewire/pipewire-pulse.conf:

pulse.properties = {
    # the addresses this server listens on
    server.address = [
        "unix:native"
        "tcp:127.0.0.1:4713"               # IPv4 on a single address
    ]
# [more default config]
}

The problem is that when the "pipewire-pulse" service starts as part of
the session of the interactive user, it can't bind to this port. The
following is displayed in the logs for the service:

mai 29 11:43:55 baraddur systemd[2281]: Started pipewire-pulse.service - PipeWire PulseAudio.
mai 29 11:43:55 baraddur pipewire-pulse[2320]: mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
mai 29 11:43:55 baraddur pipewire-pulse[2320]: mod.rt: found session bus but no portal
mai 29 11:43:55 baraddur pipewire-pulse[2320]: mod.protocol-pulse: server 0x5580e6aa9160: bind() failed: Adresse déjà utilisée
mai 29 11:43:55 baraddur pipewire-pulse[2320]: mod.protocol-pulse: pulse-server 0x5580e6aa8ab0: failed to start server on 'tcp:127.0.0.1:4713': Adresse déjà util>

("Adresse déjà utilisée" is French for "address already in use").

Manually restarting the service with "systemctl --user restart
pipewire-pulse.service" fixes the issue and the service starts without
any warnings or errors.

I strongly suspect that this is due to a race condition with the
pipewire-pulse server of the gdm display manager. Indeed, if right after
starting the computer computer I open a shell on a different tty instead
of my graphical GNOME session and run "lsof -n -i :4713", I see that
"pipewire-pulse" is already listening on that port for user
"Debian-gdm". Presumably, it is still running while the user service
starts, preventing it from binding to the port.

Would there be any way to fix that?

Best regards,
Micha

-- System Information:
Debian Release: 12.0
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-9-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pipewire-pulse depends on:
ii  init-system-helpers  1.65.2
ii  pipewire             0.3.65-3

Versions of packages pipewire-pulse recommends:
ii  wireplumber  0.4.13-1

Versions of packages pipewire-pulse suggests:
ii  libspa-0.2-bluetooth  0.3.65-3
ii  pulseaudio-utils      16.1+dfsg1-2+b1

-- no debconf information


More information about the Pkg-utopia-maintainers mailing list