mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #1133] Undiscoverable when launched at the same time as avahi-daemon #531
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#531
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ettom on GitHub (Mar 19, 2023).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1133
Describe the bug
Librespot (with dns-sd backend) stays in an undiscoverable state if launched closely together with avahi-daemon.
To reproduce
Steps to reproduce the behavior:
systemctl stop avahi-daemonLibrespot fails to start until avahi is started:
systemctl start avahi-daemonLibrespot now starts, but the instance is not discoverable until librespot is launched again. Some kind of a race condition? Additionally, restarting avahi-daemon while librespot is running (in a discoverable state) will make it undiscoverable until restarted.
Log:
Host (what you are running
librespoton):@vlada-dudr commented on GitHub (May 18, 2023):
It is due Librespot implementing it's own mDNS stack instead of just registering with Avahi. So they fight each other.
@ettom commented on GitHub (May 18, 2023):
I have compiled librespot with the dns-sd backend. Isn't that supposed to use Avahi for discovery?
@vlada-dudr commented on GitHub (May 18, 2023):
Ok, then it should use avahi. But it probably doesn't retry if avahi is unavailable. One has to correctly order service dependencies in systemd or other supervisor used. Systemd can propagate restarts if configured to do so, but that's only workaround for proper dbus discovery
May 18, 2023 11:42:20 ettom @.***>:
@ettom commented on GitHub (May 18, 2023):
I have set
Requires=avahi-daemon.serviceon the librespot service and it doesn't really work (see my original post). I could try to create a workaround like adding a small delay inExecStartPrefor librespot.service, but I think this should not be required and librespot should handle it internally.@vlada-dudr commented on GitHub (May 19, 2023):
The problem is though that librespot doesn't listen to events from avahi, so in case of avahi is restarted librespot never applies again for registration. This is caused by librespot using only simple (and deprecated) compatibility bindings to Avahi.
Other issue is that
Requirespull dependency in whenever librespot start, but it doesn't order them anyhow. To have librespot started after avahi addAfter=avahi-daemon.service(or socket might be cleaner). You can also work around the registration issue by usingBindsTo=avahi-daemon.serviceinsteadRequires, which will start and stop (and restart) librespot in concert with Avahi. The ordering is still done throughAfter.@headblockhead commented on GitHub (Apr 6, 2024):
For anyone coming across this in the future, I have found that a similar issue (librespot fully undiscoverable) was resolved for me by enabling publishing / user service publishing in
avahi's config.For some reason this is disabled by default! Took me way too long to figure out :P
In NixOS:
Sorry for interrupting / necroposting as this doesn't resolve the issue but this is the (only) top google result for
DNS-SD Error: Unknown.and I didn't want to create a new issue for a problem I already fixed myself.Feel free to hide/delete this post if you want!
@roderickvd commented on GitHub (Oct 26, 2024):
You can now configure librespot to use the Avahi daemon.
@roderickvd commented on GitHub (Oct 26, 2024):
See #1347 or launch librespot with -h to get a list of options.
@wisp3rwind commented on GitHub (Oct 29, 2024):
To elaborate on what @roderickvd said: The old
dns-sdbackend is unchanged and still has this issue.However, there's a new backend which requires compiling with the
with-avahifeature (it should become the default then). This backend listens on DBus for Avahi to show up, and only then registers the service. It should also deal with Avahi daemon restarts.