-
-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Problem]: MAC address portion of raop service name changes to all zeros, shairport is then unselectable as output destination #1657
Comments
I think the shairport service is getting restarted, and then the return value of the call to get_device_id in shairport.c isn't checked for success. I replaced the call with the following snippet and so far I haven't seen the problem recur. I'll continue monitoring.
|
Fantastic work! The value returned by I never imagined that it would change dynamically! So I'll make some changes so that Shairport Sync will wait at startup -- in a loop like you have used above -- to get the information necessary to generate a device ID and then store it for later use. What do you think? |
Thanks! I had this happen again though last night, even with the loop until get_device_id returns a success code. I'm now thinking there might be an edge case where getifaddrs is returning all zeroes for the address. I'll investigate this further today. I had multiple power failures last night, and after the reboots the MAC address portions of the service names were all zeroes again. I do think that we need a loop in the code until a valid address is returned. |
Thanks, yeah -- more information on this would be very useful. It seems to me that we only need it to be successful once, at the start, and so a loop there would be okay. But I think it would be necessary to limit the looping to something sensible so that an error message could be generated if the problem persisted for a long time. |
Here's what I found: It looks like immediately after a reboot getifaddrs returns only records with sa_family=AF_INET or AF_INET6. After a few moments subsequent calls also return a record with sa_family=AF_PACKET. It seems like the simple fix will be to change common.c:get_device_id to return a failure code if it doesn't find a match and then alter the code in shairport.c:main to repeat the call to get_device_id for a reasonable number of tries before failing. |
LMK if you'd like for me to submit a pull request. |
Thanks for that. Can I just clarify that, as soon as |
In the case I described, getifaddrs returned a zero status and there were valid AF_INET and AF_INET6 records but no AF_PACKET records. In that case it is insufficient to just check the return status of getifaddrs. My understanding is that you need an AF_PACKET or AF_LINK record to retrieve the MAC address, but perhaps I'm mistaken. I thought that the AF_INET and AF_INET6 records contain the IP addresses but not the MAC address. |
This is how I changed the code:
|
I checked again and need to update the description of the behavior slightly. On the first call there was also an AF_PACKET record, but it was associated with the loopback and was ignored (ifa_name = "lo"). The wlan0 records appeared in subsequent calls. I think my altered code is still appropriate. |
Thanks for this really interesting information! Let me digest it for a day or two, please. |
Thanks for the code above, which is perfect. I agree about the need to see an
What would you think? (It works for me, but that's just a normal situation...) |
I just tested that code on my beaglebone after a reboot. It called getifaddrs nearly 13K times before it was successful. Perhaps put a usleep call between attempts? I was originally thinking a one second delay made sense given that this only happens on startup, but I'm sure a 100 millisecond delay is also reasonable. Otherwise I think we're hitting the hardware too hard. |
Yikes, you are completely right! I’ll go with 100 ms.
|
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. |
What happened?
After a while random shairport nodes become unavailable on the LAN as audio output destinations. It appears that the unavailable nodes have all zeros for the MAC address portion of the _raop._tcp. service name. If the shairport-sync service is restarted the MAC address in the name is repopulated correctly and the node becomes available again. The LAN is a mesh network with multiple Eero base stations, so I'm guessing that the nodes are probably hopping between them when the MAC address changes to all zeros.
I'm not certain that this is the root cause for why certain nodes become unavailable, but whether or not they have the full MAC address in the service name seems to map to whether they're selectable as an audio output destination or not. You can otherwise communicate with them normally.
The _airplay._tcp. service seems to be unaffected by this problem - it looks good whether the node is available or not. Both services contain the correct IP addresses in their text records.
Relevant log output
No response
Configuration Information.
$ shairport-sync --displayConfig
From "uname -a":
Linux Globe1 5.10.162-ti-r58 #1bullseye SMP PREEMPT Sat Feb 25 19:31:31 UTC 2023 armv7l GNU/Linux
From /etc/os-release:
Debian GNU/Linux 11 (bullseye)
From /sys/firmware/devicetree/base/model:
TI AM335x BeagleBone Green Wireless
Shairport Sync Version String:
4.1-rc0-286-ga1c9387c-AirPlay2-OpenSSL-Avahi-ALSA-stdout-soxr-metadata-dbus-sysconfdir:/etc
Command Line:
shairport-sync --displayConfig
Configuration File:
/etc/shairport-sync.conf
Configuration File Settings:
general :
{
name = "Speaker 1";
};
alsa :
{
output_device = "plughw:0,0,0";
output_rate = 44100;
output_format = "S16_LE";
};
How did you install Shairport Sync?
Built from source
Check previous issues
The text was updated successfully, but these errors were encountered: