Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic: index out of bounds: the len is 0 but the index is 0 #106

Closed
joerg-krause opened this issue Jul 31, 2016 · 2 comments
Closed

Panic: index out of bounds: the len is 0 but the index is 0 #106

joerg-krause opened this issue Jul 31, 2016 · 2 comments
Labels

Comments

@joerg-krause
Copy link
Contributor

joerg-krause commented Jul 31, 2016

Running latest librespot sometimes crash when connecting to the device with the official Spotify desktop client (Spotify version 1.0.32.96.g3c8a06e6, Copyright (c) 2016, Spotify Ltd).

[joerg@nzxt librespot]$ RUST_BACKTRACE=1 target/release/librespot -n Desktop --backend pulseaudio
INFO:librespot::main_helper: librespot 5388565 (2016-07-22). Built on 2016-07-31.
INFO:librespot::main_helper: No username provided and no stored credentials, starting discovery ...
WARN:mdns::fsm: couldn't parse packet from V4(192.168.178.46:5353): class 32769 is invalid
DEBUG:librespot::authentication::discovery: Get "/?action=getInfo" {"action": "getInfo"}
DEBUG:librespot::authentication::discovery: Get "/?action=getInfo" {"action": "getInfo"}
DEBUG:librespot::authentication::discovery: Post "/" {"action": "addUser", "blob": "9DR+aUgAXTrSb40qFz/aoVHgNSi41dvNeNomXXW8y0ki2Y6HvsERCANa4AnzxYR0HpZIxoUBibGJUPMIeslXyH6c8sYZM2N7UZFfRG3lmHgIA4ohP8kkZzW8DW9ots1a/OgD9w==", "clientKey": "AUpe7UCv5+mtcQ4hzVytyV2WXGv2zhdJLB64ATS8vst81MwuuZvYejDbqAm7QD66y16jWxGqWmK9MO6MBgvH++3HJyPbJxsqc4w0z5uQKiQlSmbL8hMW3tBkfw7t1v64", "deviceId": "2b2d707a6f6c93c06f97867d5752c01cbd314ce0", "deviceName": "nzxt", "loginId": "b8708f103510272e0b4c09bc7a83e824", "userName": "joerg-krause"}
INFO:librespot::session: Connecting to AP lon3-accesspoint-a6.ap.spotify.com:443
INFO:librespot::session: Authenticated !
DEBUG:librespot::audio_backend::pulseaudio: Using PulseAudio sink
DEBUG:librespot::spirc: kMessageTypeHello "Desktop" 532c67fe1b5afae15d2d08fba7a78de0f63cc4b5 1 1469969488891
DEBUG:librespot::spirc: kMessageTypeNotify "nzxt" 2b2d707a6f6c93c06f97867d5752c01cbd314ce0 1 0
DEBUG:librespot::spirc: kMessageTypeLoad "nzxt" 2b2d707a6f6c93c06f97867d5752c01cbd314ce0 2 0
thread '<unnamed>' panicked at 'index out of bounds: the len is 0 but the index is 0', ../src/libcollections/vec.rs:1246
stack backtrace:
   1:     0x55ba690d9c6f - std::sys::backtrace::tracing::imp::write::h29f5fdb9fc0a7395
   2:     0x55ba690de80b - std::panicking::default_hook::_{{closure}}::h2cc84f0378700526
   3:     0x55ba690dd9f5 - std::panicking::default_hook::hbbe7fa36a995aca0
   4:     0x55ba690ddffe - std::panicking::rust_panic_with_hook::h105c3d42fcd2fb5e
   5:     0x55ba690dde61 - std::panicking::begin_panic::hbf62ea4a5ff3f9de
   6:     0x55ba690ddd8a - std::panicking::begin_panic_fmt::h20f5943904e5791d
   7:     0x55ba690ddcfe - rust_begin_unwind
   8:     0x55ba69118b4f - core::panicking::panic_fmt::h19323e466869c656
   9:     0x55ba69118af2 - core::panicking::panic_bounds_check::ha883fe1527ce6884
  10:     0x55ba68e23b1d - librespot::spirc::SpircManager::run::h915a765a6c3ffa25
  11:     0x55ba68d4e12b - std::panicking::try::call::hdc8e35d6c115351f
  12:     0x55ba690e6396 - __rust_maybe_catch_panic
  13:     0x55ba68d52e07 - _<F as alloc..boxed..FnBox<A>>::call_box::h85d6926563366f2d
  14:     0x55ba690dc544 - std::sys::thread::Thread::new::thread_start::h8f3bd45211e9f5ea
  15:     0x7f2d1c555483 - start_thread
  16:     0x7f2d1cd866dc - clone
  17:                0x0 - <unknown>
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', ../src/libcore/result.rs:788
stack backtrace:
   1:     0x55ba690d9c6f - std::sys::backtrace::tracing::imp::write::h29f5fdb9fc0a7395
   2:     0x55ba690de80b - std::panicking::default_hook::_{{closure}}::h2cc84f0378700526
   3:     0x55ba690dd9f5 - std::panicking::default_hook::hbbe7fa36a995aca0
   4:     0x55ba690ddffe - std::panicking::rust_panic_with_hook::h105c3d42fcd2fb5e
   5:     0x55ba690dde61 - std::panicking::begin_panic::hbf62ea4a5ff3f9de
   6:     0x55ba690ddd8a - std::panicking::begin_panic_fmt::h20f5943904e5791d
   7:     0x55ba690ddcfe - rust_begin_unwind
   8:     0x55ba69118b4f - core::panicking::panic_fmt::h19323e466869c656
   9:     0x55ba68da9e7d - core::result::unwrap_failed::h9d665ebb0f2c6724
  10:     0x55ba68e0fddf - librespot::player::PlayerInternal::run::h0b3e74fd404db001
  11:     0x55ba68d8a2c9 - std::panicking::try::call::h313344cf7abfc55c
  12:     0x55ba690e6396 - __rust_maybe_catch_panic
  13:     0x55ba68dbe2c5 - _<F as alloc..boxed..FnBox<A>>::call_box::hb87e9d8ded216cda
  14:     0x55ba690dc544 - std::sys::thread::Thread::new::thread_start::h8f3bd45211e9f5ea
  15:     0x7f2d1c555483 - start_thread
  16:     0x7f2d1cd866dc - clone
  17:                0x0 - <unknown>
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', ../src/libcore/result.rs:788
stack backtrace:
   1:     0x55ba690d9c6f - std::sys::backtrace::tracing::imp::write::h29f5fdb9fc0a7395
   2:     0x55ba690de80b - std::panicking::default_hook::_{{closure}}::h2cc84f0378700526
   3:     0x55ba690dd9f5 - std::panicking::default_hook::hbbe7fa36a995aca0
   4:     0x55ba690ddffe - std::panicking::rust_panic_with_hook::h105c3d42fcd2fb5e
   5:     0x55ba690dde61 - std::panicking::begin_panic::hbf62ea4a5ff3f9de
   6:     0x55ba690ddd8a - std::panicking::begin_panic_fmt::h20f5943904e5791d
   7:     0x55ba690ddcfe - rust_begin_unwind
   8:     0x55ba69118b4f - core::panicking::panic_fmt::h19323e466869c656
   9:     0x55ba68da9fc4 - core::result::unwrap_failed::hafef74ad5c6462b9
  10:     0x55ba68e05faa - librespot::mercury::MercuryManager::complete_request::h6be47c826ea1ea33
  11:     0x55ba68e07332 - _<librespot..mercury..MercuryManager as librespot..session..PacketHandler>::handle::hd64808e03aeb80de
  12:     0x55ba68e1add9 - librespot::session::Session::poll::ha7c2b664c9f26a0d
  13:     0x55ba68d56a17 - librespot::main::h4c8ffcc1bb2b23f0
  14:     0x55ba690ddc78 - std::panicking::try::call::h5df3ac2979db3c90
  15:     0x55ba690e6396 - __rust_maybe_catch_panic
  16:     0x55ba690dd06e - std::rt::lang_start::hfe9ab243c60ffb9b
  17:     0x7f2d1ccbf740 - __libc_start_main
  18:     0x55ba68d4bde8 - _start
  19:                0x0 - <unknown>
@plietar plietar added the bug label Aug 1, 2016
@plietar
Copy link
Owner

plietar commented Aug 1, 2016

Probably a duplicate of #71
Does it happen when you select the device but no songs are active in the client ?

This is cause by this line :
https://github.com/plietar/librespot/blob/master/src/spirc.rs#L214

The code should take into account the case where an empty list of tracks is received

@joerg-krause
Copy link
Contributor Author

Does it happen when you select the device but no songs are active in the client ?

Yes, it happens if the queue is empty. If I add songs to the queue before I select the device running librespot it works.

As it looks like this in a duplicate of #71 I'll close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants