Closed MTxx87 closed 1 year ago
Thanks for the report. We’ll try to see if we can reproduce it.
Thanks for your reply. It was quite a cumbersome process to install it (at least for me). Dependencies mismatch, missing tools, etc.
So, let me know if you need more info. Happy to provide them.
I have the same problem on raspberry pi4 too with alsa hw card, on startup new fresh install
pi@rpi-speaker1:~ $ shairport-sync
shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted
Thans @ageorgios. Can you give some more details about your system, please? Is it also the latest version of Volumio, or is it something else?
we thank you
raspberry pi3
alsa =
{
output_device = "hw:0"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
// mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@rpi-speaker1:~/libplist $ plistutil -v
plistutil 2.2.0-100-gc3af449
pi@rpi-speaker1:~ $ nqptp -V
Version: 1.1-dev-170-gc71b49a. Shared Memory Interface Version: 8.
pi@rpi-speaker1:~ $ shairport-sync -V
4.1-dev-694-g5b143d8a-AirPlay2-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc
tried master and development branch same result
@mikebrady
Just want to mention that the Volumio version I have installed is not the last one.
System Version: 2.917
.
@ageorgios, would you post the results of $ unname -a
please?
Linux rpi-speaker1 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux
Many thanks. So, this bug looks very like a memory management bug, possibly due to a leak. I have found three leaks -- two in Shairport Sync itself and one, apparently, in OpenSSL. I've fixed "the Shairport Sync leaks, and can avoid the OpenSSL leak by using libgcrypt
in that special case. I've pushed the fixes into the development
branch just now.
Oddly, none of these leaks have been causing any problems to me on Pi4 and Pi3 systems, but I noticed that my systems are all 64-bit and all your three systems seem to be 32-bit, so that might be important.
So, the next thing to try to do is get the unfixed version onto a 32-bit installation of Raspberry Pi OS and see if it crashes.
I got the same error :(
pi@rpi-speaker1:~/shairport-sync $ shairport-sync -V
4.1-dev-698-gf34ff2fd-AirPlay2-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc
pi@rpi-speaker1:~/shairport-sync $ shairport-sync
shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted
I also have a rpi3, I though all rpi3 were 64bit, but uname says armv7 so 32bit... I think raspbian stretch is 32bit
pi@rpi-speaker1:~/shairport-sync $ cat /sys/firmware/devicetree/base/model
Raspberry Pi 3 Model B Rev 1.2
I got the same error :(
pi@rpi-speaker1:~/shairport-sync $ shairport-sync -V 4.1-dev-698-gf34ff2fd-AirPlay2-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc pi@rpi-speaker1:~/shairport-sync $ shairport-sync shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. Aborted
I also have a rpi3, I though all rpi3 were 64bit, but uname says armv7 so 32bit... I think raspbian stretch is 32bit
pi@rpi-speaker1:~/shairport-sync $ cat /sys/firmware/devicetree/base/model Raspberry Pi 3 Model B Rev 1.2
Very useful, thanks!
Just looking at the version string, the version string of the development
version of Shairport Sync is now 4.1-dev-690-g4726c4d9
, so your version is a bit strange. At the risk of telling you what you already know (and apologies if so), when you are updating and switching, say, from master
to development
, you'd need to switch branches first, if appropriate:
$ git checkout development
then,
$ git pull
$ autoreconf -fi
$ ./configure (...as before)
$ make clean
$ make -j
The ./configure
step should include whatever options you wish to use, and I generally do a $ make clean
"for luck".
So, no luck with two 32-bit Raspberry Pi OS versions:
Linux kitchen 5.10.63-v7+ #1496 SMP Wed Dec 1 15:58:11 GMT 2021 armv7l GNU/Linux
Raspberry Pi 2 Model B Rev 1.1
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
and
Linux RaspberryPi4B 5.15.61-v7l+ #1579 SMP Fri Aug 26 11:13:03 BST 2022 armv7l GNU/Linux
Raspberry Pi 4 Model B Rev 1.4
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
They both work without problems.
If you can get this thing to happen completely reliably, maybe you could do a little debugging with gdb
? If so, please let us know we can put up some instructions.
gdb is installed, although I don't know how to use it, if you could give instructions I am willing to execute.
the difference of git version string is probably that on git pull it asked for merge.
recompiled with make -j and correct git pull
pi@rpi-speaker1:~/shairport-sync $ shairport-sync -V
4.1-dev-690-g4726c4d9-AirPlay2-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc
pi@rpi-speaker1:~/shairport-sync $ shairport-sync
shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted
Thanks. It's a bit tricky, but it might be very useful. So the idea is to run Shairport Sync from the command line under gdb
and get it to crash, then do a "backtrace" to see if we can work out where in Shairport Sync the problem occurred. But first, it's a good idea to rebuild Shairport Sync to make it more suitable for debugging. Basically, to make the correspondence between the machine code and the original C code we turn off all compiler optimisations.
To do this, rebuild Shairport Sync but prefix the ./configure ...
stuff as follows:
CFLAGS="-O0 -g" CXXFLAGS="-O0 -g" ./configure ...
Then do a $ make clean
followed by $ make -j
.
Next, let's ensure that the Shairport Sync daemon is stopped:
$ sudo systemctl stop shairport-sync
We don't do anything with nqptp
-- leave it running.
Next, we launch gdb
and tell it to get ready to execute Shairport Sync:
$ gdb --args ./shairport-sync
You'll get prompt like this:
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./shairport-sync...
(gdb)
So, before we ask it to run shairport-sync
we need to tell it to keep going if it gets a SIG32
signal:
(gdb) handle SIG32 nostop
and you'll get back:
Signal Stop Print Pass to program Description
SIG32 No Yes Yes Real-time event 32
(gdb)
Now, finally, you can run shairport-sync
:
(gdb) run
and you'll get lots of messages, starting with something like this:
Starting program: /home/pi/shairport-sync/shairport-sync
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xaf9a3cc0 (LWP 3331)]
[New Thread 0xaf1a2cc0 (LWP 3332)]
[New Thread 0xae7fecc0 (LWP 3333)]
[New Thread 0xadffdcc0 (LWP 3334)]
[New Thread 0xad5fecc0 (LWP 3335)]
[Thread 0xaf1a2cc0 (LWP 3332) exited]
...
Shairport Sync should now be running and you should try to crash it. You'll get some kind of message in gdb
. The thing to do is ask for a "backtrace":
(gdb) bt full
and you'll hopefully get a useful output. If you could post that, it would be great. It may tell us where Shairport Sync was when the crash occurred.
You can quit from gdb
at any time, just enter:
(gdb) quit
(gdb) handle SIG32 nostop
Signal Stop Print Pass to program Description
SIG32 No Yes Yes Real-time event 32
(gdb) run
Starting program: /home/pi/shairport-sync/shairport-sync
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt full
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
set = {__val = {0, 0, 65547, 1684632162, 25959, 131440, 1048588, 0, 0, 1114124, 0, 0, 1179660, 0, 0, 1245196, 21469, 0, 65544, 1500, 131080, 200, 196616, 2000, 262152, 30000, 327688, 0, 393222, 32768, 458757, 0}}
pid = <optimized out>
tid = <optimized out>
#1 0x751e6824 in __GI_abort () at abort.c:89
save_stage = 2
act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {1968473672, 1996408908, 1996483824, 2130701416, 1996486792, 1996403164, 1996455528, 2130701408, 1968473032, 89, 2130701412, 1996326216, 1, 1968474728, 89, 1968475816, 1996455528, 1966038192, 1965931916, 663496, 13312, 650184, 4096, 1, 2130701392, 1965115972,
1966038192, 1966029804, 663496, 1965117960, 1965931916, 0}}, sa_flags = 1966034944, sa_restorer = 0x752dbd8c}
sigs = {__val = {32, 0 <repeats 31 times>}}
#2 0x75226354 in __malloc_assert (assertion=<optimized out>, file=<optimized out>, line=line@entry=2406, function=<optimized out>) at malloc.c:301
No locals.
#3 0x75228420 in sysmalloc (nb=1966039160, nb@entry=16392, av=0x2, av@entry=0x752f5794 <main_arena>) at malloc.c:2403
old_top = 0x7effeb4c
old_size = 13312
old_end = 0x719ec3a0 ""
size = <optimized out>
brk = 0x0
correction = <optimized out>
snd_brk = 0x0
front_misalign = <optimized out>
end_misalign = <optimized out>
aligned_brk = <optimized out>
p = <optimized out>
remainder = <optimized out>
remainder_size = <optimized out>
pagesize = 4096
tried_mmap = 40
__func__ = "sysmalloc"
#4 0x75229524 in _int_malloc (av=av@entry=0x752f5794 <main_arena>, bytes=bytes@entry=16386) at malloc.c:3865
p = <optimized out>
iters = <optimized out>
nb = 16392
idx = 1968474729
bin = <optimized out>
victim = <optimized out>
size = <optimized out>
victim_index = <optimized out>
remainder = <optimized out>
---Type <return> to continue, or q <return> to quit---
remainder_size = <optimized out>
block = <optimized out>
bit = <optimized out>
map = <optimized out>
fwd = <optimized out>
bck = <optimized out>
errstr = 0x0
__func__ = "_int_malloc"
#5 0x7522b370 in __GI___libc_malloc (bytes=16386) at malloc.c:2928
ar_ptr = 0x752f5794 <main_arena>
victim = <optimized out>
hook = <optimized out>
__func__ = "__libc_malloc"
#6 0x7554c5b8 in libconfig_yy_create_buffer () from /usr/lib/arm-linux-gnueabihf/libconfig.so.9
No symbol table info available.
#7 0x7554c8b4 in libconfig_yyrestart () from /usr/lib/arm-linux-gnueabihf/libconfig.so.9
No symbol table info available.
#8 0x7554aba0 in ?? () from /usr/lib/arm-linux-gnueabihf/libconfig.so.9
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Fantastic, thanks. Let me try to digest this!
Thank you so much for your help so far. Would you be kind enough to post or gist your configuration file -- probably at /etc/shairport-sync.conf
?
// Sample Configuration File for Shairport Sync
// Commented out settings are generally the defaults, except where noted.
// General Settings
general =
{
name = "small"; // This means "Hostname" -- see below. This is the name the service will advertise to iTunes.
// The default is "Hostname" -- i.e. the machine's hostname with the first letter capitalised (ASCII only.)
// You can use the following substitutions:
// %h for the hostname,
// %H for the Hostname (i.e. with first letter capitalised (ASCII only)),
// %v for the version number, e.g. 3.0 and
// %V for the full version string, e.g. 3.0-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc
// Overall length can not exceed 50 characters. Example: "Shairport Sync %v on %H".
// password = "secret"; // leave this commented out if you don't want to require a password
// interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr". Use "soxr" only if you have a reasonably fast processor.
// output_backend = "alsa"; // Run "shairport-sync -h" to get a list of all output_backends, e.g. "alsa", "pipe", "stdout". The default is the first one.
// mdns_backend = "avahi"; // Run "shairport-sync -h" to get a list of all mdns_backends. The default is the first one.
// port = 5000; // Listen for service requests on this port
// udp_port_base = 6001; // start allocating UDP ports from this port number when needed
// udp_port_range = 100; // look for free ports in this number of places, starting at the UDP port base. Allow at least 10, though only three are needed in a steady state.
// drift_tolerance_in_seconds = 0.002; // allow a timing error of this number of seconds of drift away from exact synchronisation before attempting to correct it
// resync_threshold_in_seconds = 0.050; // a synchronisation error greater than this number of seconds will cause resynchronisation; 0 disables it
// ignore_volume_control = "no"; // set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
// volume_range_db = 60 ; // use this advanced setting to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range.
// volume_max_db = 0.0 ; // use this advanced setting, which must have a decimal point in it, to set the maximum volume, in dB, you wish to use.
// The setting is for the hardware mixer, if chosen, or the software mixer otherwise. The value must be in the mixer's range (0.0 to -96.2 for the software mixer).
// Leave it commented out to use mixer's maximum volume.
// volume_control_profile = "standard" ; // use this advanced setting to specify how the airplay volume is transferred to the mixer volume.
// "standard" makes the volume change more quickly at lower volumes and slower at higher volumes.
// "flat" makes the volume change at the same rate at all volumes.
// run_this_when_volume_is_set = "/full/path/to/application/and/args"; // Run the specified application whenever the volume control is set or changed.
// The desired AirPlay volume is appended to the end of the command line ?~@~S leave a space if you want it treated as an extra argument.
// AirPlay volume goes from 0 to -30 and -144 means "mute".
// regtype = "_raop._tcp"; // Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp".
// playback_mode = "stereo"; // This can be "stereo", "mono", "reverse stereo", "both left" or "both right". Default is "stereo".
// alac_decoder = "hammerton"; // This can be "hammerton" or "apple". This advanced setting allows you to choose
// the original Shairport decoder by David Hammerton or the Apple Lossless Audio Codec (ALAC) decoder written by Apple.
// interface = "name"; // Use this advanced setting to specify the interface on which Shairport Sync should provide its service. Leave it commented out to get the default, which is to select the interface(s) automatically.
// audio_backend_latency_offset_in_seconds = 0.04; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -0.1.
// audio_backend_buffer_desired_length_in_seconds = 0.15; // If set too small, buffer underflow occurs on low-powered machines. Too long and the response time to volume changes becomes annoying. Default is 0.15 seconds in the alsa backend, 0.35 seconds in the pa backend and 1.0 seconds otherwise.
// audio_backend_silent_lead_in_time = 2.0; // This optional advanced setting, from 0.0 and 4.0 seconds, sets the length of the period of silence that precedes the start of the audio. The default is the latency, usually 2.0 seconds. Values greater than the latency are ignored. Values that are too low will affect initial synchronisation.
// dbus_service_bus = "system"; // The Shairport Sync dbus interface, if selected at compilation, will appear
// as "org.gnome.ShairportSync" on the whichever bus you specify here: "system" (default) or "session".
// mpris_service_bus = "system"; // The Shairport Sync mpris interface, if selected at compilation, will appear
// as "org.gnome.ShairportSync" on the whichever bus you specify here: "system" (default) or "session".
};
// Advanced parameters for controlling how Shairport Sync runs a play session
sessioncontrol =
{
// run_this_before_play_begins = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line
// run_this_after_play_ends = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line
// wait_for_completion = "no"; // set to "yes" to get Shairport Sync to wait until the "run_this..." applications have terminated before continuing
// allow_session_interruption = "no"; // set to "yes" to allow another device to interrupt Shairport Sync while it's playing from an existing audio source
// session_timeout = 120; // wait for this number of seconds after a source disappears before terminating the session and becoming available again.
};
// Back End Settings
// These are parameters for the "alsa" audio back end.
alsa =
{
output_device = "hw:0"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
// mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
// output_rate = 44100; // can be 44100, 88200, 176400 or 352800, but the device must have the capability.
// output_format = "S16"; // can be "U8", "S8", "S16", "S24", "S24_3LE", "S24_3BE" or "S32", but the device must have the capability. Except where stated using (*LE or *BE), endianness matches that of the processor.
// disable_synchronization = "no"; // Set to "yes" to disable synchronization. Default is "no".
// period_size = <number>; // Use this optional advanced setting to set the alsa period size near to this value
// buffer_size = <number>; // Use this optional advanced setting to set the alsa buffer size near to this value
// use_mmap_if_available = "yes"; // Use this optional advanced setting to control whether MMAP-based output is used to communicate with the DAC. Default is "yes"
// use_hardware_mute_if_available = "no"; // Use this optional advanced setting to control whether the hardware in the DAC is used for muting. Default is "no", for compatibility with other audio players.
};
// Parameters for the "sndio" audio back end. All are optional.
sndio =
{
// device = "snd/0"; // optional setting to set the name of the output device. Default is the sndio system default.
// rate = 44100; // optional setting which can be 44100, 88200, 176400 or 352800, but the device must have the capability. Default is 44100.
// format = "S16"; // optional setting which can be "U8", "S8", "S16", "S24", "S24_3LE", "S24_3BE" or "S32", but the device must have the capability. Except where stated using (*LE or *BE), endianness matches that of the processor.
// round = <number>; // advanced optional setting to set the period size near to this value
// bufsz = <number>; // advanced optional setting to set the buffer size near to this value
};
// Parameters for the "pa" PulseAudio backend.
pa =
{
// application_name = "Shairport Sync"; //Set this to the name that should appear in the Sounds "Applications" tab when Shairport Sync is active.
};
// Parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
pipe =
{
// name = "/path/to/pipe"; // there is no default pipe name for the output
};
// These are no configuration file parameters for the "stdout" audio back end. No interpolation is done.
// These are no configuration file parameters for the "ao" audio back end. No interpolation is done.
// Static latency settings are deprecated and the settings have been removed.
dsp =
{
//////////////////////////////////////////
// This convolution filter can be used to apply almost any correction to the audio signal, like frequency and phase correction.
// For example you could measure (with a good microphone and a sweep-sine) the frequency response of your speakers + room,
// and apply a correction to get a flat response curve.
//////////////////////////////////////////
//
// convolution = "yes"; // Activate the convolution filter.
// convolution_ir_file = "impulse.wav"; // Impulse Response file to be convolved to the audio stream
// convolution_gain = -4.0; // Static gain applied to prevent clipping during the convolution process
// convolution_max_length = 44100; // Truncate the input file to this length in order to save CPU.
//////////////////////////////////////////
// This loudness filter is used to compensate for human ear non linearity.
// When the volume decreases, our ears loose more sentisitivity in the low range frequencies than in the mid range ones.
// This filter aims at compensating for this loss, applying a variable gain to low frequencies depending on the volume.
// More info can be found here: https://en.wikipedia.org/wiki/Equal-loudness_contour
// For this filter to work properly, you should disable (or set to a fix value) all other volume control and only let shairport-sync control your volume.
// The setting "loudness_reference_volume_db" should be set at the volume reported by shairport-sync when listening to music at a normal listening volume.
//////////////////////////////////////////
//
// loudness = "yes"; // Activate the filter
// loudness_reference_volume_db = -20.0; // Above this level the filter will have no effect anymore. Below this level it will gradually boost the low frequencies.
};
// How to deal with metadata, including artwork
metadata =
{
// enabled = "no"; // set this to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
// include_cover_art = "no"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
// pipe_name = "/tmp/shairport-sync-metadata";
// pipe_timeout = 5000; // wait for this number of milliseconds for a blocked pipe to unblock before giving up
// socket_address = "226.0.0.1"; // if set to a host name or IP address, UDP packets containing metadata will be sent to this address. May be a multicast address. "socket-port" must be non-zero and "enabled" must be set to yes"
// socket_port = 5555; // if socket_address is set, the port to send UDP packets to
// socket_msglength = 65000; // the maximum packet size for any UDP metadata. This will be clipped to be between 500 or 65000. The default is 500.
};
// Diagnostic settings. These are for diagnostic and debugging only. Normally you sould leave them commented out
diagnostics =
{
// disable_resend_requests = "no"; // set this to yes to stop Shairport Sync from requesting the retransmission of missing packets. Default is "no".
// statistics = "no"; // set to "yes" to print statistics in the log
// log_verbosity = 0; // "0" means no debug verbosity, "3" is most verbose.
// log_show_time_since_startup = "no"; // set this to yes if you want the time since startup in the debug message -- seconds down to nanoseconds
// log_show_time_since_last_message = "no"; // set this to yes if you want the time since the last debug message in the debug message -- seconds down to nanoseconds
// drop_this_fraction_of_audio_packets = 0.0; // use this to simulate a noisy network where this fraction of UDP packets are lost in transmission. E.g. a value of 0.001 would mean an average of 0.1% of packets are lost, which is actually quite a high figure.
};
Thanks. Let me look at it...
Thanks for your patience. Could you post the result of just executing:
$ shairport-sync -uvv
Thanks.
pi@rpi-speaker1:~/shairport-sync $ shairport-sync -uvv
Warning: the option -u is no longer needed and is deprecated. Debug and statistics output to STDERR is now the default. Use "--log-to-syslog" to revert.
0.000982552 "shairport.c:594" looking for configuration file at full path "/etc/shairport-sync.conf"
shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted
What is your setup on rpi3 that you have success? What version of raspbian?
Thanks for this, which is very interesting. For some reason, it appears that Shairport Sync is crashing while trying to read the configuration file. I am guessing that it can see the file but can't, for some reason, read it properly. (Checking your configuration file on my system, there was no problem.) If you wouldn't mind, I'll just add a few debug messages, post an update and ask you to run it again. I wonder if the libconfig
library is damaged someway. Very peculiar!
Anyway, the systems I have success with are always Raspberry Pi OS. Generally the Lite version is used, but occasionally the Desktop version is used for testing.
The Pi 3 mentioned above, is built originally from Raspberry Pi OS Lite as follows:
Linux RaspberryPi3B 5.15.61-v7+ #1579 SMP Fri Aug 26 11:10:59 BST 2022 armv7l GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
Raspberry Pi 3 Model B Rev 1.2
and on the Pi 4, also built from Raspberry Pi OS Lite, the details are as follows:
Linux RaspberryPi4B 5.15.61-v7l+ #1579 SMP Fri Aug 26 11:13:03 BST 2022 armv7l GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
Raspberry Pi 4 Model B Rev 1.4
The full desktop version of Raspberry Pi OS works too, and it doesn't matter if its 32- or 64-bit.
However, if you could keep the faulty system as it is until we try a few more diagnostics and try to get to the bottom of the issue, that would be very helpful. No worries if that's not possible.
What s the origin of your OS, BTW? That might be helpful.
Okay, so I've pushed an update to the development
branch with some extra diagnostics on it. If you could run it from the command line with:
$ ./shairport-sync -vv
and post the results, it would be very helpful.
The result I get is like this:
./shairport-sync -vv
0.000706042 "shairport.c:594" looking for configuration file at full path "/etc/shairport-sync.conf"
0.001344218 "shairport.c:603" looking for the general.name
0.000103282 "shairport.c:630" looking for the general.port
0.000068489 "shairport.c:690" looking for the general.soxr_delay_threshold
0.000056146 "shairport.c:703" looking for the general.statistics
0.000067135 "shairport.c:732" looking for the general.log_verbosity
0.000054948 "shairport.c:745" looking for the diagnostics.log_verbosity
0.000055313 "shairport.c:757" looking for the diagnostics.log_show_file_and_line
0.000065104 "shairport.c:795" looking for the diagnostics.statistics
0.000079896 "shairport.c:870" looking for the general.playback_mode
0.000077031 "shairport.c:1000" looking for the latencies.default
0.000055833 "shairport.c:1007" looking for the metadata.enabled
0.000063490 "shairport.c:1046" looking for the metadata.cover_art_cache_directory
0.000087812 "shairport.c:1132" looking for the sessioncontrol.session_timeout
0.000059688 "shairport.c:1173" looking for the dsp.loudness
0.000055990 "shairport.c:1206" looking for dbus
0.000047395 "shairport.c:1220" looking for MPRIS
0.000022552 "shairport.c:1235" looking for MQTT
0.000044115 "shairport.c:1312" looking for AP2 device id
0.000028802 "shairport.c:1326" done
0.000019583 "shairport.c:1332" looking for command line options
0.000033386 "shairport.c:1346" cli option: 118, 0x76, 'v'.
0.000025364 "shairport.c:1346" cli option: 118, 0x76, 'v'.
0.000025209 "shairport.c:1393" done with cli options
0.000056666 "shairport.c:1463" default metadata_pipename is "/tmp/shairport-sync-metadata".
0.000508178 "shairport.c:2050" startup in AirPlay 2 mode, with features 0x405fca00,0x1c340 on device "b8:27:eb:d7:85:d2".
0.000164531 "shairport.c:2093" software version: "4.1-dev-691-gb81308b2-AirPlay2-OpenSSL-Avahi-ALSA-sndio-jack-ao-pa-soundio-dummy-stdout-pipe-soxr-metadata-mqtt-dbus-mpris-sysconfdir:/etc"
0.000061250 "shairport.c:2099" log verbosity is 2.
0.000135260 "audio_alsa.c:1012" alsa: init() -- alsa_backend_state => abm_disconnected.
0.000102292 "audio_alsa.c:1029" alsa: alsa_maximum_stall_time of 0.200000 sec.
...
pi@rpi-speaker1:~/shairport-sync $ ./shairport-sync -V
4.1-dev-691-gb81308b2-AirPlay2-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc
pi@rpi-speaker1:~/shairport-sync $ ./shairport-sync -vv
0.001472916 "shairport.c:594" looking for configuration file at full path "/etc/shairport-sync.conf"
shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted
Super, thanks. Let me zero-in on that specific part of the code...
I've just pushed an update to development
with debug messages surrounding the calls that must be failing. Again, if you'd be so kind as to try it out and post the results, it would be helpful.
At this stage, you just need to:
$ git pull
$ make -j
$ ./shairport-sync -vv
Config
{ name = "volumio"; }; alsa = { output_device = "hw:sndrpihifiberry"; }; sessioncontrol = { run_this_before_entering_active_state = "/bin/sleep 5"; run_this_after_exiting_active_state = "/bin/sleep 5"; active_state_timeout = 300; wait_for_completion = "yes"; allow_session_interruption = "yes"; }; // Diagnostic settings. These are for diagnostic and debugging only. Normally you should leave them commented out diagnostics = { log_output_to = "syslog"; // set this to "syslog" (default), "stderr" or "stdout" or a file or pipe path to specify were all log_verbosity = 2; // "0" means no debug verbosity, "3" is most verbose. log_show_file_and_line = "yes"; // set this to yes if you want the file and line number of the message source in the log file };
@MTxx87, can I just check -- was there a line missing from the top of this, so that it should have read:
general = { name = "volumio"; };
...
it fails so early! maybe it is smth in config_read_file
pi@rpi-speaker1:~/shairport-sync $ ./shairport-sync -V
4.1-dev-692-g489041d2-AirPlay2-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc
pi@rpi-speaker1:~/shairport-sync $ ./shairport-sync -vv
0.001519115 "shairport.c:594" looking for configuration file at full path "/etc/shairport-sync.conf"
shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted
Yeah, or maybe something wrong or missing in the library libconfig
. Let me think about how to find out more...
libconfig-dev is already the newest version (1.5-0.3).
Thanks -- that was going to be my next question 🙂. It's at 1.5-0.4 on the latest Raspberry Pi OS:
ii libconfig-dev:armhf 1.5-0.4 armhf parsing/manipulation of structured config files (development)
ii libconfig9:armhf 1.5-0.4 armhf parsing/manipulation of structured configuration files
Could I suggest moving/renaming the configuration file so that no configuration file can be found. Shairport Sync should start up without trying to read from it.
Then if that works, rename the file that is installed by default, called /etc/shairport_sync.conf.sample
as shairport_sync.conf
and see what happens when you start Shairport Sync again. If the problem goes away, then it would seem to be a problem with the file; otherwise we'll have to dig deeper.
Also I wonder if there are any problems with your package installations. But you need to be very careful; if problems are detected, the fixes attempted can wreck the system and make it unusable!
pi@rpi-speaker1:~/shairport-sync $ shairport-sync -vv
0.001396354 "shairport.c:592" can't resolve the configuration file "/etc/shairport-sync.conf".
0.000155156 "shairport.c:1334" looking for command line options
0.000052657 "shairport.c:1348" cli option: 118, 0x76, 'v'.
0.000040000 "shairport.c:1348" cli option: 118, 0x76, 'v'.
0.000037343 "shairport.c:1395" done with cli options
0.000238125 "shairport.c:2053" startup in AirPlay 2 mode, with features 0x405c4a00,0x1c340 on device "b8:27:eb:bc:58:ab".
0.000122657 "shairport.c:2095" software version: "4.1-dev-692-g489041d2-AirPlay2-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc"
0.000037656 "shairport.c:2101" log verbosity is 2.
0.000103646 "audio_alsa.c:1012" alsa: init() -- alsa_backend_state => abm_disconnected.
0.000041510 "audio_alsa.c:1029" alsa: alsa_maximum_stall_time of 0.200000 sec.
0.000093802 "audio_alsa.c:1364" alsa: output device name is "default".
wow it works without any file, it crashes with sample
I am running with:
shairport-sync -vv -a=Speaker1 -o alsa -- -d hw:0 -c PCM
but when I initiate an airplay stream from iTunes (Mac) same malloc error
pi@rpi-speaker1:/etc $ shairport-sync -vv -a=Speaker1 -o alsa -- -d hw:0 -c PCM
0.000833333 "shairport.c:592" can't resolve the configuration file "/etc/shairport-sync.conf".
0.000101511 "shairport.c:1334" looking for command line options
0.000023854 "shairport.c:1348" cli option: 118, 0x76, 'v'.
0.000330104 "shairport.c:1348" cli option: 118, 0x76, 'v'.
0.000038698 "shairport.c:1395" done with cli options
0.000294896 "shairport.c:2053" startup in AirPlay 2 mode, with features 0x405c4a00,0x1c340 on device "b8:27:eb:bc:58:ab".
0.000139792 "shairport.c:2095" software version: "4.1-dev-692-g489041d2-AirPlay2-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc"
0.000023281 "shairport.c:2101" log verbosity is 2.
0.000178333 "audio_alsa.c:1012" alsa: init() -- alsa_backend_state => abm_disconnected.
0.000021927 "audio_alsa.c:1029" alsa: alsa_maximum_stall_time of 0.200000 sec.
0.000174636 "audio_alsa.c:1364" alsa: output device name is "hw:0".
0.000257135 "shairport.c:2116" The processor is running little-endian.
0.000136458 "shairport.c:2130" libsodium initialised.
0.000046875 "audio_alsa.c:2071" keep_dac_busy is now "no"
0.000482657 "shairport.c:2180" disable resend requests is off.
0.000024948 "shairport.c:2184" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
0.000088072 "shairport.c:2185" statistics_requester status is 0.
0.000227709 "shairport.c:2190" rtsp listening port is 7000.
0.000084896 "shairport.c:2191" udp base port is 6001.
0.000017135 "shairport.c:2192" udp port range is 10.
0.000080156 "shairport.c:2193" player name is "Speaker1".
0.000093646 "shairport.c:2194" backend is "alsa".
0.000077031 "shairport.c:2195" run_this_before_play_begins action is "(null)".
0.000017605 "shairport.c:2196" run_this_after_play_ends action is "(null)".
0.000079114 "shairport.c:2197" wait-cmd status is 0.
0.000076198 "shairport.c:2198" run_this_before_play_begins may return output is 0.
0.000017135 "shairport.c:2200" run_this_if_an_unfixable_error_is_detected action is "(null)".
0.000080105 "shairport.c:2202" run_this_before_entering_active_state action is "(null)".
0.000077395 "shairport.c:2204" run_this_after_exiting_active_state action is "(null)".
0.000076042 "shairport.c:2205" active_state_timeout is 10.000000 seconds.
0.000132604 "shairport.c:2206" mdns backend "(null)".
0.000076667 "shairport.c:2207" userSuppliedLatency is 0.
0.000108698 "shairport.c:2211" interpolation setting is "auto".
0.000017396 "shairport.c:2212" interpolation soxr_delay_threshold is 30000000.
0.000080104 "shairport.c:2213" resync time is 0.050000 seconds.
0.000019531 "shairport.c:2214" allow a session to be interrupted: 0.
0.000099323 "shairport.c:2215" busy timeout time is 0.
0.000016667 "shairport.c:2216" drift tolerance is 0.001995 seconds.
0.000084583 "shairport.c:2217" password is "(null)".
0.000065573 "shairport.c:2218" ignore_volume_control is 0.
0.000018333 "shairport.c:2222" volume_max_db is not set
0.000130000 "shairport.c:2224" volume range in dB (zero means use the range specified by the mixer): 0.
0.000083073 "shairport.c:2228" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
0.000079636 "shairport.c:2230" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
0.000080520 "shairport.c:2231" disable_synchronization is 0.
0.000079063 "shairport.c:2232" use_mmap_if_available is 1.
0.000077240 "shairport.c:2234" output_format automatic selection is enabled.
0.000078802 "shairport.c:2238" output_rate automatic selection is enabled.
0.000077135 "shairport.c:2242" audio backend desired buffer length is 0.200000 seconds.
0.000079010 "shairport.c:2244" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
0.000082084 "shairport.c:2245" audio backend latency offset is 0.000000 seconds.
0.000080989 "shairport.c:2247" audio backend silence lead-in time is "auto".
0.000077761 "shairport.c:2251" zeroconf regtype is "_raop._tcp".
0.000102135 "shairport.c:2252" decoders_supported field is 1.
0.000075938 "shairport.c:2253" use_apple_decoder is 0.
0.000018802 "shairport.c:2254" alsa_use_hardware_mute is 0.
0.000081666 "shairport.c:2258" no special mdns service interface was requested.
0.000175886 "shairport.c:2265" configuration file name "/etc/shairport-sync.conf" can not be resolved.
0.000021771 "shairport.c:2291" loudness is 0.
0.000078958 "shairport.c:2292" loudness reference level is -20.000000
0.000247344 "ptp-utilities.c:176" Send control message to NQPTP: "/nqptp T"
0.000257187 "ptp-utilities.c:176" Send control message to NQPTP: "/nqptp T"
0.005169271 "ptp-utilities.c:116" ptp_shm_interface_open with mapped_addr = 0
0.000347552 "ptp-utilities.c:147" ptp_shm_interface_open -- success!
0.000040990 "ptp-utilities.c:116" ptp_shm_interface_open with mapped_addr = 1995628544
0.000160937 "ptp-utilities.c:151" ptp_shm_interface_open -- already open!
0.000086198 "shairport.c:2375" NQPTP is online.
0.000346459 "activity_monitor.c:161" am_state: am_inactive
0.008367343 "mdns_avahi.c:220" avahi: service 'B827EBBC58AB@Speaker1' group is not yet committed.
0.004405834 "mdns_avahi.c:268" avahi: avahi_entry_group_commit 0
0.000558750 "mdns_avahi.c:463" avahi_dacp_monitor_start Avahi DACP monitor successfully started
0.000784687 "mdns_avahi.c:224" avahi: service 'B827EBBC58AB@Speaker1' group is registering.
0.859185000 "mdns_avahi.c:191" avahi: service 'B827EBBC58AB@Speaker1' successfully added.
0.625153020 "shairport.c:244" soxr_delay: 10596840 nanoseconds, soxr_delay_threshold: 30 milliseconds.
0.000170782 "shairport.c:254" "soxr" interpolation has been chosen.
...
0.000032812 "rtsp.c:3276" Type: "Content-Length", content: "271"
0.000031354 "rtsp.c:3276" Type: "Content-Type", content: "application/x-apple-binary-plist"
0.000032188 "rtsp.c:3276" Type: "CSeq", content: "14"
0.000029323 "rtsp.c:3276" Type: "DACP-ID", content: "7A85C1EC47C5936F"
0.000064635 "rtsp.c:3276" Type: "Active-Remote", content: "3766724067"
0.000034584 "rtsp.c:3276" Type: "User-Agent", content: "AirPlay/620.8.2"
0.000224375 "rtsp.c:3276" Content Plist (as XML):
--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>streams</key>
<array>
<dict>
<key>audioMode</key>
<string>default</string>
<key>ct</key>
<integer>4</integer>
<key>streamConnectionID</key>
<integer>8911106346253502312</integer>
<key>spf</key>
<integer>1024</integer>
<key>shk</key>
<data>
EGyDJlFhdqLupPXBE0YwqMPCcBbFSF20uiHk7JobtKA=
</data>
<key>supportsDynamicStreamID</key>
<true/>
<key>audioFormat</key>
<integer>4194304</integer>
<key>clientID</key>
<string>com.apple.Music</string>
<key>type</key>
<integer>103</integer>
</dict>
</array>
</dict>
</plist>
--
0.000392812 "rtsp.c:3293" Connection 1: TCP Buffered Audio port opened: 50561.
0.000274271 "activity_monitor.c:165" am_state: am_active
0.007629271 "audio_alsa.c:540" alsa: output format chosen is "S16".
0.000145104 "audio_alsa.c:582" alsa: output speed chosen is 44100.
0.002981875 "audio_alsa.c:1530" alsa: update timestamps unavailable
0.000118958 "audio_alsa.c:240" alsa: precision delay timing is not available.
0.000041563 "audio_alsa.c:751" PCM handle name = 'hw:0'
0.000035104 "audio_alsa.c:765" alsa device parameters:
0.000050937 "audio_alsa.c:768" access type = MMAP_INTERLEAVED
0.000058594 "audio_alsa.c:772" format = 'S16_LE' (Signed 16 bit Little Endian)
0.000062813 "audio_alsa.c:776" subformat = 'STD' (Standard)
0.000043489 "audio_alsa.c:779" number of channels = 2
0.000042240 "audio_alsa.c:782" number of significant bits = 16
0.000044375 "audio_alsa.c:790" rate = 44100 frames per second (precisely).
0.000044114 "audio_alsa.c:800" precise (rational) rate = 0.000 frames per second (i.e. 0/1088784512).
0.000053177 "audio_alsa.c:813" period_time = 5804 us (>).
0.000038594 "audio_alsa.c:823" period_size = 256 frames (precisely).
0.000037969 "audio_alsa.c:839" buffer_time = 5944308 us (>).
0.000142031 "audio_alsa.c:852" buffer_size = 262144 frames (>).
0.000045990 "audio_alsa.c:862" periods_per_buffer = 1024 (precisely).
0.000034687 "audio_alsa.c:1941" alsa: prepare() -- opened output device
shairport-sync: malloc.c:2406: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
0.000899479 "rtsp.c:3382" SETUP response
Aborted
Thanks. Very weird. By any chance, are there any anomalies showing up in the system's package setup?
So, presuming that your system package okay, this points to a memory allocation error in Shairport Sync even before it tries to open the configuration file. I'll keep digging.
The only thing different is that I needed to compile this: https://github.com/libimobiledevice/libplist.git on 2.2 because apt would give me v1
The airplay2 WORKS now after first initiating from iphone but is not stable, now it gets malloc every time Very wierd problems, I will try on another rpi I got which has shairport-sync classic
the same happens on a separate rpi!
So, I found a memory allocation error -- a malloc
error -- in just the right place to [maybe] be the cause of the problem. I've pushed an update in development
, so, once again, if you'd be kind enough to try it out, it would be great.
The problem was that the memory allocated was one byte short -- it didn't leave room for a terminating NUL
for a string. Duh.
(Incidentally, I found it using the -fsanitize=address
facility in CLANG
on FreeBSD.)
omg what a difference a byte makes.... it works!
Yeah, one byte! 😅! Thank you so much for your efforts -- I wouldn't have found it otherwise!
Thanks @ageorgios and @mikebrady.
Version 4.1-rc2
is working for me also.
Thanks @MTxx87 for reporting it!
This issue has been inactive for 45 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.
Hello!
This is happening to me with version 4.3.2-1-g90c03bf0-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc.
I'm launching shairport as a user service and it's working fine, but every time I change output to iPhone and back to shairport I have to restart the service. Tried both with my user unit which points to the config file below and with just the binary from the shell which points to the /etc/ config file.
My config file:
// Sample Configuration File for Shairport Sync
// Commented out settings are generally the defaults, except where noted.
// Some sections are operative only if Shairport Sync has been built with the right configuration flags.
// See the individual sections for details.
// General Settings
general =
{
// name = "%H"; // This means "Hostname" -- see below. This is the name the service will advertise to iTunes.
// The default is "Hostname" -- i.e. the machine's hostname with the first letter capitalised (ASCII only.)
// You can use the following substitutions:
// %h for the hostname,
// %H for the Hostname (i.e. with first letter capitalised (ASCII only)),
// %v for the version number, e.g. 3.0 and
// %V for the full version string, e.g. 3.3-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc
// Overall length can not exceed 50 characters. Example: "Shairport Sync %v on %H".
// password = "secret"; // (AirPlay 1 only) leave this commented out if you don't want to require a password
// interpolation = "auto"; // aka "stuffing". Default is "auto". Alternatives are "basic" or "soxr". Choose "soxr" only if you have a reasonably fast processor and Shairport Sync has been built with "soxr" support.
output_backend = "pa"; // Run "shairport-sync -h" to get a list of all output_backends, e.g. "alsa", "pipe", "stdout". The default is the first one.
// mdns_backend = "avahi"; // Run "shairport-sync -h" to get a list of all mdns_backends. The default is the first one.
// interface = "name"; // Use this advanced setting to specify the interface on which Shairport Sync should provide its service. Leave it commented out to get the default, which is to select the interface(s) automatically.
// port = <number>; // Listen for service requests on this port. 5000 for AirPlay 1, 7000 for AirPlay 2
// udp_port_base = 6001; // (AirPlay 1 only) start allocating UDP ports from this port number when needed
// udp_port_range = 10; // (AirPlay 1 only) look for free ports in this number of places, starting at the UDP port base. Allow at least 10, though only three are needed in a steady state.
// airplay_device_id_offset = 0; // (AirPlay 2 only) add this to the default airplay_device_id calculated from one of the device's MAC address
// airplay_device_id = 0x<six-digit_hexadecimal_number>L; // (AirPlay 2 only) use this as the airplay_device_id e.g. 0xDCA632D4E8F3L -- remember the "L" at the end as it's a 64-bit quantity!
// regtype = "<string>"; // Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp" for AirPlay 1, "_airplay._tcp" for AirPlay 2.
// drift_tolerance_in_seconds = 0.002; // allow a timing error of this number of seconds of drift away from exact synchronisation before attempting to correct it
// resync_threshold_in_seconds = 0.050; // a synchronisation error greater than this number of seconds will cause resynchronisation; 0 disables it
// resync_recovery_time_in_seconds = 0.100; // allow this extra time to recover after a late resync. Increase the value, possibly to 0.5, in a virtual machine.
// playback_mode = "stereo"; // This can be "stereo", "mono", "reverse stereo", "both left" or "both right". Default is "stereo".
// alac_decoder = "hammerton"; // This can be "hammerton" or "apple". This advanced setting allows you to choose
// the original Shairport decoder by David Hammerton or the Apple Lossless Audio Codec (ALAC) decoder written by Apple.
// If you build Shairport Sync with the flag --with-apple-alac, the Apple ALAC decoder will be chosen by default.
// ignore_volume_control = "no"; // set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
// volume_range_db = 60 ; // use this advanced setting to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range.
// volume_max_db = 0.0 ; // use this advanced setting, which must have a decimal point in it, to set the maximum volume, in dB, you wish to use.
// The setting is for the hardware mixer, if chosen, or the software mixer otherwise. The value must be in the mixer's range (0.0 to -96.2 for the software mixer).
// Leave it commented out to use mixer's maximum volume.
// volume_control_profile = "standard" ; // use this advanced setting to specify how the airplay volume is transferred to the mixer volume.
// "standard" makes the volume change more quickly at lower volumes and slower at higher volumes.
// "flat" makes the volume change at the same rate at all volumes.
// volume_control_combined_hardware_priority = "no"; // when extending the volume range by combining the built-in software attenuator with the hardware mixer attenuator, set this to "yes" to reduce volume by using the hardware mixer first, then the built-in software attenuator.
// default_airplay_volume = -24.0; // this is the suggested volume after a reset or after the high_volume_threshold has been exceed and the high_volume_idle_timeout_in_minutes has passed
// The following settings are for dealing with potentially surprising high ("very loud") volume levels.
// When a new play session starts, it usually requests a suggested volume level from Shairport Sync. This is normally the volume level of the last session.
// This can cause unpleasant surprises if the last session was (a) very loud and (b) a long time ago.
// Thus, the user could be unpleasantly surprised by the volume level of the new session.
// To deal with this, when the last session volume is "very loud", the following two settings will lower the suggested volume after a period of idleness:
// high_threshold_airplay_volume = -16.0; // airplay volume greater or equal to this is "very loud"
// high_volume_idle_timeout_in_minutes = 0; // if the current volume is "very loud" and the device is not playing for more than this time, suggest the default volume for new connections instead of the current volume.
// Note 1: This timeout is set to 0 by default to disable this feature. Set it to some positive number, e.g. 180 to activate the feature.
// Note 2: Not all applications use the suggested volume: MacOS Music and Mac OS System Sounds use their own settings.
// run_this_when_volume_is_set = "/full/path/to/application/and/args"; // Run the specified application whenever the volume control is set or changed.
// The desired AirPlay volume is appended to the end of the command line – leave a space if you want it treated as an extra argument.
// AirPlay volume goes from 0.0 to -30.0 and -144.0 means "mute".
// audio_backend_latency_offset_in_seconds = 0.0; // This is added to the latency requested by the player to delay or advance the output by a fixed amount.
// Use it, for example, to compensate for a fixed delay in the audio back end.
// E.g. if the output device, e.g. a soundbar, takes 100 ms to process audio, set this to -0.1 to deliver the audio
// to the output device 100 ms early, allowing it time to process the audio and output it perfectly in sync.
// audio_backend_buffer_desired_length_in_seconds = 0.2; // If set too small, buffer underflow occurs on low-powered machines.
// Too long and the response time to volume changes becomes annoying.
// Default is 0.2 seconds in the alsa backend, 0.35 seconds in the pa backend and 1.0 seconds otherwise.
// audio_backend_buffer_interpolation_threshold_in_seconds = 0.075; // Advanced feature. If the buffer size drops below this, stop using time-consuming interpolation like soxr to avoid dropouts due to underrun.
// audio_backend_silent_lead_in_time = "auto"; // This optional advanced setting, either "auto" or a positive number, sets the length of the period of silence that precedes the start of the audio.
// The default is "auto" -- the silent lead-in starts as soon as the player starts sending packets.
// Values greater than the latency are ignored. Values that are too low will affect initial synchronisation.
// dbus_service_bus = "system"; // The Shairport Sync dbus interface, if selected at compilation, will appear
// as "org.gnome.ShairportSync" on the whichever bus you specify here: "system" (default) or "session".
// mpris_service_bus = "system"; // The Shairport Sync mpris interface, if selected at compilation, will appear
// as "org.gnome.ShairportSync" on the whichever bus you specify here: "system" (default) or "session".
// resend_control_first_check_time = 0.10; // Use this optional advanced setting to set the wait time in seconds before deciding a packet is missing.
// resend_control_check_interval_time = 0.25; // Use this optional advanced setting to set the time in seconds between requests for a missing packet.
// resend_control_last_check_time = 0.10; // Use this optional advanced setting to set the latest time, in seconds, by which the last check should be done before the estimated time of a missing packet's transfer to the output buffer.
// missing_port_dacp_scan_interval_seconds = 2.0; // Use this optional advanced setting to set the time interval between scans for a DACP port number if no port number has been provided by the player for remote control commands
};
// Advanced parameters for controlling how Shairport Sync stays active and how it runs a session
sessioncontrol =
{
// "active" state starts when play begins and ends when the active_state_timeout has elapsed after play ends, unless another play session starts before the timeout has fully elapsed.
// run_this_before_entering_active_state = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line
// run_this_after_exiting_active_state = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line
// active_state_timeout = 10.0; // wait for this number of seconds after play ends before leaving the active state, unless another play session begins.
// run_this_before_play_begins = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line
// run_this_after_play_ends = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line
// run_this_if_an_unfixable_error_is_detected = "/full/path/to/application and args"; // if a problem occurs that can't be cleared by Shairport Sync itself, hook a program on here to deal with it.
// An error code-string is passed as the last argument.
// Many of these "unfixable" problems are caused by malfunctioning output devices, and sometimes it is necessary to restart the whole device to clear the problem.
// You could hook on a program to do this automatically, but beware -- the device may then power off and restart without warning!
// wait_for_completion = "no"; // set to "yes" to get Shairport Sync to wait until the "run_this..." applications have terminated before continuing
// allow_session_interruption = "no"; // set to "yes" to allow another device to interrupt Shairport Sync while it's playing from an existing audio source
// session_timeout = 120; // wait for this number of seconds after a source disappears before terminating the session and becoming available again.
};
// Back End Settings
// These are parameters for the "alsa" audio back end.
// For this section to be operative, Shairport Sync must be built with the following configuration flag:
// --with-alsa
alsa =
{
// output_device = "default"; // the name of the alsa output device. Use "shairport-sync -h" to discover the names of ALSA hardware devices. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
// mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. No default. If not specified, no mixer is used and volume in adjusted in software.
// mixer_control_index = 0; // the index of the mixer to use to adjust output volume. Default is 0. The mixer is fully identified by the combination of the mixer_control_name and the mixer_control_index, e.g. "PCM",0 would be such a specification.
// mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
// output_rate = "auto"; // can be "auto", 44100, 88200, 176400 or 352800, but the device must have the capability.
// output_format = "auto"; // can be "auto", "U8", "S8", "S16", "S16_LE", "S16_BE", "S24", "S24_LE", "S24_BE", "S24_3LE", "S24_3BE", "S32", "S32_LE" or "S32_BE" but the device must have the capability. Except where stated using (*LE or *BE), endianness matches that of the processor.
// disable_synchronization = "no"; // Set to "yes" to disable synchronization. Default is "no" This is really meant for troubleshootingG.
// period_size = <number>; // Use this optional advanced setting to set the alsa period size near to this value
// buffer_size = <number>; // Use this optional advanced setting to set the alsa buffer size near to this value
// use_mmap_if_available = "yes"; // Use this optional advanced setting to control whether MMAP-based output is used to communicate with the DAC. Default is "yes"
// use_hardware_mute_if_available = "no"; // Use this optional advanced setting to control whether the hardware in the DAC is used for muting. Default is "no", for compatibility with other audio players.
// maximum_stall_time = 0.200; // Use this optional advanced setting to control how long to wait for data to be consumed by the output device before considering it an error. It should never approach 200 ms.
// use_precision_timing = "auto"; // Use this optional advanced setting to control how Shairport Sync gathers timing information. When set to "auto", if the output device is a real hardware device, precision timing will be used. Choose "no" for more compatible standard timing, choose "yes" to force the use of precision timing, which may cause problems.
// disable_standby_mode = "never"; // This setting prevents the DAC from entering the standby mode. Some DACs make small "popping" noises when they go in and out of standby mode. Settings can be: "always", "auto" or "never". Default is "never", but only for backwards compatibility. The "auto" setting prevents entry to standby mode while Shairport Sync is in the "active" mode. You can use "yes" instead of "always" and "no" instead of "never".
// disable_standby_mode_silence_threshold = 0.040; // Use this optional advanced setting to control how little audio should remain in the output buffer before the disable_standby code should start sending silence to the output device.
// disable_standby_mode_silence_scan_interval = 0.004; // Use this optional advanced setting to control how often the amount of audio remaining in the output buffer should be checked.
};
// Parameters for the "sndio" audio back end. All are optional.
// For this section to be operative, Shairport Sync must be built with the following configuration flag:
// --with-sndio
sndio =
{
// device = "snd/0"; // optional setting to set the name of the output device. Default is the sndio system default.
// rate = 44100; // optional setting which can be 44100, 88200, 176400 or 352800, but the device must have the capability. Default is 44100.
// format = "S16"; // optional setting which can be "U8", "S8", "S16", "S24", "S24_3LE", "S24_3BE" or "S32", but the device must have the capability. Except where stated using (*LE or *BE), endianness matches that of the processor.
// round = <number>; // advanced optional setting to set the period size near to this value
// bufsz = <number>; // advanced optional setting to set the buffer size near to this value
};
// Parameters for the "pa" PulseAudio backend.
// For this section to be operative, Shairport Sync must be built with the following configuration flag:
// --with-pa
pa =
{
server = "PulseAudio (on PipeWire 1.0.0)"; // Set this to override the default pulseaudio server that should be used.
sink = "alsa_output.pci-0000_03_00.1.hdmi-stereo"; // Set this to override the default pulseaudio sink that should be used. (Untested)
// application_name = "Shairport Sync"; //Set this to the name that should appear in the Sounds "Applications" tab when Shairport Sync is active.
};
// Parameters for the "jack" JACK Audio Connection Kit backend.
// For this section to be operative, Shairport Sync must be built with the following configuration flag:
// --with-jack
jack =
{
// client_name = "shairport-sync"; // Set this to the name of the client that should appear in "Connections" when Shairport Sync is active.
// autoconnect_pattern = ""; // Set this to a POSIX regular expression pattern that describes the ports you would like to connect to
// automatically. Examples:
// "system:playback_[12]"
// "some_app_[0-9]*:in-[LR]"
// "jack_mixer:in_2[78]"
// Beware: if you make a syntax error, libjack might crash. In that case, fix it and start over.
// For a good overview, look here: https://www.ibm.com/support/knowledgecenter/SS8NLW_11.0.1/com.ibm.swg.im.infosphere.dataexpl.engine.doc/c_posix-regex-examples.html
// soxr_resample_quality = "none"; // Enable resampling by setting this to "very high", "high", "medium", "low" or "quick"
// bufsz = <number>; // advanced optional setting to set the buffer size to this value
};
// Parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
// For this section to be operative, Shairport Sync must have been built with the following configuration flag:
// --with-pipe
pipe =
{
// name = "/tmp/shairport-sync-audio"; // this is the default
};
// There are no configuration file parameters for the "stdout" audio back end. No interpolation is done.
// To include support for the "stdout" backend, Shairport Sync must be built with the following configuration flag:
// --with-stdout
// There are no configuration file parameters for the "ao" audio back end. No interpolation is done.
// To include support for the "ao" backend, Shairport Sync must be built with the following configuration flag:
// --with-ao
// For this section to be operative, Shairport Sync must be built with the following configuration flag:
// --with-convolution
dsp =
{
//////////////////////////////////////////
// This convolution filter can be used to apply almost any correction to the audio signal, like frequency and phase correction.
// For example you could measure (with a good microphone and a sweep-sine) the frequency response of your speakers + room,
// and apply a correction to get a flat response curve.
//////////////////////////////////////////
//
// convolution = "no"; // Set this to "yes" to activate the convolution filter.
// convolution_ir_file = "impulse.wav"; // Impulse Response file to be convolved to the audio stream
// convolution_gain = -4.0; // Static gain applied to prevent clipping during the convolution process
// convolution_max_length = 44100; // Truncate the input file to this length in order to save CPU.
//////////////////////////////////////////
// This loudness filter is used to compensate for human ear non linearity.
// When the volume decreases, our ears loose more sentisitivity in the low range frequencies than in the mid range ones.
// This filter aims at compensating for this loss, applying a variable gain to low frequencies depending on the volume.
// More info can be found here: https://en.wikipedia.org/wiki/Equal-loudness_contour
// For this filter to work properly, you should disable (or set to a fix value) all other volume control and only let shairport-sync control your volume.
// The setting "loudness_reference_volume_db" should be set at the volume reported by shairport-sync when listening to music at a normal listening volume.
//////////////////////////////////////////
//
// loudness = "no"; // Set this to "yes" to activate the loudness filter
// loudness_reference_volume_db = -20.0; // Above this level the filter will have no effect anymore. Below this level it will gradually boost the low frequencies.
};
// How to deal with metadata, including artwork
// For this section to be operative, Shairport Sync must be built with at one (or more) of the following configuration flags:
// --with-metadata, --with-dbus-interface, --with-mpris-interface or --with-mqtt-client.
// In those cases, "enabled" and "include_cover_art" will both be "yes" by default
metadata =
{
// enabled = "yes"; // set this to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
// include_cover_art = "yes"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
// cover_art_cache_directory = "/tmp/shairport-sync/.cache/coverart"; // artwork will be stored in this directory if the dbus or MPRIS interfaces are enabled or if the MQTT client is in use. Set it to "" to prevent caching, which may be useful on some systems
// pipe_name = "/tmp/shairport-sync-metadata";
// pipe_timeout = 5000; // wait for this number of milliseconds for a blocked pipe to unblock before giving up
// progress_interval = 0.0; // if non-zero, progress 'phbt' messages will be sent at the interval specified in seconds. A 'phb0' message will also be sent when the first audio frame of a play session is about to be played.
// Each message consists of the RTPtime of a a frame of audio and the exact system time when it is to be played. The system time, in nanoseconds, is based the CLOCK_MONOTONIC_RAW of the machine -- if available -- or CLOCK_MONOTONIC otherwise.
// Messages are sent when the frame is placed in the output device's buffer, thus, they will be _approximately_ 'audio_backend_buffer_desired_length_in_seconds' (default 0.2 seconds) ahead of time.
// socket_address = "226.0.0.1"; // if set to a host name or IP address, UDP packets containing metadata will be sent to this address. May be a multicast address. "socket-port" must be non-zero and "enabled" must be set to yes"
// socket_port = 5555; // if socket_address is set, the port to send UDP packets to
// socket_msglength = 65000; // the maximum packet size for any UDP metadata. This will be clipped to be between 500 or 65000. The default is 500.
};
// How to enable the MQTT-metadata/remote-service
// For this section to be operative, Shairport Sync must be built with the following configuration flag:
// --with-mqtt-client
// Note that, for compatability with many MQTT brokers and applications,
// every message that has no extra data is given a
// payload consisting of the string "--".
// You can change this or you can enable empty payloads -- see below.
mqtt =
{
// enabled = "no"; // set this to yes to enable the mqtt-metadata-service
// hostname = "iot.eclipse.org"; // Hostname of the MQTT Broker
// port = 1883; // Port on the MQTT Broker to connect to
// username = NULL; //set this to a string to your username in order to enable username authentication
// password = NULL; //set this to a string you your password in order to enable username & password authentication
// capath = NULL; //set this to the folder with the CA-Certificates to be accepted for the server certificate. If not set, TLS is not used
// cafile = NULL; //this may be used as an (exclusive) alternative to capath with a single file for all ca-certificates
// certfile = NULL; //set this to a string to a user certificate to enable MQTT Client certificates. keyfile must also be set!
// keyfile = NULL; //private key for MQTT Client authentication
// topic = NULL; //MQTT topic where this instance of shairport-sync should publish. If not set, the general.name value is used.
// publish_raw = "no"; //whether to publish all available metadata under the codes given in the 'metadata' docs.
// publish_parsed = "no"; //whether to publish a small (but useful) subset of metadata under human-understandable topics
// empty_payload_substitute = "--"; // MQTT messages with empty payloads often are invisible or have special significance to MQTT brokers and readers.
// To avoid empty payload problems, the string here is used instead of any empty payload. Set it to the empty string -- "" -- to leave the payload empty.
// Currently published topics:artist,album,title,genre,format,songalbum,volume,client_ip,
// Additionally, messages at the topics play_start,play_end,play_flush,play_resume are published
// publish_cover = "no"; //whether to publish the cover over mqtt in binary form. This may lead to a bit of load on the broker
// enable_remote = "no"; //whether to remote control via MQTT. RC is available under `topic`/remote.
// Available commands are "command", "beginff", "beginrew", "mutetoggle", "nextitem", "previtem", "pause", "playpause", "play", "stop", "playresume", "shuffle_songs", "volumedown", "volumeup"
};
// Diagnostic settings. These are for diagnostic and debugging only. Normally you should leave them commented out
diagnostics =
{
// disable_resend_requests = "no"; // set this to yes to stop Shairport Sync from requesting the retransmission of missing packets. Default is "no".
// log_output_to = "syslog"; // set this to "syslog" (default), "stderr" or "stdout" or a file or pipe path to specify were all logs, statistics and diagnostic messages are written to. If there's anything wrong with the file spec, output will be to "stderr".
// statistics = "no"; // set to "yes" to print statistics in the log
// log_verbosity = 0; // "0" means no debug verbosity, "3" is most verbose.
// log_show_file_and_line = "yes"; // set this to yes if you want the file and line number of the message source in the log file
// log_show_time_since_startup = "no"; // set this to yes if you want the time since startup in the debug message -- seconds down to nanoseconds
// log_show_time_since_last_message = "yes"; // set this to yes if you want the time since the last debug message in the debug message -- seconds down to nanoseconds
// drop_this_fraction_of_audio_packets = 0.0; // use this to simulate a noisy network where this fraction of UDP packets are lost in transmission. E.g. a value of 0.001 would mean an average of 0.1% of packets are lost, which is actually quite a high figure.
// retain_cover_art = "no"; // artwork is deleted when its corresponding track has been played. Set this to "yes" to retain all artwork permanently. Warning -- your directory might fill up.
};
Thanks for the post.
In this case, I think that the problem is that you have asked for the PulseAudio backend to be used (output_backend = "pa";
), but the version of Shairport Sync you are using has not been built with PulseAudio backend support. If it had PulseAudio support, -pa
would be included in the version string, e.g.:
$ shairport-sync -V
4.3.2-1-g90c03bf0-AirPlay2-smi10-OpenSSL-Avahi-ALSA-pa-soxr-sysconfdir:/etc
It should be logging a message in the system log like this:
*fatal error: Invalid audio backend "pa" selected!
You might see the error with:
systemctl status shairport-sync
To fix the problem, either use the alsa
backend that Shaiportr Sync was built for, or alternatively, build Shairport Sync with PulseAudio support. If your system is using PipeWire rather than PulseAudio, you might have better luck with building Shairport Sync with PipeWire support.
BTW you can get a (shorter) list of just the active settings with:
$ shairport-sync --displayConfig
What happened?
After many attempts, I managed to install the shairport-sync wit Airplay 2 on raspberry pi4 + Hifiberry Digi+ Pro where I run Volumio OS (v2).
I get the following problem:
STEPS:
BUG:
EXPECTED:
Config
Relevant log output
Operating System?
Linux volumio 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux
Version?
4.1-dev-625-g2a702979-AirPlay2-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc
How did you install Shairport Sync?
Built from source
Check previous issues