question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better error handling after zeroconf issues (and a request for help to debug the issue)

See original GitHub issue

Describe the bug I’m experiencing issues with librespot-java zeroconf discovery, but only on one specific client, which is a raspberry 3 with a fresh raspbian install (but it also has pihole, homeasssistant and some other stuff installed on it which might interfere). Another Pi with the exact same version of librespot-java runs just fine, but this one raspberry is simply not showing up in spotify’s list of devices.

This is similar to #246, but a zeroconf /?action=getInfo GET request returns the same on both clients (except device ID and public key) , so it seems like a client-specific issue that the broken client never makes itself public for the Spotify clients.

As you can see in the below logs, the start of librespot-java is stalled after " Zeroconf HTTP server started successfully", whereas on the working raspberry it’ll say “Zeroconf:473 - Announced Service” shortly after starting the server.

Because I have absolutely no experience with zeroconf I couldn’t further debug the issue. Nevertheless I’d say that librespot-java should do some error handling when it fails to launch the zeroconf service properly.

To Reproduce Not sure unfortunately, which is why I’m looking for a way on how to debug this.

Expected behavior If there is an issue with the zeroconf discovery (announcement?) it should crash / show in the logs.

Screenshots/Stracktraces/Logs Log level for both raspberrys is TRACE

Log from the broken raspberry (it’s pretty short and nothing else will show up, even after a few minutes):

pi@raspi-server:~ $ java -jar librespot-player-1.5.1.jar
2020-08-10 23:32:41,309 INFO  Utils:84 - Cryptography restrictions removal not needed.
2020-08-10 23:32:41,438 INFO  ZeroconfServer:442 - Zeroconf HTTP server started successfully on port 21787!

In comparison, log from the working raspberry:

pi@raspi-zwei:~ $ java -jar librespot-player-1.5.1.jar
2020-08-10 23:32:54,607 INFO  Utils:84 - Cryptography restrictions removal not needed.
2020-08-10 23:32:54,926 INFO  ZeroconfServer:442 - Zeroconf HTTP server started successfully on port 17169!
2020-08-10 23:32:55,886 TRACE ZeroconfServer:506 - Handling request: GET /?action=getInfo HTTP/1.1, headers: {Connection=keep-alive, User-Agent=Spotify/113800558 Win32/0 (PC desktop), Host=192.168.0.107, Accept-Language=en, Accept-Encoding=gzip, deflate, Content-Type=application/x-www-form-urlencoded}
2020-08-10 23:32:56,527 INFO  Zeroconf:473 - Announced Service{alias='librespot-java', service='spotify-connect', port=17169, text={VERSION=1.0, CPath=/, Stack=SP}, addresses=[/192.168.0.107], domain='.local', protocol='tcp', host='raspi-thomas'}.
2020-08-10 23:34:34,851 TRACE ZeroconfServer:506 - Handling request: GET /?action=getInfo&version=2.7.1 HTTP/1.1, headers: {Connection=keep-alive, User-Agent=Spotify/113800558 Win32/0 (PC desktop), Host=192.168.0.107, Accept-Language=en, Accept-Encoding=gzip, deflate, Content-Type=application/x-www-form-urlencoded}

Version/Commit tested with both librespot-api-1.5.1.jar and librespot-player-1.5.1.jar

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
devgianlucommented, Aug 11, 2020

It seems to get stuck somewhere in between the gathering of the network interfaces and the dispatching of the service. Try this:

[zeroconf]
	listenAll = false
	interfaces = "eth0"
	listenPort = -1

If you can hook up a debugger you could try stepping trough this: https://github.com/librespot-org/librespot-java/blob/0be6da0b6dd26c92d448bf4aa5a88bd3d97a6a6f/lib/src/main/java/xyz/gianlu/librespot/ZeroconfServer.java#L110-L144

1reaction
devgianlucommented, Dec 10, 2020

No problem, go ahead

Read more comments on GitHub >

github_iconTop Results From Across the Web

mDNS on react-native Request failed with status code 500
I decided to use react-native-zeroconf and I encountered a problem. There is a warning Error: Request failed with status code 500 once I...
Read more >
Learn best practices for debugging and error handling in an ...
Recommended handling​​ Client-side retry handling: Timeout Exception should be categorised as a retryable error and handled by writing retry ...
Read more >
zeroconf - PyPI
Better Handling of DNS Incoming Packets parsing exceptions · Many exceptions will now log a warning the first time they are seen ·...
Read more >
Guide to Frontend Error Handling - Rollbar
Discover the secrets to effective error handling and how to track errors in real-time. Don't miss out on the essential tips in this ......
Read more >
Zigbee Home Automation - Home Assistant
When reporting issues, please provide the following information in addition to information requested by issue template: Debug logs for the issue, see debug...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found