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

ncspot bails out with "Channel closed" instead of playing any song #1139

Closed
hanslub42 opened this issue May 1, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@hanslub42
Copy link

hanslub42 commented May 1, 2023

When running the newest ncspot (0.13.1), the program starts up normally, but when selecting any song to play, it bails out with Error: "channel closed"

The problem disappears when I build from any revision that is earlier than b0db0da ("Rewrite MPRIS implementation using zbus")

When comparing debug logs (obtained with -d <logfile>) between the working (i.e. pre- b0db0da) and non-working versions there is no readily apparent difference, except that with the faulty ncspot the log suddenly stops after the second line below:

[2023-05-01][23:36:04] [librespot_playback::player] [INFO] <Dufay: Nuper rosarum flores> (407306 ms) loaded
[2023-05-01][23:36:04] [ncspot] [TRACE] event received: Paused(3.381s)
[2023-05-01][23:39:19] [ncspot] [INFO] Using cached credentials

System: Linux (Gentoo)
installed with git clone and then cargo build
running dbus 1.15.4

(Apropos dbus: dbus-monitor shows quite a bit of activity with the working ncspot version, but remains completely silent with the non-working one)

@hanslub42 hanslub42 added the bug Something isn't working label May 1, 2023
@hanslub42
Copy link
Author

hanslub42 commented May 2, 2023

This was probably a configuration problem on my part:

[hlub@tatra ((b0db0da...) *)] .../target/debug > ./ncspot       
Connecting to Spotify..
Error: "channel closed"
[hlub@tatra ((b0db0da...) *)] .../target/debug > echo $DBUS_SESSION_BUS_ADDRESS

[hlub@tatra ((b0db0da...) *)] .../target/debug > dbus-launch zsh               
[hlub@tatra ((b0db0da...) *)] .../target/debug > echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/tmp/dbus-wOsKxEpCQg,guid=69965afc7a16ff380f806d0764510779
[hlub@tatra ((b0db0da...) *)] .../target/debug > ./ncspot                      
Connecting to Spotify..
# Plays music

Closing.

hrkfdn added a commit that referenced this issue May 2, 2023
Some systems may have an ncspot binary with enabled MPRIS/DBus support, even
though DBus is not actually running on the system or the session is broken.

ncspot should not panic in such a situation, but handle gracefully instead.

Should help with #1139
@hrkfdn
Copy link
Owner

hrkfdn commented May 2, 2023

Thanks for the report. While you're right that the missing DBus session was the problem here, I think ncspot should handle it without crashing. I have committed a small change that should help with this.

@hanslub42
Copy link
Author

Thanks! I can confirm that this works even without a valid $DBUS_SESSION_BUS_ADDRESS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants