Skip to content

CacheJournal - IllegalStateException on device selection #201

@LanderN

Description

@LanderN

Describe the bug
When playing a certain song, librespot-java throws an error and is unable to recover until restarted.

To Reproduce
Start librespot-java with TRACE logging, logged in with USER_PASS (not sure if this matters). In Spotify Client (tested on Linux and Android), while spotify:track:7BKLCZ1jbUBVqRi2FVlTVw (Closer by The Chainsmokers) is playing, select "librespot-java".

Expected behavior
Playback switches to librespot-java and song continues playing there.

Screenshots/Stracktraces/Logs
librespot-java device connects, but song does not start playing, progress bar stops progressing and librespot prints this error:

Exception in thread "player-runner-looper-255944888" java.lang.IllegalStateException
        at xyz.gianlu.librespot.cache.CacheJournal$Entry.setHeader(CacheJournal.java:277)
        at xyz.gianlu.librespot.cache.CacheJournal.setHeader(CacheJournal.java:112)
        at xyz.gianlu.librespot.cache.CacheManager$Handler.updateTimestamp(CacheManager.java:156)
        at xyz.gianlu.librespot.cache.CacheManager$Handler.readChunk(CacheManager.java:197)
        at xyz.gianlu.librespot.player.feeders.cdn.CdnManager$Streamer.<init>(CdnManager.java:230)
        at xyz.gianlu.librespot.player.feeders.cdn.CdnManager$Streamer.<init>(CdnManager.java:186)
        at xyz.gianlu.librespot.player.feeders.cdn.CdnManager.streamFile(CdnManager.java:67)
        at xyz.gianlu.librespot.player.feeders.cdn.CdnFeedHelper.loadTrack(CdnFeedHelper.java:36)
        at xyz.gianlu.librespot.player.feeders.cdn.CdnFeedHelper.loadTrack(CdnFeedHelper.java:44)
        at xyz.gianlu.librespot.player.feeders.PlayableContentFeeder.loadStream(PlayableContentFeeder.java:104)
        at xyz.gianlu.librespot.player.feeders.PlayableContentFeeder.loadTrack(PlayableContentFeeder.java:136)
        at xyz.gianlu.librespot.player.feeders.PlayableContentFeeder.loadTrack(PlayableContentFeeder.java:88)
        at xyz.gianlu.librespot.player.feeders.PlayableContentFeeder.load(PlayableContentFeeder.java:60)
        at xyz.gianlu.librespot.player.PlayerRunner$TrackHandler.load(PlayerRunner.java:583)
        at xyz.gianlu.librespot.player.PlayerRunner$TrackHandler.access$800(PlayerRunner.java:520)
        at xyz.gianlu.librespot.player.PlayerRunner$Looper.run(PlayerRunner.java:427)
        at java.lang.Thread.run(Thread.java:748)

librespot-java does not become functional anymore after this.
Further investigation shows that the id field in void setHeader(byte id, @NotNull String value) contains value -1.

Version/Commit
v1.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions