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

librespot crashes if the local system is using systemd-resolved instead of avahi #824

Closed
WhyNotHugo opened this issue Jul 23, 2021 · 11 comments

Comments

@WhyNotHugo
Copy link
Contributor

I'm currently using systemd-resolved for mDNS rather than avahi, and librespot flat out crashes when starting.

$ /usr/bin/librespot --name hugo@victory --backend pulseaudio
[2021-07-23T09:08:51Z INFO  librespot] librespot 0.2.0 5fcb7c7 (Built on 2021-06-20, Build ID: mmhvhIU3)
*** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DNSError(Unknown)', connect/src/discovery.rs:237:6
stack backtrace:
   0:     0x5587962beb60 - <unknown>
   1:     0x5587962e6a2c - <unknown>
   2:     0x5587962b7102 - <unknown>
   3:     0x5587962c1365 - <unknown>
   4:     0x5587962c1008 - <unknown>
   5:     0x5587962c1b01 - <unknown>
   6:     0x5587962c1647 - <unknown>
   7:     0x5587962bf01c - <unknown>
   8:     0x5587962c15a9 - <unknown>
   9:     0x5587962e3f31 - <unknown>
  10:     0x5587962e3d53 - <unknown>
  11:     0x558795f6fa30 - <unknown>
  12:     0x558795efff9f - <unknown>
  13:     0x558795ed0ad7 - <unknown>
  14:     0x558795e9edce - <unknown>
  15:     0x558795ec060d - <unknown>
  16:     0x558795effa90 - <unknown>
  17:     0x558795ecadb3 - <unknown>
  18:     0x558795f3c559 - <unknown>
  19:     0x5587962c2017 - <unknown>
  20:     0x558795f02b12 - main
  21:     0x7f4d8bdebb25 - __libc_start_main
  22:     0x558795e9408e - <unknown>
  23:                0x0 - <unknown>

This happens with the latest stable release. I tried building from source, but it seems pulseaudio won't work in that case for some reason:

$ cargo run -- --name hugo@victory --backend pulseaudio
    Finished dev [unoptimized + debuginfo] target(s) in 0.56s
     Running `target/debug/librespot --name 'hugo@victory' --backend pulseaudio`
[2021-07-23T09:17:04Z INFO  librespot] librespot 0.2.0 68bec41 (Built on 2021-07-23, Build ID: gzUIzPf7)
thread 'main' panicked at 'Invalid backend', src/main.rs:443:53
stack backtrace:
   0:     0x558f18d58f60 - std::backtrace_rs::backtrace::libunwind::trace::ha5edb8ba5c6b7a6c
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x558f18d58f60 - std::backtrace_rs::backtrace::trace_unsynchronized::h0de86d320a827db2
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x558f18d58f60 - std::sys_common::backtrace::_print_fmt::h97b9ad6f0a1380ff
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x558f18d58f60 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h14be7eb08f97fe80
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x558f18d800ef - core::fmt::write::h2ca8877d3e0e52de
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/fmt/mod.rs:1094:17
   5:     0x558f18d52955 - std::io::Write::write_fmt::h64f5987220b618f4
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/io/mod.rs:1584:15
   6:     0x558f18d5b30b - std::sys_common::backtrace::_print::h7f1a4097308f2e0a
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x558f18d5b30b - std::sys_common::backtrace::print::h1f799fc2ca7f5035
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x558f18d5b30b - std::panicking::default_hook::{{closure}}::hf38436e8a3ce1071
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:208:50
   9:     0x558f18d5addd - std::panicking::default_hook::he2f8f3fae11ed1dd
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:225:9
  10:     0x558f18d5b91d - std::panicking::rust_panic_with_hook::h79a18548bd90c7d4
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:591:17
  11:     0x558f18d5b4b7 - std::panicking::begin_panic_handler::{{closure}}::h212a72cc08e25126
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:497:13
  12:     0x558f18d593fc - std::sys_common::backtrace::__rust_end_short_backtrace::hbd6897dd42bc0fcd
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x558f18d5b419 - rust_begin_unwind
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
  14:     0x558f1811f7b1 - core::panicking::panic_fmt::h77ecd04e9b1dd84d
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
  15:     0x558f1811f6a3 - core::option::expect_failed::h128888968e00dc4d
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/option.rs:1241:5
  16:     0x558f18185f0c - core::option::Option<T>::expect::h0dc78cfd67368d23
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/option.rs:349:21
  17:     0x558f18225ce4 - librespot::get_setup::h7574325d653a7739
                               at /home/hugo/clones/github.com/librespot-org/librespot/src/main.rs:443:19
  18:     0x558f1822c388 - librespot::main::{{closure}}::h72458fea01c6b6a0
                               at /home/hugo/clones/github.com/librespot-org/librespot/src/main.rs:768:17
  19:     0x558f181a995b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h3a67f85e95308f79
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/future/mod.rs:80:19
  20:     0x558f181683df - <core::pin::Pin<P> as core::future::future::Future>::poll::h2b9b42b7a1323a8a
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/future/future.rs:120:9
  21:     0x558f181a0260 - tokio::runtime::basic_scheduler::Inner<P>::block_on::{{closure}}::{{closure}}::h2e24aa3b0edd85ea
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:213:62
  22:     0x558f181bc48c - tokio::coop::with_budget::{{closure}}::he53b2f9e61dfc40b
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/coop.rs:106:9
  23:     0x558f181dc4ac - std::thread::local::LocalKey<T>::try_with::h84799888ad741abe
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/thread/local.rs:376:16
  24:     0x558f181dc12d - std::thread::local::LocalKey<T>::with::hcb7de8525477c17b
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/thread/local.rs:352:9
  25:     0x558f1819f9d5 - tokio::coop::with_budget::h078510306ef5ad91
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/coop.rs:99:5
  26:     0x558f1819f9d5 - tokio::coop::budget::h2eb0bc7e16c29250
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/coop.rs:76:5
  27:     0x558f1819f9d5 - tokio::runtime::basic_scheduler::Inner<P>::block_on::{{closure}}::hc645301b60bc20ce
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:213:39
  28:     0x558f181a0c51 - tokio::runtime::basic_scheduler::enter::{{closure}}::h4af901605e9e3b6f
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:323:29
  29:     0x558f1819f67d - tokio::macros::scoped_tls::ScopedKey<T>::set::h3e28b875da943dfb
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/macros/scoped_tls.rs:61:9
  30:     0x558f181a0b38 - tokio::runtime::basic_scheduler::enter::h68680e59f4a2b16d
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:323:5
  31:     0x558f1819f74b - tokio::runtime::basic_scheduler::Inner<P>::block_on::had7d30b626557c8c
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:202:9
  32:     0x558f181a03e3 - tokio::runtime::basic_scheduler::InnerGuard<P>::block_on::hf5c747a1e028721a
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:516:9
  33:     0x558f181a04da - tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on::h865bba4ff9e81654
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:162:24
  34:     0x558f18139075 - tokio::runtime::Runtime::block_on::h32c24b2f0a9805e7
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/mod.rs:450:46
  35:     0x558f18229ee6 - librespot::main::h531bb5a0a2e729f6
                               at /home/hugo/clones/github.com/librespot-org/librespot/src/main.rs:943:5
  36:     0x558f18233e1b - core::ops::function::FnOnce::call_once::h60fd69860cfcf61b
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/ops/function.rs:227:5
  37:     0x558f182332de - std::sys_common::backtrace::__rust_begin_short_backtrace::h4a44b672b5a669a0
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:125:18
  38:     0x558f181b6e71 - std::rt::lang_start::{{closure}}::he1ffa728e2400b74
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/rt.rs:49:18
  39:     0x558f18d5be1a - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hc4354216bf39217c
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/ops/function.rs:259:13
  40:     0x558f18d5be1a - std::panicking::try::do_call::hb68eb312780385cf
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:379:40
  41:     0x558f18d5be1a - std::panicking::try::h22b8e08595060b8b
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:343:19
  42:     0x558f18d5be1a - std::panic::catch_unwind::hc64f1a6a0e71b1fc
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panic.rs:431:14
  43:     0x558f18d5be1a - std::rt::lang_start_internal::h4461fc58637f04f8
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/rt.rs:34:21
  44:     0x558f181b6e50 - std::rt::lang_start::h5995c811881640df
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/rt.rs:48:5
  45:     0x558f1823056c - main
  46:     0x7fa601fc8b25 - __libc_start_main
  47:     0x558f1811ff4e - _start
  48:                0x0 - <unknown>

