Closed mxkyb closed 3 years ago
Thanks for the very interesting post. We don't have an older machine to hand just now, but it would be great if you could run Shairport Sync in the gdb
debugger and run a backtrace at the point of the Segmentation fault. Would that be possible? We could give a few (simple) instructions if necessary...
Here is what I tried. If you need more info or something different please let me know – but then I'll probably need some instructions :)
$ gdb ./shairport-sync
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./shairport-sync...done.
(gdb) run
Starting program: /home/pi/shairport-sync/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 0xb0379aa0 (LWP 1952)]
[New Thread 0xafb78aa0 (LWP 1953)]
[New Thread 0xaf377aa0 (LWP 1954)]
[New Thread 0xae9feaa0 (LWP 1955)]
[New Thread 0xae1fdaa0 (LWP 1956)]
[New Thread 0xad5feaa0 (LWP 1957)]
[New Thread 0xacdfdaa0 (LWP 1958)]
[New Thread 0xac1feaa0 (LWP 1959)]
[New Thread 0xab9fdaa0 (LWP 1960)]
[New Thread 0xab1fcaa0 (LWP 1961)]
[New Thread 0xaa9fbaa0 (LWP 1962)]
[New Thread 0xaa1faaa0 (LWP 1963)]
[New Thread 0xa99f9aa0 (LWP 1964)]
[Thread 0xafb78aa0 (LWP 1953) exited]
[New Thread 0xa91f8aa0 (LWP 1965)]
[New Thread 0xa89f7aa0 (LWP 1966)]
[New Thread 0xa81f6aa0 (LWP 1967)]
[New Thread 0xa79f5aa0 (LWP 1968)]
[New Thread 0xa71f4aa0 (LWP 1969)]
[New Thread 0xa68efaa0 (LWP 1970)]
Thread 19 "shairport-sync" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xa71f4aa0 (LWP 1969)]
0xb58302d0 in ?? () from /lib/arm-linux-gnueabihf/libsodium.so.23
(gdb) backtrace
Python Exception <class 'gdb.MemoryError'> Cannot access memory at address 0x5a8aa454:
#0 0xb58302d0 in ?? () from /lib/arm-linux-gnueabihf/libsodium.so.23
Cannot access memory at address 0x5a8aa454
$ sudo gdb ./shairport-sync
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./shairport-sync...done.
(gdb) run
Starting program: /home/pi/shairport-sync/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 0xb0379aa0 (LWP 1978)]
[New Thread 0xafb78aa0 (LWP 1979)]
[New Thread 0xaf377aa0 (LWP 1980)]
[New Thread 0xae9feaa0 (LWP 1981)]
[New Thread 0xadffeaa0 (LWP 1982)]
[New Thread 0xad5feaa0 (LWP 1983)]
[New Thread 0xacbfeaa0 (LWP 1984)]
[New Thread 0xabffeaa0 (LWP 1985)]
[New Thread 0xab7fdaa0 (LWP 1986)]
[New Thread 0xaaffcaa0 (LWP 1987)]
[New Thread 0xaa7fbaa0 (LWP 1988)]
[New Thread 0xa9ffaaa0 (LWP 1989)]
[New Thread 0xa97f9aa0 (LWP 1990)]
[Thread 0xafb78aa0 (LWP 1979) exited]
[New Thread 0xa8ff8aa0 (LWP 1991)]
[New Thread 0xa87f7aa0 (LWP 1992)]
[New Thread 0xa7ff6aa0 (LWP 1993)]
[New Thread 0xa77f5aa0 (LWP 1994)]
[New Thread 0xa6ff4aa0 (LWP 1995)]
[New Thread 0xa67f3aa0 (LWP 1996)]
Thread 20 "shairport-sync" received signal SIG32, Real-time event 32.
[Switching to Thread 0xa67f3aa0 (LWP 1996)]
futex_abstimed_wait_cancelable (private=<optimized out>, abstime=0xa67f2f80, expected=0, futex_word=0xac10f640)
at ../sysdeps/unix/sysv/linux/futex-internal.h:205
205 ../sysdeps/unix/sysv/linux/futex-internal.h: No such file or directory.
(gdb) backtrace
#0 0xb509257c in futex_abstimed_wait_cancelable
(private=<optimized out>, abstime=0xa67f2f80, expected=0, futex_word=0xac10f640)
at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1 0xb509257c in __pthread_cond_wait_common (abstime=0xa67f2f80, mutex=0x0, cond=0xac10f618)
at pthread_cond_wait.c:539
#2 0xb509257c in __pthread_cond_timedwait (cond=0xac10f618, cond@entry=0xa290, mutex=0x0,
mutex@entry=0x2ed30 <buffer_get_frame_cleanup_handler>, abstime=0xa67f2f80, abstime@entry=0xa67f2f78)
at pthread_cond_wait.c:667
#3 0x000335b0 in buffer_get_frame (conn=0x0, conn@entry=0xac105388) at player.c:1307
#4 0x00034d60 in player_thread_func (arg=<optimized out>) at player.c:2060
#5 0xb508b494 in start_thread (arg=0xa67f3aa0) at pthread_create.c:486
#6 0xb4e01578 in () at ../sysdeps/unix/sysv/linux/arm/clone.S:73
Great stuff, thanks. Could you see if anything more can be gained with:
(gdb) bt full
(Or maybe bt all
— I can’t check right now.)
Looking at the log more carefully, gdb
is stopping only because a (benign) SIG32
signal was received. To continue program execution, enter:
(gdb) handle SIG32 nostop
...and continue.
(gdb) cont
And it's (gdb) bt full
.
Many thanks for your help so far.
Well, thank you for your great work :)
This is what I got:
$ sudo gdb ./shairport-sync
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./shairport-sync...done.
(gdb) run
Starting program: /home/pi/shairport-sync/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 0xb0379aa0 (LWP 2810)]
[New Thread 0xafb78aa0 (LWP 2811)]
[New Thread 0xaf377aa0 (LWP 2812)]
[New Thread 0xae9feaa0 (LWP 2813)]
[New Thread 0xadffeaa0 (LWP 2814)]
[New Thread 0xad5feaa0 (LWP 2815)]
[New Thread 0xacbfeaa0 (LWP 2816)]
[New Thread 0xabffeaa0 (LWP 2817)]
[New Thread 0xab7fdaa0 (LWP 2818)]
[New Thread 0xaaffcaa0 (LWP 2819)]
[New Thread 0xaa7fbaa0 (LWP 2820)]
[New Thread 0xa9ffaaa0 (LWP 2821)]
[New Thread 0xa97f9aa0 (LWP 2822)]
[Thread 0xafb78aa0 (LWP 2811) exited]
[New Thread 0xa8ff8aa0 (LWP 2823)]
[New Thread 0xa87f7aa0 (LWP 2824)]
[New Thread 0xa7ff6aa0 (LWP 2825)]
[New Thread 0xa77f5aa0 (LWP 2826)]
[New Thread 0xa6ff4aa0 (LWP 2827)]
[New Thread 0xa67f3aa0 (LWP 2828)]
Thread 20 "shairport-sync" received signal SIG32, Real-time event 32.
[Switching to Thread 0xa67f3aa0 (LWP 2828)]
futex_abstimed_wait_cancelable (private=<optimized out>, abstime=0xa67f2f80, expected=0, futex_word=0xc7108)
at ../sysdeps/unix/sysv/linux/futex-internal.h:205
205 ../sysdeps/unix/sysv/linux/futex-internal.h: No such file or directory.
(gdb) handle SIG32 nostop
Signal Stop Print Pass to program Description
SIG32 No Yes Yes Real-time event 32
(gdb) cont
Continuing.
[Thread 0xab7fdaa0 (LWP 2818) exited]
Thread 19 "shairport-sync" received signal SIG32, Real-time event 32.
[Thread 0xa6ff4aa0 (LWP 2827) exited]
Thread 18 "shairport-sync" received signal SIG32, Real-time event 32.
[Thread 0xa77f5aa0 (LWP 2826) exited]
[Thread 0xa67f3aa0 (LWP 2828) exited]
[New Thread 0xa67f3aa0 (LWP 2830)]
[New Thread 0xa77f5aa0 (LWP 2831)]
[New Thread 0xa6ff4aa0 (LWP 2832)]
Thread 22 "shairport-sync" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xa77f5aa0 (LWP 2831)]
0xb58302d0 in ?? () from /lib/arm-linux-gnueabihf/libsodium.so.23
(gdb) bt full
#0 0xb58302d0 in () at /lib/arm-linux-gnueabihf/libsodium.so.23
#1 0xb580b3ac in crypto_aead_chacha20poly1305_ietf_decrypt_detached ()
at /lib/arm-linux-gnueabihf/libsodium.so.23
#2 0xfffffffe in ()
Thanks. That was exactly what I meant. Unfortunately, it's not producing much of value. But there is one more thing that you could try, if you would be kind enough. The idea is to compile Shairport Sync with all optimisations turned off, so that the backtrace can have the best chance to provide as much information as possible. To turn off optimisations, add the following preamble to your ./configure...
command: CFLAGS="-O0 -g" CXXFLAGS="-O0 -g"
.
For example, you might have a /.configure...
step like this:
$ CFLAGS="-O0 -g" CXXFLAGS="-O0 -g" ./configure --sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-systemd
Then do a:
$ make clean all -j
The clean
is needed to remove the existing (optimised) object files before calculating what needs to be built.
I fear it doesn't include new information:
Compiled with:
$ CFLAGS="-O0 -g" CXXFLAGS="-O0 -g" ./configure --sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-systemd --with-dbus-interface --with-airplay-2
(gdb) cont
Continuing.
Thread 19 "shairport-sync" received signal SIG32, Real-time event 32.
[Thread 0xa77f5aa0 (LWP 13030) exited]
Thread 18 "shairport-sync" received signal SIG32, Real-time event 32.
[Thread 0xa7ff6aa0 (LWP 13029) exited]
[Thread 0xa6ff4aa0 (LWP 13031) exited]
Thread 17 "shairport-sync" received signal SIG32, Real-time event 32.
[Thread 0xa87f7aa0 (LWP 13028) exited]
Thread 16 "shairport-sync" received signal SIG32, Real-time event 32.
[Thread 0xa8ff8aa0 (LWP 13027) exited]
[Thread 0xab7fdaa0 (LWP 13026) exited]
[New Thread 0xab7fdaa0 (LWP 13059)]
[New Thread 0xa8ff8aa0 (LWP 13060)]
[New Thread 0xa87f7aa0 (LWP 13061)]
[New Thread 0xa6ff4aa0 (LWP 13062)]
[New Thread 0xa7ff6aa0 (LWP 13063)]
[New Thread 0xa77f5aa0 (LWP 13064)]
Thread 25 "shairport-sync" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xa7ff6aa0 (LWP 13063)]
0xb58302d0 in ?? () from /lib/arm-linux-gnueabihf/libsodium.so.23
(gdb) bt full
#0 0xb58302d0 in () at /lib/arm-linux-gnueabihf/libsodium.so.23
#1 0xb580b3ac in crypto_aead_chacha20poly1305_ietf_decrypt_detached () at /lib/arm-linux-gnueabihf/libsodium.so.23
#2 0xfffffffe in ()
If there is anything else I can do I am happy to try
edit:
A difference to your command I just noticed, I added --with-airplay-2
.
Thanks again. We'll try some other way -- maybe 10.14 running in a VM.
Well, I managed to replicate it running 10.14.6 in a VMware Fusion VM and following your instructions. Thanks!
Well, that is interesting. It turns out that when you direct the Sound Output to AirPlay 2 from macOS 10.14.6 (Mojave), it uses a version of the AirPlay 2 protocol that is different from the current one, and it is missing an important parameter, a "shk"
, possibly a session key. When playing from the iTunes app on Mojave, this parameter is present, so everything works.
Unfortunately, I can't figure out what to replace this missing parameter with, so for the moment, all we can say that Shairport Sync is not compatible with Mac OS Mojave.
This issue has been inactive for 60 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.
Steps to reproduce
Compile from development branch on Raspberry Pi.
Run shairport-sync on Raspberry Pi.
Change system output on MacBook to airplay. Start playing sound. Shairport-sync app will crash (see logs below).
Same setup of shairport-sync will work perfectly on newer versions of macOS and iOS.
Hardware Info
Shairport-sync Logs