sp-playcount-librespot icon indicating copy to clipboard operation
sp-playcount-librespot copied to clipboard

[bug] JSON occasionally fails to parse

Open entriphy opened this issue 4 years ago • 6 comments

Stack trace:

com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 5 path $
 at com.google.gson.JsonParser.parseReader(JsonParser.java:66)
 at xyz.gianlu.librespot.mercury.JsonMercuryRequest.instantiate(JsonMercuryRequest.java:26)
 at xyz.gianlu.librespot.mercury.MercuryClient.sendSync(MercuryClient.java:82)
 at xyz.gianlu.librespot.HTTPSServer$PlayCountHandler.handle(HTTPSServer.java:88)
 at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
 at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
 at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
 at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
 at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
 at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 at java.lang.Thread.run(Thread.java:748)
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 5 path $
 at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1564)
 at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1405)
 at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:543)
 at com.google.gson.stream.JsonReader.peek(JsonReader.java:426)
 at com.google.gson.JsonParser.parseReader(JsonParser.java:61)
 ... 12 more

entriphy avatar Apr 18 '20 20:04 entriphy

What's the response code that you get back from the server for this issue @evilarceus ? Would it result in a 500? (As I mentioned in response to another issue here) I'm experiencing intermittent 500s from the public server.

slapheadted avatar Apr 20 '20 15:04 slapheadted

The status code should be 500 for this issue. If you're getting random status code 500s, it's most likely because of this issue.

entriphy avatar Apr 20 '20 18:04 entriphy

i'm also getting intermittent 500s on the artistInfo endpoint

2020/04/29 09:09:41 [warn] 4576#0: *1244 an upstream response is buffered to a temporary file /var/lib/nginx/tmp/proxy/1/00/0000000001 while reading upstream, client: 87.9.212.241, server: , request: "GET /artistInfo?artistid=0SfsnGyD8FpIN4U4WCkBZ5 HTTP/1.1", upstream: "http://xxx/artistInfo?artistid=0SfsnGyD8FpIN4U4WCkBZ5", host: "xxx", referrer: "http://xxx/artistInfo?artistid=0SfsnGyD8FpIN4U4WCkBZ5"

annadnl avatar Apr 29 '20 09:04 annadnl

i'm also getting intermittent 500s on the artistInfo endpoint

2020/04/29 09:09:41 [warn] 4576#0: *1244 an upstream response is buffered to a temporary file /var/lib/nginx/tmp/proxy/1/00/0000000001 while reading upstream, client: 87.9.212.241, server: , request: "GET /artistInfo?artistid=0SfsnGyD8FpIN4U4WCkBZ5 HTTP/1.1", upstream: "http://xxx/artistInfo?artistid=0SfsnGyD8FpIN4U4WCkBZ5", host: "xxx", referrer: "http://xxx/artistInfo?artistid=0SfsnGyD8FpIN4U4WCkBZ5"

That's a playlist

Stoley avatar Apr 29 '20 10:04 Stoley

it is not, it's armin van buuren :-)

spotify:artist:0SfsnGyD8FpIN4U4WCkBZ5

but you are correct, if you search for "0SfsnGyD8FpIN4U4WCkBZ5" on the platform it does return a playlist. could this be a hint towards where the problem comes from? that a playlist and an artist have the same handle?

annadnl avatar Apr 29 '20 10:04 annadnl

ah you're right, never seen that before

Stoley avatar Apr 29 '20 10:04 Stoley