Skip to content
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

librespot mdns reponder competes with avahi -> forces avahi to add '-2' to the hostname #1379

Closed
ernstkl opened this issue Oct 20, 2024 · 3 comments · Fixed by #1347
Closed
Labels

Comments

@ernstkl
Copy link
Contributor

ernstkl commented Oct 20, 2024

Look for similar bugs

done

Description

When librespot is running, and

  • later avahi is started / restarted
    or
  • network-connectivity is lost and restored again

avahi will find a hostname conflict when trying to claim the system host name <hostname>, and has to resort to register <hostname>-2

The result is that the original <hostname>.local can not be resolved by other hosts in the LAN.

Version

any, incl. 0.5.0

How to reproduce

Steps to reproduce the behavior

  1. start librespot in any way
  2. systemctl restart avahi-daemon
  3. look at the logs, find the entry "<hostname> avahi-daemon[404]: Host name conflict, retrying with <hostname>-2

Log

  • I am not adding a librespot debug log, because librespot works fine, it just stands in the way of avahi working correctly

Host (what you are running librespot on):

  • OS: Linux
  • Platform: RPi 4

Suggested fix (concept)

Starting the mdns responder should be done using spawn_ip_with_ip_list_and_hostname, and choose a hostname derived from the system hostname, like "librespot-on-<hostname>", or maybe same random value.

suggestion based on (avahi/avahi#117 (comment))

(edit: escape the > and < around hostname)

@wisp3rwind
Copy link
Contributor

wisp3rwind commented Oct 20, 2024

I think this is an issue with the libmdns-based zeroconf stack only: As I understand it, its mainly supposed to be used if you don't want to run another MDNS service on the system just for librespot. There's some discussion on the original motivation for adding it at plietar/librespot#33.

If you have Avahi running already, you should be able to compile librespot with the with-dns-sd feature, which talks to Avahi (via the dns-sd compatibility layer, which you'd need to install, cf. https://github.com/librespot-org/librespot/wiki/Compiling#with-dns-sd).

#1347 proposes to add yet another Avahi-based zeroconf interface to librespot and makes switching between the different configurations more convenient (by adding a commandline flag, instead of just a compile-time feature, and by not requiring non-Rust dependencies).

Your suggested fix sounds like a worthwhile improvement we could do; and we could probably also do a better job of documenting this behavior.
EDIT: Although, in the case where no other MDNS responder is running on the system, people might actually want librespot to also advertise the hostname?

@wisp3rwind
Copy link
Contributor

One thing we could do on top of #1347 is to add an auto zeroconf backend, which tries to connect to Avahi, and falls back to libmdns if that's not running. We might then make this the new default (i.e. add with-avahi to the default features and select the auto backend by default when using the CLI).

@wisp3rwind
Copy link
Contributor

Relevant history: plietar/librespot#33, plietar/librespot#81.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants