[GH-ISSUE #591] Handling of probably corrupt cache files #372

Closed
opened 2026-02-27 19:30:16 +03:00 by kerem · 1 comment
Owner

Originally created by @Johannesd3 on GitHub (Feb 1, 2021).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/591

Recently, a file in cache was corrupt, and when I tried to play this song a thread panicked. Only after deleting the cache I was able to play this track. Here's the log/backtrace:

[2021-02-01T21:23:58Z INFO  librespot_playback::player] Loading <Nobody Home - 2011 Remastered Version> with Spotify URI <spotify:track:3kM50GD76NgPWaTfKKKTz3>
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: OggError(NoCapturePatternFound)', playback/src/player.rs:718:58
stack backtrace:
   0:     0x55b3e71fffa0 - std::backtrace_rs::backtrace::libunwind::trace::h04d12fdcddff82aa
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
   1:     0x55b3e71fffa0 - std::backtrace_rs::backtrace::trace_unsynchronized::h1459b974b6fbe5e1
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55b3e71fffa0 - std::sys_common::backtrace::_print_fmt::h9b8396a669123d95
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x55b3e71fffa0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he009dcaaa75eed60
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x55b3e722806c - core::fmt::write::h77b4746b0dea1dd3
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/fmt/mod.rs:1078:17
   5:     0x55b3e71f8642 - std::io::Write::write_fmt::heb7e50902e98831c
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/mod.rs:1518:15
   6:     0x55b3e7202b55 - std::sys_common::backtrace::_print::h2d880c9e69a21be9
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x55b3e7202b55 - std::sys_common::backtrace::print::h5f02b1bb49f36879
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x55b3e7202b55 - std::panicking::default_hook::{{closure}}::h658e288a7a809b29
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:208:50
   9:     0x55b3e72027f8 - std::panicking::default_hook::hb52d73f0da9a4bb8
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:227:9
  10:     0x55b3e72032f1 - std::panicking::rust_panic_with_hook::hfe7e1c684e3e6462
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:593:17
  11:     0x55b3e7202e37 - std::panicking::begin_panic_handler::{{closure}}::h42939e004b32765c
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:499:13
  12:     0x55b3e720045c - std::sys_common::backtrace::__rust_end_short_backtrace::h9d2070f7bf9fd56c
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x55b3e7202d99 - rust_begin_unwind
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
  14:     0x55b3e7225571 - core::panicking::panic_fmt::ha0bb065d9a260792
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14
  15:     0x55b3e7225393 - core::option::expect_none_failed::h7e1dd0a94971eb61
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/option.rs:1268:5
  16:     0x55b3e67dee80 - core::result::Result<T,E>::unwrap::hc6c8ae10b601f170
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:973:23
  17:     0x55b3e67e8109 - librespot_playback::player::PlayerTrackLoader::load_track::hba8fdcba9d664190
                               at /home/me/librespot/playback/src/player.rs:718:27
  18:     0x55b3e67fadfc - librespot_playback::player::PlayerInternal::load_track::{{closure}}::h9ef49e3318157263
                               at /home/me/librespot/playback/src/player.rs:1554:13
  19:     0x55b3e680efe2 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf8e21b58417867d7
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:125:18
  20:     0x55b3e67fcdc1 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h01b620f7c1de514f
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:474:17
  21:     0x55b3e6803ad1 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h37d024a3d41f8ad3
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:322:9
  22:     0x55b3e68213f2 - std::panicking::try::do_call::h37629ade0ae941e7
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:381:40
  23:     0x55b3e68214ad - __rust_try
  24:     0x55b3e6821314 - std::panicking::try::hd0c2159e0d59acad
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:345:19
  25:     0x55b3e6803b13 - std::panic::catch_unwind::h9ca1f6d06002a68b
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:396:14
  26:     0x55b3e67fcb88 - std::thread::Builder::spawn_unchecked::{{closure}}::hcf36df7fcee39c7a
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:473:30
  27:     0x55b3e67fe62f - core::ops::function::FnOnce::call_once{{vtable.shim}}::h68be8ac9b47139c3
                               at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
  28:     0x55b3e720b15a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h09ff301006f1aeca
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/boxed.rs:1307:9
  29:     0x55b3e720b15a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he79488c8f00b5f31
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/boxed.rs:1307:9
  30:     0x55b3e720b15a - std::sys::unix::thread::Thread::new::thread_start::h587efff279c68ba7
                               at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys/unix/thread.rs:71:17
  31:     0x7f9e6956f609 - start_thread
  32:     0x7f9e69345293 - clone
  33:                0x0 - <unknown>
[2021-02-01T21:23:58Z WARN  librespot_playback::player] Unable to load <SpotifyId { id: 145657504029950143855752042603193027145, audio_type: Track }>
    Skipping to next track

I was able to reproduce the error by writing some garbage to the beginning of a cache file and trying to play the corresponding track.

I would expect that librespot in this situation

  1. shows a nicer error message
  2. and tries to download the track instead.
Originally created by @Johannesd3 on GitHub (Feb 1, 2021). Original GitHub issue: https://github.com/librespot-org/librespot/issues/591 Recently, a file in cache was corrupt, and when I tried to play this song a thread panicked. Only after deleting the cache I was able to play this track. Here's the log/backtrace: ``` [2021-02-01T21:23:58Z INFO librespot_playback::player] Loading <Nobody Home - 2011 Remastered Version> with Spotify URI <spotify:track:3kM50GD76NgPWaTfKKKTz3> thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: OggError(NoCapturePatternFound)', playback/src/player.rs:718:58 stack backtrace: 0: 0x55b3e71fffa0 - std::backtrace_rs::backtrace::libunwind::trace::h04d12fdcddff82aa at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5 1: 0x55b3e71fffa0 - std::backtrace_rs::backtrace::trace_unsynchronized::h1459b974b6fbe5e1 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x55b3e71fffa0 - std::sys_common::backtrace::_print_fmt::h9b8396a669123d95 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:67:5 3: 0x55b3e71fffa0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he009dcaaa75eed60 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:46:22 4: 0x55b3e722806c - core::fmt::write::h77b4746b0dea1dd3 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/fmt/mod.rs:1078:17 5: 0x55b3e71f8642 - std::io::Write::write_fmt::heb7e50902e98831c at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/mod.rs:1518:15 6: 0x55b3e7202b55 - std::sys_common::backtrace::_print::h2d880c9e69a21be9 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:49:5 7: 0x55b3e7202b55 - std::sys_common::backtrace::print::h5f02b1bb49f36879 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:36:9 8: 0x55b3e7202b55 - std::panicking::default_hook::{{closure}}::h658e288a7a809b29 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:208:50 9: 0x55b3e72027f8 - std::panicking::default_hook::hb52d73f0da9a4bb8 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:227:9 10: 0x55b3e72032f1 - std::panicking::rust_panic_with_hook::hfe7e1c684e3e6462 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:593:17 11: 0x55b3e7202e37 - std::panicking::begin_panic_handler::{{closure}}::h42939e004b32765c at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:499:13 12: 0x55b3e720045c - std::sys_common::backtrace::__rust_end_short_backtrace::h9d2070f7bf9fd56c at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys_common/backtrace.rs:141:18 13: 0x55b3e7202d99 - rust_begin_unwind at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5 14: 0x55b3e7225571 - core::panicking::panic_fmt::ha0bb065d9a260792 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14 15: 0x55b3e7225393 - core::option::expect_none_failed::h7e1dd0a94971eb61 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/option.rs:1268:5 16: 0x55b3e67dee80 - core::result::Result<T,E>::unwrap::hc6c8ae10b601f170 at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:973:23 17: 0x55b3e67e8109 - librespot_playback::player::PlayerTrackLoader::load_track::hba8fdcba9d664190 at /home/me/librespot/playback/src/player.rs:718:27 18: 0x55b3e67fadfc - librespot_playback::player::PlayerInternal::load_track::{{closure}}::h9ef49e3318157263 at /home/me/librespot/playback/src/player.rs:1554:13 19: 0x55b3e680efe2 - std::sys_common::backtrace::__rust_begin_short_backtrace::hf8e21b58417867d7 at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:125:18 20: 0x55b3e67fcdc1 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h01b620f7c1de514f at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:474:17 21: 0x55b3e6803ad1 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h37d024a3d41f8ad3 at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:322:9 22: 0x55b3e68213f2 - std::panicking::try::do_call::h37629ade0ae941e7 at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:381:40 23: 0x55b3e68214ad - __rust_try 24: 0x55b3e6821314 - std::panicking::try::hd0c2159e0d59acad at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:345:19 25: 0x55b3e6803b13 - std::panic::catch_unwind::h9ca1f6d06002a68b at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:396:14 26: 0x55b3e67fcb88 - std::thread::Builder::spawn_unchecked::{{closure}}::hcf36df7fcee39c7a at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:473:30 27: 0x55b3e67fe62f - core::ops::function::FnOnce::call_once{{vtable.shim}}::h68be8ac9b47139c3 at /home/me/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5 28: 0x55b3e720b15a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h09ff301006f1aeca at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/boxed.rs:1307:9 29: 0x55b3e720b15a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he79488c8f00b5f31 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/alloc/src/boxed.rs:1307:9 30: 0x55b3e720b15a - std::sys::unix::thread::Thread::new::thread_start::h587efff279c68ba7 at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/sys/unix/thread.rs:71:17 31: 0x7f9e6956f609 - start_thread 32: 0x7f9e69345293 - clone 33: 0x0 - <unknown> [2021-02-01T21:23:58Z WARN librespot_playback::player] Unable to load <SpotifyId { id: 145657504029950143855752042603193027145, audio_type: Track }> Skipping to next track ``` I was able to reproduce the error by writing some garbage to the beginning of a cache file and trying to play the corresponding track. I would expect that librespot in this situation 1. shows a nicer error message 2. and tries to download the track instead.
kerem closed this issue 2026-02-27 19:30:16 +03:00
Author
Owner

@Johannesd3 commented on GitHub (Feb 1, 2021):

I would create a PR. But it includes modifying the cache and I don't want merge conflicts with myself, so I'd like to wait for #582.

<!-- gh-comment-id:771221024 --> @Johannesd3 commented on GitHub (Feb 1, 2021): I would create a PR. But it includes modifying the cache and I don't want merge conflicts with myself, so I'd like to wait for #582.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#372
No description provided.