0

Debugging Airplay2 "unable to connect" issues

Apologies for any typos - I'm recovering from a hand injury.

I'm running a couple of Pi3 devices with Amp2 boards and HifiBerryOS 20230404.

I have to reboot them every couple of days if I want to use Airplay2. Typically, I try to connect to a speaker from Apple Music, and it's visible in the device list, but if I tap the device, I get a spinner and then after some time passes, a modal pops up on the phone saying that it was unable to connect.

A couple of experiments I've done:

1. I tried setting up a crontab to reboot the Pis each night before I realized cron is not running on HifiberryOS 😆

2. I plugged one Pi into an ethernet port on a wifi access point, and turned the Pi's wifi off. I thought this would fix it, but it still happens exactly the same way - I can listen to it if I use it right away, but if it's been a while, I'll have to reboot it. This appears to eliminate the wifi hardware on the Pi as the problem.

3. I started using Prometheus to probe the http responses every few seconds, to see if there was network flakiness. This basically curls the http server every 15 seconds. It never goes down.

4. I started probing some tcp ports on the shairport-sync list as well: 3689, 5000, 5353, 7000. This was really spitballing. Most of these probes fail all the time, but if I reboot a device, the port 7000 probe succeeds for about 6 hours and then stops working. That's intriguing.

My current theory is that it has something in my home network - possibly my wifi router - might be blocking these ports "intelligently" after deciding they're idle. I've seen fancy firewalls do that with killing open idle connections. I'm not sure it's normal for a consumer device to do that with ports.

Otherwise it could be that shairport simply crashes for some reason on both these device, for reasons unrelated to the network. I'm not sure what the common root cause might be in that case.

I'm looking for ideas for other things to try. I'd really like to see detailed logs from the HifiBerryOS devices, especially for shairport-sync components, but I'm not sure how I'd turn that on, or if it's possible on HifiBerryOS.

3 comments

Please sign in to leave a comment.