I've noticed that now rodio seems to be used as a backend, and not pulseaudio, however, that default backend assumes alsa. As hinted above, I'm using pulseaudio, not alsa:

$ cargo run -- --name hugo@victory
    Finished dev [unoptimized + debuginfo] target(s) in 0.49s
     Running `target/debug/librespot --name 'hugo@victory'`
[2021-07-23T09:20:55Z INFO  librespot] librespot 0.2.0 68bec41 (Built on 2021-07-23, Build ID: gzUIzPf7)
[2021-07-23T09:21:15Z INFO  librespot_core::session] Connecting to AP "gew1-accesspoint-a-723t.ap.spotify.com:4070"
[2021-07-23T09:21:15Z INFO  librespot_core::session] Authenticated as "138rlsckfdsj6jdnpgbegyd70" !
[2021-07-23T09:21:15Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
[2021-07-23T09:21:15Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2021-07-23T09:21:15Z INFO  librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA
[2021-07-23T09:21:15Z INFO  librespot_playback::audio_backend::rodio] Using audio device: default
[2021-07-23T09:21:15Z INFO  librespot_core::session] Country: "AR"
ALSA lib pcm_dmix.c:1035:(snd_pcm_dmix_open) unable to open slave
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: StreamError(DefaultStreamConfigError(DeviceNotAvailable))', playback/src/audio_backend/rodio.rs:167:53
stack backtrace:
   0:     0x55f12c0fff60 - std::backtrace_rs::backtrace::libunwind::trace::ha5edb8ba5c6b7a6c
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x55f12c0fff60 - std::backtrace_rs::backtrace::trace_unsynchronized::h0de86d320a827db2
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55f12c0fff60 - std::sys_common::backtrace::_print_fmt::h97b9ad6f0a1380ff
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x55f12c0fff60 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h14be7eb08f97fe80
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x55f12c1270ef - core::fmt::write::h2ca8877d3e0e52de
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/fmt/mod.rs:1094:17
   5:     0x55f12c0f9955 - std::io::Write::write_fmt::h64f5987220b618f4
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/io/mod.rs:1584:15
   6:     0x55f12c10230b - std::sys_common::backtrace::_print::h7f1a4097308f2e0a
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x55f12c10230b - std::sys_common::backtrace::print::h1f799fc2ca7f5035
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x55f12c10230b - std::panicking::default_hook::{{closure}}::hf38436e8a3ce1071
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:208:50
   9:     0x55f12c101ddd - std::panicking::default_hook::he2f8f3fae11ed1dd
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:225:9
  10:     0x55f12c10291d - std::panicking::rust_panic_with_hook::h79a18548bd90c7d4
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:591:17
  11:     0x55f12c1024b7 - std::panicking::begin_panic_handler::{{closure}}::h212a72cc08e25126
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:497:13
  12:     0x55f12c1003fc - std::sys_common::backtrace::__rust_end_short_backtrace::hbd6897dd42bc0fcd
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x55f12c102419 - rust_begin_unwind
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
  14:     0x55f12b4c67b1 - core::panicking::panic_fmt::h77ecd04e9b1dd84d
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
  15:     0x55f12b4c68a3 - core::result::unwrap_failed::hcbdf25d28ce8f0ca
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/result.rs:1355:5
  16:     0x55f12b7b2a97 - core::result::Result<T,E>::unwrap::h7cc7095eff8465eb
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/result.rs:1037:23
  17:     0x55f12b79b290 - librespot_playback::audio_backend::rodio::open::hd709abd64f1af903
                               at /home/hugo/clones/github.com/librespot-org/librespot/playback/src/audio_backend/rodio.rs:167:26
  18:     0x55f12b798132 - librespot_playback::audio_backend::rodio::mk_rodio::h784a17b26ce56278
                               at /home/hugo/clones/github.com/librespot-org/librespot/playback/src/audio_backend/rodio.rs:22:14
  19:     0x55f12b5d1fb0 - librespot::main::{{closure}}::{{closure}}::h10270616e2bce49b
                               at /home/hugo/clones/github.com/librespot-org/librespot/src/main.rs:844:29
  20:     0x55f12b582413 - librespot_playback::player::Player::new::{{closure}}::hb49d8dd803a94c76
                               at /home/hugo/clones/github.com/librespot-org/librespot/playback/src/player.rs:317:23
  21:     0x55f12b5da333 - std::sys_common::backtrace::__rust_begin_short_backtrace::hea27da2debf70e1f
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:125:18
  22:     0x55f12b52924f - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h5cc55531417c8817
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/thread/mod.rs:481:17
  23:     0x55f12b57cf83 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h9e9eb4bafe568f49
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panic.rs:344:9
  24:     0x55f12b4f8fc0 - std::panicking::try::do_call::h80b372de980640d2
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:379:40
  25:     0x55f12b4feded - __rust_try
  26:     0x55f12b4f8107 - std::panicking::try::h408e57d1d4b03f0e
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:343:19
  27:     0x55f12b582b73 - std::panic::catch_unwind::h1b8a32e586a79317
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panic.rs:431:14
  28:     0x55f12b52904f - std::thread::Builder::spawn_unchecked::{{closure}}::he7709321b57529b3
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/thread/mod.rs:480:30
  29:     0x55f12b5da88e - core::ops::function::FnOnce::call_once{{vtable.shim}}::h2e9c2bb49c618f35
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/ops/function.rs:227:5
  30:     0x55f12c10847a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h75c2ca1daad47228
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/alloc/src/boxed.rs:1546:9
  31:     0x55f12c10847a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdf9f8afc9d34e311
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/alloc/src/boxed.rs:1546:9
  32:     0x55f12c10847a - std::sys::unix::thread::Thread::new::thread_start::hc238bac7748b195d
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys/unix/thread.rs:71:17
  33:     0x7faae3d97259 - start_thread
  34:     0x7faae3b735e3 - __GI___clone
  35:                0x0 - <unknown>
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SendError(Play)', playback/src/player.rs:349:51
stack backtrace:
   0:     0x55f12c0fff60 - std::backtrace_rs::backtrace::libunwind::trace::ha5edb8ba5c6b7a6c
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x55f12c0fff60 - std::backtrace_rs::backtrace::trace_unsynchronized::h0de86d320a827db2
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55f12c0fff60 - std::sys_common::backtrace::_print_fmt::h97b9ad6f0a1380ff
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x55f12c0fff60 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h14be7eb08f97fe80
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x55f12c1270ef - core::fmt::write::h2ca8877d3e0e52de
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/fmt/mod.rs:1094:17
   5:     0x55f12c0f9955 - std::io::Write::write_fmt::h64f5987220b618f4
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/io/mod.rs:1584:15
   6:     0x55f12c10230b - std::sys_common::backtrace::_print::h7f1a4097308f2e0a
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x55f12c10230b - std::sys_common::backtrace::print::h1f799fc2ca7f5035
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x55f12c10230b - std::panicking::default_hook::{{closure}}::hf38436e8a3ce1071
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:208:50
   9:     0x55f12c101ddd - std::panicking::default_hook::he2f8f3fae11ed1dd
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:225:9
  10:     0x55f12c10291d - std::panicking::rust_panic_with_hook::h79a18548bd90c7d4
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:591:17
  11:     0x55f12c1024b7 - std::panicking::begin_panic_handler::{{closure}}::h212a72cc08e25126
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:497:13
  12:     0x55f12c1003fc - std::sys_common::backtrace::__rust_end_short_backtrace::hbd6897dd42bc0fcd
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:141:18
  13:     0x55f12c102419 - rust_begin_unwind
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
  14:     0x55f12b4c67b1 - core::panicking::panic_fmt::h77ecd04e9b1dd84d
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
  15:     0x55f12b4c68a3 - core::result::unwrap_failed::hcbdf25d28ce8f0ca
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/result.rs:1355:5
  16:     0x55f12b7b2fb0 - core::result::Result<T,E>::unwrap::heeda1f35aaaa731d
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/result.rs:1037:23
  17:     0x55f12b75aa4e - librespot_playback::player::Player::command::h7aa597725daf4785
                               at /home/hugo/clones/github.com/librespot-org/librespot/playback/src/player.rs:349:9
  18:     0x55f12b75aba8 - librespot_playback::player::Player::play::he52ff53c5d686c86
                               at /home/hugo/clones/github.com/librespot-org/librespot/playback/src/player.rs:369:9
  19:     0x55f12b666536 - librespot_connect::spirc::SpircTask::handle_play::h8c4d1a9012ceb11a
                               at /home/hugo/clones/github.com/librespot-org/librespot/connect/src/spirc.rs:756:17
  20:     0x55f12b6658d6 - librespot_connect::spirc::SpircTask::handle_frame::hb3908b31b107517b
                               at /home/hugo/clones/github.com/librespot-org/librespot/connect/src/spirc.rs:628:17
  21:     0x55f12b5c4884 - librespot_connect::spirc::SpircTask::run::{{closure}}::hfbc42be96357685d
                               at /home/hugo/clones/github.com/librespot-org/librespot/connect/src/spirc.rs:340:36
  22:     0x55f12b54ff2b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h0bb9390a71b13aa7
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/future/mod.rs:80:19
  23:     0x55f12b50f62f - <core::pin::Pin<P> as core::future::future::Future>::poll::h7c6e36336ecf7b1f
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/future/future.rs:120:9
  24:     0x55f12b50e422 - <&mut F as core::future::future::Future>::poll::h6b45ba3c67a56e0d
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/future/future.rs:108:9
  25:     0x55f12b5d1256 - librespot::main::{{closure}}::{{closure}}::hfcf0dbabb89f5449
                               at /home/hugo/clones/github.com/librespot-org/librespot/src/main.rs:877:25
  26:     0x55f12b55020b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h12e3469f2f1f85e2
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/future/mod.rs:80:19
  27:     0x55f12b5d1aa1 - librespot::main::{{closure}}::{{closure}}::hf04b02e5336e39eb
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/macros/select.rs:455:49
  28:     0x55f12b566cf8 - <tokio::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::hff88a9c6ffccad52
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/future/poll_fn.rs:38:9
  29:     0x55f12b5d3c91 - librespot::main::{{closure}}::h72458fea01c6b6a0
                               at /home/hugo/clones/github.com/librespot-org/librespot/src/main.rs:804:9
  30:     0x55f12b55095b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h3a67f85e95308f79
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/future/mod.rs:80:19
  31:     0x55f12b50f3df - <core::pin::Pin<P> as core::future::future::Future>::poll::h2b9b42b7a1323a8a
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/future/future.rs:120:9
  32:     0x55f12b547260 - tokio::runtime::basic_scheduler::Inner<P>::block_on::{{closure}}::{{closure}}::h2e24aa3b0edd85ea
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:213:62
  33:     0x55f12b56348c - tokio::coop::with_budget::{{closure}}::he53b2f9e61dfc40b
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/coop.rs:106:9
  34:     0x55f12b5834ac - std::thread::local::LocalKey<T>::try_with::h84799888ad741abe
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/thread/local.rs:376:16
  35:     0x55f12b58312d - std::thread::local::LocalKey<T>::with::hcb7de8525477c17b
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/thread/local.rs:352:9
  36:     0x55f12b5469d5 - tokio::coop::with_budget::h078510306ef5ad91
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/coop.rs:99:5
  37:     0x55f12b5469d5 - tokio::coop::budget::h2eb0bc7e16c29250
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/coop.rs:76:5
  38:     0x55f12b5469d5 - tokio::runtime::basic_scheduler::Inner<P>::block_on::{{closure}}::hc645301b60bc20ce
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:213:39
  39:     0x55f12b547c51 - tokio::runtime::basic_scheduler::enter::{{closure}}::h4af901605e9e3b6f
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:323:29
  40:     0x55f12b54667d - tokio::macros::scoped_tls::ScopedKey<T>::set::h3e28b875da943dfb
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/macros/scoped_tls.rs:61:9
  41:     0x55f12b547b38 - tokio::runtime::basic_scheduler::enter::h68680e59f4a2b16d
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:323:5
  42:     0x55f12b54674b - tokio::runtime::basic_scheduler::Inner<P>::block_on::had7d30b626557c8c
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:202:9
  43:     0x55f12b5473e3 - tokio::runtime::basic_scheduler::InnerGuard<P>::block_on::hf5c747a1e028721a
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:516:9
  44:     0x55f12b5474da - tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on::h865bba4ff9e81654
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/basic_scheduler.rs:162:24
  45:     0x55f12b4e0075 - tokio::runtime::Runtime::block_on::h32c24b2f0a9805e7
                               at /home/hugo/.cache/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.7.1/src/runtime/mod.rs:450:46
  46:     0x55f12b5d0ee6 - librespot::main::h531bb5a0a2e729f6
                               at /home/hugo/clones/github.com/librespot-org/librespot/src/main.rs:943:5
  47:     0x55f12b5dae1b - core::ops::function::FnOnce::call_once::h60fd69860cfcf61b
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/ops/function.rs:227:5
  48:     0x55f12b5da2de - std::sys_common::backtrace::__rust_begin_short_backtrace::h4a44b672b5a669a0
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/sys_common/backtrace.rs:125:18
  49:     0x55f12b55de71 - std::rt::lang_start::{{closure}}::he1ffa728e2400b74
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/rt.rs:49:18
  50:     0x55f12c102e1a - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hc4354216bf39217c
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/ops/function.rs:259:13
  51:     0x55f12c102e1a - std::panicking::try::do_call::hb68eb312780385cf
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:379:40
  52:     0x55f12c102e1a - std::panicking::try::h22b8e08595060b8b
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:343:19
  53:     0x55f12c102e1a - std::panic::catch_unwind::hc64f1a6a0e71b1fc
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panic.rs:431:14
  54:     0x55f12c102e1a - std::rt::lang_start_internal::h4461fc58637f04f8
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/rt.rs:34:21
  55:     0x55f12b55de50 - std::rt::lang_start::h5995c811881640df
                               at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/rt.rs:48:5
  56:     0x55f12b5d756c - main
  57:     0x7faae3a9cb25 - __libc_start_main
  58:     0x55f12b4c6f4e - _start
  59:                0x0 - <unknown>
[2021-07-23T09:21:17Z ERROR librespot_playback::player] Player thread panicked!

Any hints on how to work around any of these issues?

@kingosticks
Copy link
Contributor

kingosticks commented Jul 23, 2021

This happens with the latest stable release.

What features does this build have enabled?

How to compile with the pulseaudio feature enabled is explained at https://github.com/librespot-org/librespot/wiki/Compiling#features. That page also contains info about the with-dns-sd feature (EDIT: which it sounds like is enabled on your build and is why it's crashing).

@WhyNotHugo
Copy link
Contributor Author

What features does this build have enabled?

I'm using this package, which is basically built using the default.

How to compile with the pulseaudio feature enabled is explained at https://github.com/librespot-org/librespot/wiki/Compiling#features.

Given that pulseaudio is the de-facto standard sound system on Linux desktop, wouldn't it make sense for that to be enabled by default? Otherwise most users should have to rebuild themselves tweaking some compile-time flags.

That page also contains info about the with-dns-sd feature (EDIT: which it sounds like is enabled on your build and is why it's crashing).

I'm a bit confused about this flag. It seems to be disabled by default, right? Using dev with this change:

diff --git a/Cargo.toml b/Cargo.toml
index ced7d0f..eaf54f3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -74,7 +74,7 @@ gstreamer-backend = ["librespot-playback/gstreamer-backend"]

 with-dns-sd = ["librespot-discovery/with-dns-sd"]

-default = ["rodio-backend"]
+default = ["pulseaudio-backend"]

 [package.metadata.deb]
 maintainer = "librespot-org"

And running cargo run -- --name hugo@victory --backend pulseaudio, it seems to work, and spotify on other devices can discover this device. I'm under the impression that with-dns-sd is required for mDNS discovery to work? Is there another discovery mechanism in place?

@kingosticks
Copy link
Contributor

kingosticks commented Jul 23, 2021

The wiki page states the default feature is the Rodio backend. Every other feature in that table is disabled by default and that includes pulseaudio-backend and with-dns-sd.

I'm using this package, which is basically built using the default.

No, it appears to be built with --all-features. This enables all the features in that table. This is not the default.

You've then changed the default feature from Rodio to Pulseaudio, so that will enable Pulseaudio. Every other feature is disabled in your build.

Is there another discovery mechanism in place?

Yes. There are two different ways mDNS is implemented in librespot. The default way is an integrated mDNS server, this one may not play nicely when you have other mDNS applications running (such as an Avahi service). This is the one you are using in your build because you have not specified with-dns-sd (or --all-features). The other way is activated using the with-dns-sd feature flag and it talks to the Avahi service running on your machine; if that Avahi service is not running then librespot crashes.

@WhyNotHugo
Copy link
Contributor Author

Ah, thanks for the explanation, that makes sense. I guess that when using systemd-resolved instead of avahi, the with-dns-sd feature should be disabled.

I'm surprised that systemd-resolved doesn't serve as a drop-in replacement for avahi, considering it comes from the same developer.

Might it be related to:

*** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>

The wiki page states the default feature is the Rodio backend.

This is a bit of another topic, but why use Rodio by default instead of Pulseaudio? Pulseadio is pretty much the de-facto standard on Linux desktop and what most distributions ship out of the box.

@ashthespy
Copy link
Member

The wiki page states the default feature is the Rodio backend.

This is a bit of another topic, but why use Rodio by default instead of Pulseaudio? Pulseadio is pretty much the de-facto standard on Linux desktop and what most distributions ship out of the box.

Rodio is cross platform (Windows, Linux, MacOS) :-)

@WhyNotHugo
Copy link
Contributor Author

WhyNotHugo commented Jul 23, 2021

Rodio is cross platform (Windows, Linux, MacOS) :-)

Any hints on how to make it work on Linux? There's no references to it in the arch wiki, packages or forums.

@WhyNotHugo
Copy link
Contributor Author

Rodio is cross platform (Windows, Linux, MacOS) :-)

