Rigellute / spotify-tui

Spotify for the terminal written in Rust 🚀
MIT License
17.63k stars 526 forks source link

Application just closes when I am not using the PC #102

Open Bios-Marcel opened 5 years ago

Bios-Marcel commented 5 years ago

I usually leave the client open all day. As soon as i take my lunch break, I leave my PC and leave spt open. However, I do stop playback on my Spotify Connect device, which is my phone, which is the only active Spotify Connect device. When I come back, spt has exited without printing an error or anything.

Rigellute commented 5 years ago

This sounds like an app crash. There's currently an issue with tui-rs that prevents the error message being printed (https://github.com/fdehau/tui-rs/issues/177).

Need to investigate this crash - will see if I can reproduce.

Bios-Marcel commented 5 years ago

Is there a logfile or anything?

jfaltis commented 5 years ago

@Bios-Marcel I added the output of a backtrace recently when running spotify-tui in Debug mode (https://github.com/Rigellute/spotify-tui/pull/111). Could you follow these instructions (https://github.com/Rigellute/spotify-tui#development) and reproduce this crash?

Bios-Marcel commented 5 years ago

Will do tmr if I find time

Bios-Marcel commented 5 years ago

I am assuming this is related to sleep or standby? Couldn't such errors just be ignored and display something like "Connected severed. .. trying to reconnect."?

~/code/spotify-tui$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 4.29s
     Running `target/debug/spt`
Error Os { code: 2, kind: NotFound, message: "No such file or directory" };Please navigate here ["https://accounts.spotify.com/authorize?redirect_uri=http:%2F%2Flocalhost:8888%2Fcallback&state=bf7aMrWWTz9XOhrS&client_id=40717002b30f4887a92a804e5b7f2682&response_type=code&scope=playlist-read-collaborative%20playlist-read-private%20user-follow-read%20user-library-modify%20user-library-read%20user-modify-playback-state%20user-read-currently-playing%20user-read-playback-state%20user-read-private%20user-read-recently-played&"]
thread '<unnamed>' panicked at 'send request failed: Error(Io(Custom { kind: TimedOut, error: StringError("timed out") }), "https://accounts.spotify.com/api/token")', src/libcore/result.rs:999:5
stack backtrace:
   0: spt::panic_hook
             at src/main.rs:95
   1: spt::main::{{closure}}
             at src/main.rs:109
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::continue_panic_fmt
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
             at /usr/src/rustc-1.36.0/src/libcore/macros.rs:18
   7: core::result::Result<T,E>::expect
             at /usr/src/rustc-1.36.0/src/libcore/result.rs:827
   8: rspotify::spotify::oauth2::fetch_access_token
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/oauth2.rs:440
   9: rspotify::spotify::oauth2::SpotifyClientCredentials::fetch_access_token
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/oauth2.rs:186
  10: rspotify::spotify::oauth2::SpotifyClientCredentials::request_access_token
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/oauth2.rs:173
  11: rspotify::spotify::oauth2::SpotifyClientCredentials::get_access_token
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/oauth2.rs:156
  12: rspotify::spotify::client::Spotify::auth_headers
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/client.rs:120
  13: rspotify::spotify::client::Spotify::internal_call
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/client.rs:136
  14: rspotify::spotify::client::Spotify::get
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/client.rs:174
  15: rspotify::spotify::client::Spotify::current_playback
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/client.rs:1465
  16: spt::app::App::get_current_playback
             at src/app.rs:326
  17: spt::app::App::poll_current_playback
             at src/app.rs:376
  18: spt::app::App::update_on_tick
             at src/app.rs:381
  19: spt::main
             at src/main.rs:256
  20: std::rt::lang_start::{{closure}}
             at /usr/src/rustc-1.36.0/src/libstd/rt.rs:64
  21: std::panicking::try::do_call
  22: __rust_maybe_catch_panic
  23: std::rt::lang_start_internal
  24: std::rt::lang_start
             at /usr/src/rustc-1.36.0/src/libstd/rt.rs:64
  25: main
  26: __libc_start_main
  27: _start
Bios-Marcel commented 5 years ago

Similar to the last one I'd say. Maybe it should just be okay if a call fails and there's no need to just kill the app.

msc@EJ-PC-00597:~/code/spotify-tui$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 9.08s
     Running `target/debug/spt`
thread '<unnamed>' panicked at 'send request failed: Error(Hyper(Error(Connect, Custom { kind: Other, error: StringError("failed to lookup address information: Temporary failure in name resolution") })), "https://accounts.spotify.com/api/token")', src/libcore/result.rs:999:5
stack backtrace:
   0: spt::panic_hook
             at src/main.rs:95
   1: spt::main::{{closure}}
             at src/main.rs:109
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::continue_panic_fmt
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
             at /usr/src/rustc-1.36.0/src/libcore/macros.rs:18
   7: core::result::Result<T,E>::expect
             at /usr/src/rustc-1.36.0/src/libcore/result.rs:827
   8: rspotify::spotify::oauth2::fetch_access_token
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/oauth2.rs:440
   9: rspotify::spotify::oauth2::SpotifyClientCredentials::fetch_access_token
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/oauth2.rs:186
  10: rspotify::spotify::oauth2::SpotifyClientCredentials::request_access_token
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/oauth2.rs:173
  11: rspotify::spotify::oauth2::SpotifyClientCredentials::get_access_token
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/oauth2.rs:156
  12: rspotify::spotify::client::Spotify::auth_headers
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/client.rs:120
  13: rspotify::spotify::client::Spotify::internal_call
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/client.rs:136
  14: rspotify::spotify::client::Spotify::get
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/client.rs:174
  15: rspotify::spotify::client::Spotify::current_playback
             at /home/msc/.cargo/registry/src/github.com-1ecc6299db9ec823/rspotify-0.7.0/src/spotify/client.rs:1465
  16: spt::app::App::get_current_playback
             at src/app.rs:326
  17: spt::app::App::poll_current_playback
             at src/app.rs:376
  18: spt::app::App::update_on_tick
             at src/app.rs:381
  19: spt::main
             at src/main.rs:256
  20: std::rt::lang_start::{{closure}}
             at /usr/src/rustc-1.36.0/src/libstd/rt.rs:64
  21: std::panicking::try::do_call
  22: __rust_maybe_catch_panic
  23: std::rt::lang_start_internal
  24: std::rt::lang_start
             at /usr/src/rustc-1.36.0/src/libstd/rt.rs:64
  25: main
  26: __libc_start_main
  27: _start
Rigellute commented 5 years ago

Ah yes, I've seen this last error error before. The panic is from rspotify. Looks like we might need to listen for network connectivity and not attempt to make the network request when offline.

NyanKiyoshi commented 4 years ago

rspotify or something else is visibly trying to open the web-browser but crashes when unable to (in this case, it's in a container, so no such thing is provided to it).

Strace shows this:

/usr/bin/strace: Process 25 attached
[pid    25] 10:59:46 execve("/usr/local/sbin/xdg-open", ["xdg-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    25] 10:59:46 execve("/usr/local/bin/xdg-open", ["xdg-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    25] 10:59:46 execve("/usr/sbin/xdg-open", ["xdg-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    25] 10:59:46 execve("/usr/bin/xdg-open", ["xdg-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    25] 10:59:46 execve("/sbin/xdg-open", ["xdg-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    25] 10:59:46 execve("/bin/xdg-open", ["xdg-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    25] 10:59:46 +++ exited with 1 +++
[pid     8] 10:59:46 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=25, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
/usr/bin/strace: Process 26 attached
[pid    26] 10:59:46 execve("/usr/local/sbin/gvfs-open", ["gvfs-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    26] 10:59:46 execve("/usr/local/bin/gvfs-open", ["gvfs-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    26] 10:59:46 execve("/usr/sbin/gvfs-open", ["gvfs-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    26] 10:59:46 execve("/usr/bin/gvfs-open", ["gvfs-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    26] 10:59:46 execve("/sbin/gvfs-open", ["gvfs-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    26] 10:59:46 execve("/bin/gvfs-open", ["gvfs-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    26] 10:59:46 +++ exited with 1 +++
[pid     8] 10:59:46 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=26, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
/usr/bin/strace: Process 27 attached
[pid    27] 10:59:46 execve("/usr/local/sbin/gnome-open", ["gnome-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    27] 10:59:46 execve("/usr/local/bin/gnome-open", ["gnome-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    27] 10:59:46 execve("/usr/sbin/gnome-open", ["gnome-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    27] 10:59:46 execve("/usr/bin/gnome-open", ["gnome-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    27] 10:59:46 execve("/sbin/gnome-open", ["gnome-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    27] 10:59:46 execve("/bin/gnome-open", ["gnome-open", "https://accounts.spotify.com/aut"...], 0x7fffe91e9018 /* 4 vars */) = -1 ENOENT (No such file or directory)
[pid    27] 10:59:46 +++ exited with 1 +++
[pid     8] 10:59:46 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=27, si_uid=0, si_status=1, si_utime=0, si_stime=0} ---
Error Os { code: 2, kind: NotFound, message: "No such file or directory" };Please navigate here ["https://accounts.spotify.com/authorize?[...]