-
-
Notifications
You must be signed in to change notification settings - Fork 100
Error handling ("user is already connected") after an exception is thrown #225
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When an exception within librespot-java occurs, I sometimes have to manually restart librespot-java, because any further connection attempts to it are denied with Dropped connection attempt because user is already connected.
To Reproduce
Using ZEROCONF:
- Somehow manage to throw an unhandled exception (I might open a new issue for that if I manage to reproduce)
- Librespot-java reacts with something like
FATAL Log4JUncaughtExceptionHandler:15 - [player-queue-7462166] - In case spotify still shows that you're connected to librespot, just press play or next
- Or, if it's disconnected, which sometimes is the case just try to reconnect
- Librespot either throws
Dropped connection attempt because user is already connected.or in some cases also anjava.lang.IllegalStateException: Buffer is closed!, I don't know whether it's related.
Expected
Either just throw the exception and leave it unhandled, so systemd can detect it and restart my service or allow me to reconnect even tough I'm already connected.
Screenshots/Stracktraces/Logs
I attached an examplary log where that happened
May 06 10:59:24 raspi-server java[12613]: 2020-05-06 10:59:24,811 INFO DeviceStateHandler:255 - Put state. {ts: 1588755563638, connId: ODk0Mm[truncated], reason: PLAYER_STATE_CHANGED}
May 06 10:59:24 raspi-server java[12613]: 2020-05-06 10:59:24,919 INFO PlayerQueueEntry:100 - Loaded track. {name: 'ilomilo', artists: 'Billie Eilish', uri: spotify:track:7qEKqBCD2vE5vIBsrUitpD, id: 012b3d9be6dd2f407eb0f3e758b2346b}
May 06 10:59:25 raspi-server java[12613]: 2020-05-06 10:59:24,922 FATAL Log4JUncaughtExceptionHandler:15 - [player-queue-7462166]
May 06 10:59:25 raspi-server java[12613]: java.lang.IllegalArgumentException: TrackId{spotify:track:7qEKqBCD2vE5vIBsrUitpD}
May 06 10:59:25 raspi-server java[12613]: at xyz.gianlu.librespot.player.StateWrapper.metadataFor(StateWrapper.java:600) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 10:59:25 raspi-server java[12613]: at xyz.gianlu.librespot.player.Player.metadataFor(Player.java:721) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 10:59:25 raspi-server java[12613]: at xyz.gianlu.librespot.player.playback.PlayerSession.metadataFor(PlayerSession.java:180) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 10:59:25 raspi-server java[12613]: at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.load(PlayerQueueEntry.java:104) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 10:59:25 raspi-server java[12613]: at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.run(PlayerQueueEntry.java:245) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 10:59:25 raspi-server java[12613]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) ~[?:?]
May 06 10:59:25 raspi-server java[12613]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) ~[?:?]
May 06 10:59:25 raspi-server java[12613]: at java.lang.Thread.run(Thread.java:844) [?:?]
May 06 10:59:25 raspi-server java[12613]: 2020-05-06 10:59:25,103 DEBUG EventService:48 - Event sent. {body: 274|3|2|2|55c462564cca2f379aa5399e96fb8751ea483a8b|spotify:track:7qEKqBCD2vE5vIBsrUitpD|1|2|2, result: 200}
May 06 10:59:59 raspi-server java[12613]: 2020-05-06 10:59:59,852 DEBUG Player:244 - Received command: UpdateContext
May 06 10:59:59 raspi-server java[12613]: 2020-05-06 10:59:59,867 DEBUG DealerClient:108 - Handled request. {key: 6218a36d-dfe7-4b4c-aff0-43636579f9c3, result: SUCCESS}
May 06 11:00:00 raspi-server java[12613]: 2020-05-06 11:00:00,326 DEBUG Player:244 - Received command: Play
May 06 11:00:00 raspi-server java[12613]: 2020-05-06 11:00:00,326 DEBUG Player:297 - Loading context (play), uri: spotify:playlist:37i9dQZF1DXdxcBWuJkbcy
May 06 11:00:00 raspi-server java[12613]: 2020-05-06 11:00:00,339 INFO StateWrapper:207 - Context has transforming! {url: https://spclient.wg.spotify.com/cuepoints-transitions/v2/decorate, shuffle: true, willRequest: true}
May 06 11:00:00 raspi-server java[12613]: 2020-05-06 11:00:00,720 DEBUG StateWrapper:221 - Updated context with transforming information!
May 06 11:00:00 raspi-server java[12613]: 2020-05-06 11:00:00,728 FATAL Log4JUncaughtExceptionHandler:15 - [player-queue-21358477]
May 06 11:00:00 raspi-server java[12613]: java.lang.IllegalStateException: Buffer is closed!
May 06 11:00:00 raspi-server java[12613]: at xyz.gianlu.librespot.player.mixing.CircularBuffer.write(CircularBuffer.java:42) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 11:00:00 raspi-server java[12613]: at xyz.gianlu.librespot.player.mixing.MixingLine$SecondOutputStream.write(MixingLine.java:166) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 11:00:00 raspi-server java[12613]: at xyz.gianlu.librespot.player.codecs.VorbisCodec.decodeCurrentPacket(VorbisCodec.java:201) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 11:00:00 raspi-server java[12613]: at xyz.gianlu.librespot.player.codecs.VorbisCodec.readInternal(VorbisCodec.java:153) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 11:00:00 raspi-server java[12613]: at xyz.gianlu.librespot.player.codecs.Codec.writeSomeTo(Codec.java:42) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 11:00:00 raspi-server java[12613]: at xyz.gianlu.librespot.player.playback.PlayerQueueEntry.run(PlayerQueueEntry.java:295) ~[librespot_neu.jar:1.4.0-SNAPSHOT]
May 06 11:00:00 raspi-server java[12613]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) ~[?:?]
May 06 11:00:00 raspi-server java[12613]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) ~[?:?]
May 06 11:00:00 raspi-server java[12613]: at java.lang.Thread.run(Thread.java:844) [?:?]
May 06 11:00:00 raspi-server java[12613]: 2020-05-06 11:00:00,762 INFO DeviceStateHandler:255 - Put state. {ts: 1588755599865, connId: ODk0Mm[truncated], reason: PLAYER_STATE_CHANGED}
May 06 11:00:01 raspi-server java[12613]: 2020-05-06 11:00:01,014 DEBUG EventService:48 - Event sent. {body: 12|37|15|8942de66cd50d8975d5d39bb67e4d848c792fb7d|012b3d9be6dd2f407eb0f3e758b2346b|00000000000000000000000000000000|playlist|fwdbtn|playlist|endplay|0|0|382|382|0|0|0|0|0|1|8|0|-1|context|426|0|0|0|0|0|382|382|0|0|spotify:playlist:37i9dQZF1DXdxcBWuJkbcy||f41ffe564e4f426d88740ce70ba661b9||0|1588755563641|0|context|your-library|8.5.56.1186|com.spotify|none|none|422307f82d79a8f76a4f795002fe9c3ac0294a7e|na|none, result: 200}
May 06 11:00:01 raspi-server java[12613]: 2020-05-06 11:00:01,315 DEBUG EventService:48 - Event sent. {body: 10|20|55c462564cca2f379aa5399e96fb8751ea483a8b|012b3d9be6dd2f407eb0f3e758b2346b|0|0|0|0|0|0|0|0|music|-1|-1|-1|-1.000000|-1|-1.000000|-1|-1|-1|-1.000000|-1|-1|-1|-1|-1.000000|-1|0.000000|-1.000000|||unknown|0|0|0|0|0|interactive|0|0|0|0, result: 200}
May 06 11:00:01 raspi-server java[12613]: 2020-05-06 11:00:01,613 DEBUG EventService:48 - Event sent. {body: 372|1|012b3d9be6dd2f407eb0f3e758b2346b|spotify:track:7qEKqBCD2vE5vIBsrUitpD|0|[[8,382]], result: 200}
May 06 11:00:20 raspi-server java[12613]: 2020-05-06 11:00:20,769 DEBUG ZeroconfServer:288 - Dropped connection attempt because user is already connected. {username: myusername}
May 06 11:00:22 raspi-server java[12613]: 2020-05-06 11:00:22,825 DEBUG ZeroconfServer:288 - Dropped connection attempt because user is already connected. {username: myusername}
May 06 11:01:50 raspi-server java[12613]: 2020-05-06 11:01:50,783 DEBUG ZeroconfServer:288 - Dropped connection attempt because user is already connected. {username: myusername}
May 06 11:01:52 raspi-server java[12613]: 2020-05-06 11:01:52,876 DEBUG ZeroconfServer:288 - Dropped connection attempt because user is already connected. {username: myusername}
May 06 11:02:04 raspi-server java[12613]: 2020-05-06 11:02:04,654 DEBUG ZeroconfServer:288 - Dropped connection attempt because user is already connected. {username: myusername}
May 06 11:02:06 raspi-server java[12613]: 2020-05-06 11:02:06,735 DEBUG ZeroconfServer:288 - Dropped connection attempt because user is already connected. {username: myusername}
Version/Commit
just compiled 8ba96df
Edit: Know I see that there are some exisiting issues on this, but at least they are all closed so this should be kinda new: #134 (comment) #210
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working