Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

497 views
Skip to first unread message

Micha Moskovic

unread,
May 29, 2023, 7:11:57 AM5/29/23
to
Package: pipewire-pulse
Version: 0.3.65-3
Severity: normal
X-Debbugs-Cc: mich...@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

Aymeric Agon-Rambosson

unread,
Jul 1, 2023, 3:40:04 PM7/1/23
to

Package: pipewire-pulse
Version: 0.3.65-3
Followup-For: Bug #1036912

Dear Maintainer,

I can confirm this bug as well, with lightdm instead of gdm or
sddm.

"lsof -n -i :4713" produces similar output to what
Messrs. Moskovic and Chaparro report, with lightdm (or
Debian-lightdm, not sure) as user.

Restarting pipewire-pulse manually with systemctl works, but only
when done manually after login is completed.

Trying to do it automatically as part of the login process (in
.xsessionrc, for instance) does not work : lightdm probably keeps
listening long enough for it not to work.

Best,

Aymeric

-- System Information:
Debian Release: 12.0
APT prefers stable-security
APT policy: (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-9-amd64 (SMP w/16 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:
pn libspa-0.2-bluetooth <none>
0 new messages