Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Spotify opens too many connections to PulseAudio (Linux)

Solved!

Spotify opens too many connections to PulseAudio (Linux)

After some time Spotify for Linux starts to use too many connections to PulseAudio. This makes it impossible to use any sound on the computer.

 

This shows an output after one day of usage:

http://pastebin.com/E5AVQd62

 

Spotify version 1.0.36.120.g536a862f, Copyright (c) 2016, Spotify Ltd

OS: Debian 8.5 (Jessie)

 

Reply

Accepted Solutions
Marked as solution

Relatively new to Linux and thought it was a problem with the OS until I saw this. Looks like it's just Spotify's ignorance.

View solution in original post

28 Replies

Have never seen before. Will investigate. What is the output of:

 

 

cat /etc/lsb-release
uname -a
dpkg -l libasound2 pulseaudio pulseaudio-utils | grep ^ii

 

Also, how many spotify processes do you see when you have this problem? Maybe spotify is restarting and doesn't close itself properly.

 

ps fx | grep spotify

shows 4 processes for me, which is normal when one instance is running.

 

$ ps fx | grep spotify
 4419 pts/4    Sl+    0:01      |   \_ /usr/share/spotify/spotify
 4424 pts/4    S+     0:00      |       \_ /usr/share/spotify/spotify --type=zygote...
 4454 pts/4    Sl+    0:03      |       |   \_ /usr/share/spotify/spotify --type=renderer...
 4438 pts/4    Sl+    0:00      |       \_ /usr/share/spotify/spotify --type=gpu-process...

Output from "ps fx | grep spotify"

 

 

5239 ? Sl 13:42 \_ /usr/share/spotify/spotify
5242 ? S 0:00 \_ /usr/share/spotify/spotify --type=zygote --no-sandbox --lang=en-US --log-file=/usr/share/spotify/debug.log --log-severity=disable --product-version=Spotify/1.0.36.120
5279 ? Sl 4:30 | \_ /usr/share/spotify/spotify --type=renderer --disable-pinch --no-sandbox --primordial-pipe-token=6D4D7B021A2C597A9FA60D6813C8DC86 --lang=en-US --lang=en-US --log-file=/usr/share/spotify/debug.log --log-severity=disable --product-version=Spotify/1.0.36.120 --disable-extensions --disable-spell-checking --num-raster-threads=4 --content-image-texture-target=3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553 --video-image-texture-target=3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553,3553 --disable-accelerated-video-decode --mojo-channel-token=CAC62E68AE5F5EEEF9123566B0004592 --mojo-application-channel-token=1E958C4010444E267A02F755347A2583 --channel=5239.1.1094438878 --v8-natives-passed-by-fd --v8-snapshot-passed-by-fd
5256 ? Sl 2:12 \_ /usr/share/spotify/spotify --type=gpu-process --channel=5239.0.1846326019 --mojo-application-channel-token=91A22B22A13A7F6BE73DB761DC39017C --no-sandbox --window-depth=24 --x11-visual-id=33 --lang=en-US --log-file=/usr/share/spotify/debug.log --log-severity=disable --product-version=Spotify/1.0.36.120 --supports-dual-gpus=false --gpu-driver-bug-workarounds=4,28,34,37,55,71,74 --gpu-vendor-id=0x10de --gpu-device-id=0x1401 --gpu-driver-vendor=NVIDIA --gpu-driver-version=361.45.11 --gpu-driver-date --gpu-secondary-vendor-ids=0x8086 --gpu-secondary-device-ids=0x0412 --lang=en-US --log-file=/usr/share/spotify/debug.log --log-severity=disable --product-version=Spotify/1.0.36.120 --v8-natives-passed-by-fd --v8-snapshot-passed-by-fd
23014 pts/1 S+ 0:00 | \_ grep spotify

 

 

( Debian does not have /etc/usb-release )

 

spacebug@blackbox:~$ lsb_release -da
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.5 (jessie)
Release: 8.5
Codename: jessie
spacebug@blackbox:~$ uname -a
Linux blackbox 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux
spacebug@blackbox:~$ dpkg -l libasound2 pulseaudio pulseaudio-utils | grep ^ii
ii libasound2:amd64 1.0.28-1 amd64 shared library for ALSA applications
ii pulseaudio 5.0-13 amd64 PulseAudio sound server
ii pulseaudio-utils 5.0-13 amd64 Command line tools for the PulseAudio sound server
spacebug@blackbox:~$

A more detaled output from "pacmd list-clients"

 

http://pastebin.com/W4FD8kNw

 

Seems like all connections comes from Spotify process number 5239 (in the previous output from my "ps fx")

 

It seems to happen more when I use Spotify on my android phone during the day. Also, everytime I have used my Spotify on my phone and then come home to my desktop client, the sound on the desktop client is muted (volume slide down to zero).


@spacebug wrote:
It seems to happen more when I use Spotify on my android phone during the day. Also, everytime I have used my Spotify on my phone and then come home to my desktop client, the sound on the desktop client is muted (volume slide down to zero).

Sounds even weirder, but I guess this could be relevant, since clients logged in to the same account try to keep in sync, so that you can quickly continue in one when you leave another. I am still very unsure how it could affect audio (when nothing is played on the other client), but I will make some tests. Please keep me posted, whenever you find more things like this.