Hmm.. this is a bit of a red herring. On Linux, Rodio seems to just wrap around ALSA. So while, technically, it is multi-platform, it won't run on most Linuxes since most distributions ship Pulseaudio and not ALSA as a sound subsystem.

It's really as "cross-platform" as pulseaudio. Pulseaudio runs on windows, but I don't expect most windows users to have pulseaudio set up.

@ashthespy
Copy link
Member

Not sure, Rodio uses cpal behind the scenes, so you would have to look there. Since PA runs on ALSA anyway, you would probably have to hook into that subsystem directly.

@WhyNotHugo
Copy link
Contributor Author

Since PA runs on ALSA anyway, you would probably have to hook into that subsystem directly.

So there's two parts to ALSA (which is a source of infinite confusion):

  1. The kernel sound subsystem.
  2. The userspace component for handling audio.

When using pulseaudio, it relies on (1), but supercedes (2). Pulseaudio can be built to also expose the same APIs as (2), but that's mostly there for legacy compatibility for older software (e.g.: stuff that precedes pulseaudio), and not enabled by default. It's not really something that actively maintained software should be relying on either.

Obviously (1) isn't going anywhere, since it's what userspace components use to talk to the kernel's sound... stuff.

Rodio es cross-platform in the sense that it can be made to work on different platforms, and, in a way, is as cross-platform as pulseaudio, which can also be made to work on other platforms.

But it's not cross-platform from the "works without setting up another sound subsystem" point of view.

@kingosticks
Copy link
Contributor

Start a new discussion about making PulseAudio the default.

@WhyNotHugo
Copy link
Contributor Author

WhyNotHugo commented Jul 23, 2021

Yeah, that's getting off-topic here. Thanks for the pointers.

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

No branches or pull requests

3 participants