Bug 251968

Summary: audio/spotifyd crashes every time during remote streaming from another device
Product: Ports & Packages Reporter: nick.rozhkov
Component: Individual Port(s)Assignee: Rodrigo Osorio <rodrigo>
Status: Closed FIXED    
Severity: Affects Only Me CC: rodrigo, theraven
Priority: --- Flags: bugzilla: maintainer-feedback? (mikael)
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
v0
none
Patch to build spotifyd 0.3.0
none
Patch to build spotifyd 0.3.0_1 and fix the panic none

Description nick.rozhkov 2020-12-19 21:00:05 UTC
spotifyd crashes on every action (play/pause) from remote device. 
Error message 
kMessageTypePlay "Redmi Note 9 Pro" b33054b5b7fe8059258983048837ef0f7bd0b3d8 2093614184 1608411377236
Caught panic with message: called `Result::unwrap()` on an `Err` value: "SendError(..)"
drop Spirc[0]
Shutting down player thread ...
Player thread panicked!
drop Session[0]
drop AudioKeyManager
drop ChannelManager
drop MercuryManager
shutdown; state=pool::State { lifecycle: Running, num_futures: 0 }
  -> transitioned to shutdown
  -> shutting down workers
dropping I/O source: 3
deregistering handle with poller
dropping I/O source: 0
deregistering handle with poller
dropping I/O source: 1
deregistering handle with poller
dropping I/O source: 2
drop Dispatch
deregistering handle with poller
dropping I/O source: 5
Comment 1 daniel.engberg.lists 2020-12-19 21:38:23 UTC
Please attach useful information such as os version, arch (i386/x64 etc) and version of port.
Comment 2 nick.rozhkov 2020-12-19 21:44:29 UTC
(In reply to daniel.engberg.lists from comment #1)

Sorry, my bad
FreeBSD 12.2-RELEASE-p1 r368354  amd64
rust version 1.48.0

_OPTIONS_READ=spotifyd-0.2.24_11
_FILE_COMPLETE_OPTIONS_LIST=DBUS DOCS PORTAUDIO PULSEAUDIO
OPTIONS_FILE_UNSET+=DBUS
OPTIONS_FILE_SET+=DOCS
OPTIONS_FILE_SET+=PORTAUDIO
OPTIONS_FILE_SET+=PULSEAUDIO

Seems its well known bug in upstream
https://github.com/Spotifyd/spotifyd/issues/69
Comment 3 David Chisnall freebsd_committer 2021-01-27 12:04:44 UTC
From the upstream bug report, it appears as if this happens if spotifyd is compiled with a Rust version greater than 1.47.  Is it possible to mark this as needing a lower version?
Comment 4 Mikael Urankar freebsd_committer 2021-01-27 16:46:46 UTC
Created attachment 221967 [details]
v0

(In reply to David Chisnall from comment #3)
Unfortunately we can't do this :(

Upstream issue:
https://github.com/Spotifyd/spotifyd/issues/719
https://github.com/librespot-org/librespot-tremor/pull/1


Can any of you test this patch? It updates spotifyd to 0.3.0 and import the librespot-tremor patch (I don't have a spotify account)
Comment 5 nick.rozhkov 2021-01-27 19:25:01 UTC
(In reply to Mikael Urankar from comment #4)
Much thanks for the patch. Just checked it. Unfortunately it doesnt help

Error message is the same:

kMessageTypeLoad "JunkiesM1Book" 80f40922d7a283c2160ec51fa0a50b5adcd96dae 1162506104 1611775239283
State: context_uri: "spotify:artist:2jYMYP2SVifgmzNRQJx3SJ" index: 10 position_ms: 0 status: kPlayStatusPlay position_measured_at: 1611775241463 context_description: "" shuffle: false repeat: false playing_from_fallback: true row: 0 playing_track_index: 10 track {gid: "a\363\026q}rH\025\210\261*u\315\2308i"} track {gid: "\277\266\276x\2434Jl\266\315\304\013|@\0251"} track {gid: "\201'\273X\010\340C\253\213\252AL\203`1\236"} track {gid: "u\364J\226\007\030J\251\246'\302!F\204\324\274"} track {gid: "\205S}\361\221CJa\211\340\321\223O\346N\346"} track {gid: "\305\3203\361\263mC!\243\0359)\374o\022\363"} track {gid: "\276\030\037*\255\366K\227\255\345\003\007\003B\177\217"} track {gid: "$Q\020;C]Fx\240qI\357kV\265\036"} track {gid: "~\344\244\315\020OC2\271S\276\006.\3079\356"} track {gid: "\346\330)\303\263\224@#\274\215\260Gk\306\305\331"} track {gid: "V=\006\375E\247C\371\237\007.gg`p\357"} track {gid: "z\237\023(DQD\204\262\234\227M\265ik\335"} track {gid: "Qx\230\234\225nD\337\210>e\215\303G\n\366"} track {gid: "\\\271#j\030\377G\347\231\266k\355d\330\030H"} track {gid: "\230j\341\300\257\223A\350\244\2328n\255\203X\211"} track {gid: "\200\332\260\020\262\367BV\276\273o\370\033\343%\017"} track {gid: "\213\221\363\364\354_H\205\210J\245\"\270\322\334["} track {gid: "D\356\216I\332\331NN\264u\300\317\325\214\354\214"} track {gid: "\300\306mPyqE\262\227\217\351\013w\342>\244"} track {gid: "\3212\377gW\242GD\211t\035\0344\202L\261"} track {gid: "\0359\203\374YwN\346\231\246\327\272:\0011\315"} track {gid: "<.\322\026\351^O\337\227*\270$HA\252\330"} track {gid: "\3441$\211\270\347@\265\222p-i^\311\333\022"} track {gid: "\355\030i\346ZOF@\236\326\246\2715\276\"M"} track {gid: "\360\207Ep\237\235M\000\232\244\226\366\364\\-\376"} track {gid: "\205\006\177\250\275\354DA\263x\255\007#\031'\220"} track {gid: "\206\004\251\003\023\350B\370\266\010\016\352d2\240\026"} track {gid: "u\345\364\2610\214I7\240\014\031\205\004\221.\244"} track {gid: "\3079;\371\220#E\311\221:\007\202\013\003\302("} track {gid: "\354~:\334l\245A\340\232\260\335\206\352\253\332\240"} track {gid: "\215:\254%P\211E\372\220T\257L\t\244UE"} track {gid: "R\305 \010=\331F\207\213\334\260\231\361\214\256\272"} track {gid: "\020\215\303\220DZH`\220\022\325\236\370es\262"} track {gid: "\323I\206\022\333\234O\003\222\252\374\321\341Z\375\364"} track {gid: "\024NA\277\016\250F\210\2348\271\021\300\366]\336"} track {gid: "\037\353\347\307\221\234J\003\252\334>@\034f^\323"} track {gid: "$\231qh\220\257I\216\243u\362\257N\242\225\344"} track {gid: "K(X\364\363>N\310\265\033W\\\353\000\007]"}
Frame has 38 tracks
Loading context: <spotify:artist:2jYMYP2SVifgmzNRQJx3SJ> index: [10] of 38
Caught panic with message: called `Result::unwrap()` on an `Err` value: "SendError(..)"
drop Spirc[0]
Shutting down player thread ...
Player thread panicked!
drop Session[0]
drop AudioKeyManager
drop ChannelManager
drop MercuryManager
shutdown; state=pool::State { lifecycle: Running, num_futures: 0 }
  -> transitioned to shutdown
  -> shutting down workers
dropping I/O source: 3
deregistering handle with poller
dropping I/O source: 0
deregistering handle with poller
dropping I/O source: 1
deregistering handle with poller
dropping I/O source: 2
drop Dispatch
deregistering handle with poller
dropping I/O source: 5
Comment 6 Rodrigo Osorio freebsd_committer 2021-01-31 22:28:58 UTC
Update regarding this issue:

 * The fix for librespot-tremor[1] was merged and a new version was tagged (0.2.0)
 * A new release of librespot is under progress[2]. This is a requirement since
   librespot-tremor is a librespot dependency which is required by spotifyd.

So we can expect a new spotifyd release after the 0.3.0 in the upcoming weeks



[1] https://github.com/librespot-org/librespot-tremor/pull/1
[2] https://github.com/Spotifyd/spotifyd/issues/719#issuecomment-770405996
Comment 7 Rodrigo Osorio freebsd_committer 2021-01-31 22:31:20 UTC
Created attachment 222056 [details]
Patch to build spotifyd 0.3.0

This patch upgrades the port but don't fix the crash.
Comment 8 Rodrigo Osorio freebsd_committer 2021-02-08 14:32:13 UTC
Good news, we have a fix for spotifyd based on one of the proposals [1]
made on the problem report. I Forked the repo and added the fix
on top of the head, and made a merge request to the upstream project.

In the meantime, fins attached a patch to upgrade spotifyd to O.3.0_1
which uses my fork to build spotifyd.

Thanks @Mikael for submitting a better fix for the change I made in my
previous patch to upstream :)


[1] https://github.com/Spotifyd/spotifyd/issues/719#issuecomment-774727927
Comment 9 Rodrigo Osorio freebsd_committer 2021-02-08 14:35:28 UTC
Created attachment 222267 [details]
Patch to build spotifyd 0.3.0_1 and fix the panic

Temporary fix for issue #719[1] using an alternative
github repo (mine).


[1] https://github.com/Spotifyd/spotifyd/issues/719
Comment 10 Rodrigo Osorio freebsd_committer 2021-02-09 22:12:34 UTC
Take maintenership for this port, and so the problems attached
Comment 11 commit-hook freebsd_committer 2021-02-12 10:42:24 UTC
A commit references this bug:

Author: rodrigo
Date: Fri Feb 12 10:41:54 UTC 2021
New revision: 565003
URL: https://svnweb.freebsd.org/changeset/ports/565003

Log:
  audio/spotifyd: upgrade to 0.3.0 and fix panic after rust update

  Major changes:
      - Changed the config format from ini to TOML
        Make sure to update your config file accordingly[1].
      - Expose volume trough dbus
      - Add an option to disable dbus

  Introduce two temporary patches to :
   - Fix panic reported in upstream bug system #719[2] - fixed in future
   - Fix compilation issue with FreeBSD (Merged after 0.3.0[3] release)

  [1] https://github.com/Spotifyd/spotifyd/blob/master/docs/src/config/File.md
  [2] https://github.com/Spotifyd/spotifyd/issues/719
  [3] https://github.com/Spotifyd/spotifyd/pull/796/commits/a352eab53eef0ecafe1ddb07a43ff2b3ab54f123

  PR:		251968
  Submitted by:	<nick.rozhkov@gmail.com>

Changes:
  head/UPDATING
  head/audio/spotifyd/Makefile
  head/audio/spotifyd/distinfo
  head/audio/spotifyd/files/patch-Cargo.toml
  head/audio/spotifyd/files/patch-src_utils.rs
  head/audio/spotifyd/files/spotifyd.conf
Comment 12 Rodrigo Osorio freebsd_committer 2021-02-12 10:43:46 UTC
Committed, thanks for reporting this issue.