I have found it! When I _close_ the Spotify app on my android phone (bring up all applications and swipe to the side to close it), the desktop client uses one more slot on pulse audio.

I just managed to reproduce this. I have to start playing a track on my android phone and skip to the next before I close the app. If I close it directly or only play one track it does not use one more connection on the linux client.

 

Ah. Yeah sounds about right.

Any updates on this? It's still happening for me on Ubuntu MATE 20.04

 

I do switch between Android and the desktop client a few times a day. 

 

Spotify version is 1.1.10.546.ge08ef575

gdi2k@Ryzen1700:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04 LTS
Release:	20.04
Codename:	focal


gdi2k@Ryzen1700:~$ pacmd list-clients | grep Spotify | nl
     1			application.name = "Spotify"
     2			application.name = "Spotify"
     3			application.name = "Spotify"
     4			application.name = "Spotify"
     5			application.name = "Spotify"
     6			application.name = "Spotify"
     7			application.name = "Spotify"
     8			application.name = "Spotify"
     9			application.name = "Spotify"
    10			application.name = "Spotify"
    11			application.name = "Spotify"
    12			application.name = "Spotify"
    13			application.name = "Spotify"
    14			application.name = "Spotify"
    15			application.name = "Spotify"
    16			application.name = "Spotify"
    17			application.name = "Spotify"
    18			application.name = "Spotify"
    19			application.name = "Spotify"
    20			application.name = "Spotify"
    21			application.name = "Spotify"
    22			application.name = "Spotify"
    23			application.name = "Spotify"
    24			application.name = "Spotify"
    25			application.name = "Spotify"
    26			application.name = "Spotify"
    27			application.name = "Spotify"
    28			application.name = "Spotify"
    29			application.name = "Spotify"
    30			application.name = "Spotify"
gdi2k@Ryzen1700:~$ ps fx | grep spotify
 269774 pts/2    S+     0:00  |       |   \_ grep --color=auto spotify
  26271 ?        Sl    21:08  \_ /usr/share/spotify/spotify
  26279 ?        S      0:00  |   \_ /usr/share/spotify/spotify --type=zygote --no-sandbox --log-file=/usr/share/spotify/debug.log --log-severity=disable --product-version=Spotify/1.1.10.546 --lang=en-US
  26312 ?        Sl    34:24  |   |   \_ /usr/share/spotify/spotify --type=renderer --no-sandbox --log-file=/usr/share/spotify/debug.log --field-trial-handle=9707481214449053510,15862504478447034379,131072 --disable-features=ExtendedMouseButtons,NetworkService --lang=en-US --log-file=/usr/share/spotify/debug.log --log-severity=disable --product-version=Spotify/1.1.10.546 --disable-spell-checking --num-raster-threads=4 --enable-main-frame-before-activation --service-request-channel-token=11308299691101008145 --renderer-client-id=3 --shared-files=v8_context_snapshot_data:100,v8_natives_data:101
  26292 ?        Sl    12:09  |   \_ /usr/share/spotify/spotify --type=gpu-process --field-trial-handle=9707481214449053510,15862504478447034379,131072 --disable-features=ExtendedMouseButtons,NetworkService --no-sandbox --log-file=/usr/share/spotify/debug.log --log-severity=disable --product-version=Spotify/1.1.10.546 --lang=en-US --gpu-preferences=KAAAAAAAAAAgAAAgAQAAAAAAAAAAAGAAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAA --log-file=/usr/share/spotify/debug.log --service-request-channel-token=9405468996116445578

 

As a workaround, I use this simple script whenever I have multiple instances of spotify pulseaudio clients.

 

https://gist.github.com/fatihkaan22/0cad6b53647c5d887c67b22c260568cb

 

#! /bin/bash

spotifyInstances=()

while read LINE1; read LINE2; do
	IFS=':-='

	read -ra L1 <<< $LINE1
	read -ra L2 <<< $LINE2

	# trim leading/trailing spaces for error checking
	INDEX_STR=$(echo "${L1[0]}" | xargs)
	NAME_STR=$(echo "${L2[0]}" | xargs)

	if [[ $INDEX_STR != 'index' || $NAME_STR != 'application.name' ]]; then
		echo 'ERROR'
		exit
	fi

	INDEX=${L1[1]}
	NAME=${L2[1]}

	if [[ $NAME == ' "Spotify"' ]]; then
		spotifyInstances+=( $INDEX )
	fi

done < <(pacmd list-clients | grep -e 'index:' -e 'application.name')

# remove last element (active client)
unset 'spotifyInstances[${#arr[@]}-1]'

for s in ${spotifyInstances[@]}; do
	echo "pacmd kill-client $s"
	pacmd kill-client $s
done

thank you for this script, I'm having the same problem while playing local files and this solved it!

Seems like 6 years later this is still an issue 🙂
Marked as solution

Relatively new to Linux and thought it was a problem with the OS until I saw this. Looks like it's just Spotify's ignorance.

DUDE

Thanks for the script, that worked for me too!

Starting spotify with the option --no-zygote fixes the issue for me.

(It's an option for chromium that disables forking.)

still happening on version 1:1.1.84.716.gc5f8b819-2 (running on Xubuntu 22.10).

Suggested posts