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

Crash Streaming Audiobook on 32-bit Raspberry Pi OS #2030

Open
jwillikers opened this issue Nov 29, 2021 · 5 comments
Open

Crash Streaming Audiobook on 32-bit Raspberry Pi OS #2030

jwillikers opened this issue Nov 29, 2021 · 5 comments

Comments

@jwillikers
Copy link

If you are not sure about anything below then please post on our forum first.

Describe the bug

I have Mopidy running on a Raspberry Pi Zero 2 W which is running 32-bit Raspberry Pi OS (Debian Bullseye).
When streaming an M4B audiobook from my Jellyfin server, Mopidy crashes with the following error output.

Nov 29 17:23:30 zero2 mopidy[3743]: INFO     [MainThread] mopidy.__main__ Starting Mopidy 3.2.0
Nov 29 17:23:30 zero2 mopidy[3743]: INFO     [MainThread] mopidy.config Loading config from builtin defaults
Nov 29 17:23:30 zero2 mopidy[3743]: INFO     [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf
Nov 29 17:23:30 zero2 mopidy[3743]: INFO     [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf
Nov 29 17:23:30 zero2 mopidy[3743]: INFO     [MainThread] mopidy.config Loading config from command line options
Nov 29 17:23:30 zero2 mopidy[3743]: WARNING  [MainThread] mopidy.config Ignoring config section 'mpd' because no matching extension was found
Nov 29 17:23:31 zero2 mopidy[3743]: INFO     [MainThread] mopidy.__main__ Enabled extensions: m3u, softwaremixer, stream, http, jellyfin, file
Nov 29 17:23:31 zero2 mopidy[3743]: INFO     [MainThread] mopidy.__main__ Disabled extensions: none
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [MainThread] mopidy.commands Mixer volume set to 100
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [MainThread] mopidy.commands Starting Mopidy audio
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [MainThread] mopidy.commands Starting Mopidy backends: JellyfinBackend, FileBackend, M3UBackend, StreamBackend
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [Audio-2] mopidy.audio.actor Audio output set to "audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo"
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [MainThread] mopidy.commands Starting Mopidy core
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [MainThread] mopidy.commands Starting Mopidy frontends: EventMonitorFrontend, HttpFrontend
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [HttpFrontend-12] mopidy.http.actor HTTP server running at [::]:6680
Nov 29 17:23:32 zero2 mopidy[3743]: INFO     [MainThread] mopidy.commands Starting GLib mainloop
Nov 29 17:29:04 zero2 mopidy[3743]: OverflowError: Python int too large to convert to C long
Nov 29 17:29:04 zero2 mopidy[3743]: The above exception was the direct cause of the following exception:
Nov 29 17:29:04 zero2 mopidy[3743]: Traceback (most recent call last):
Nov 29 17:29:04 zero2 mopidy[3743]:   File "/usr/lib/python3/dist-packages/mopidy/audio/actor.py", line 212, in on_message
Nov 29 17:29:04 zero2 mopidy[3743]:     elif msg.type == Gst.MessageType.BUFFERING:
Nov 29 17:29:04 zero2 mopidy[3743]: SystemError: <built-in method get_value of gi.FieldInfo object at 0x74541608> returned a result with an error set

I have reproduced this issue on my Raspberry Pi CM4 using the same 32-bit version of Raspberry Pi OS.
Since it appeared to be a cast error, I tried using 64-bit Raspberry Pi OS and it turns out that Mopidy doesn't crash in that instance.

How to reproduce

  1. Configure Mopidy on 32-bit Raspberry Pi OS (Debian Bullseye) .
  2. Stream an M4B audiobook from a Jellyfin server using the Mopidy-Jellyfin plugin.
    Note that my Jellyfin server is running on a 64-bit OS on my ROCKPro64.

Expected behaviour

The audiobook should playback but instead nothing happened, Mopidy just crashed.

Environment
Please complete the following information:

  • Operating system 32-bit Debian Bullseye (Raspberry Pi OS)
  • Running Mopidy as a service
  • Your config (output of sudo mopidyctl config)
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf config" as user mopidy
WARNING  [MainThread] mopidy.config Ignoring config section 'mpd' because no matching extension was found
[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
verbosity = 0
format = %(levelname)-8s [%(threadName)s] %(name)s %(message)s
color = false
config_file =

[audio]
mixer = software
mixer_volume = 100
output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! filesink location=/tmp/snapfifo
buffer_time = 

[proxy]
scheme = 
hostname = 
port = 
username = 
password = 

[jellyfin]
enabled = true
username = jordan
user_id = 
password = **********
hostname = http://jellyfin.jwillikers.com:8096
libraries = 
albumartistsort = 
port = 
client_cert = 
client_key = 
album_format = {ProductionYear} - {Name}
max_bitrate = 
watched_status = false

[file]
enabled = true
media_dirs = 
  $XDG_MUSIC_DIR|Music
  ~/|Home
excluded_file_extensions = 
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .pdf
  .png
  .txt
  .zip
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[http]
enabled = true
hostname = ::
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins = 
csrf_protection = true
default_app = mopidy

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir =

[softwaremixer]
enabled = true

[stream]
enabled = true
protocols = 
  http
  https
  mms
  rtmp
  rtmps
  rtsp
metadata_blacklist = 
timeout = 5000
  • Software versions (output of sudo mopidyctl deps)
Running "/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf deps" as user mopidy
WARNING  [MainThread] mopidy.config Ignoring config section 'mpd' because no matching extension was found
Executable: /usr/bin/mopidy
Platform: Linux-5.10.63-v7+-armv7l-with-glibc2.31
Python: CPython 3.9.2 from /usr/lib/python3.9
Mopidy: 3.2.0 from /usr/lib/python3/dist-packages
Mopidy-Jellyfin: 1.0.2 from /usr/local/lib/python3.9/dist-packages
  websocket-client: 1.2.1 from /usr/local/lib/python3.9/dist-packages
  setuptools: 52.0.0 from /usr/lib/python3/dist-packages
  Mopidy: 3.2.0 from /usr/lib/python3/dist-packages
  requests: 2.25.1 from /usr/lib/python3/dist-packages
  unidecode: 1.3.2 from /usr/local/lib/python3.9/dist-packages
  Pykka: 2.0.3 from /usr/lib/python3/dist-packages
GStreamer: 1.18.4.0 from /usr/lib/python3/dist-packages/gi
  Detailed information: 
    Python wrapper: python-gi 3.38.0
    Relevant elements:
      Found:
        uridecodebin
        souphttpsrc
        appsrc
        alsasink
        osssink
        oss4sink
        pulsesink
        id3demux
        id3v2mux
        lamemp3enc
        mpegaudioparse
        mpg123audiodec
        vorbisdec
        vorbisenc
        vorbisparse
        oggdemux
        oggmux
        oggparse
        flacdec
        flacparse
        shout2send
      Not found:
        flump3dec
        mad
  • Any specific hardware (e.g. an exotic USB soundcard)

Additional context
Add any other context about the problem here. If appropriate, upload an appropriately verbose log file showing the bug.

@kingosticks
Copy link
Member

On first pass this looks like it must be a gstreamer bug rather than ours. I don't think there's anything we could do other than simply not call the gstreamer parsing function.

@jwillikers
Copy link
Author

@kingosticks Thanks. I've opened an issue in GStreamer.

@tehkillerbee
Copy link

tehkillerbee commented Jan 19, 2022

I get a similar issue after pausing a m3u8 live radio stream for some time. Unpausing or restarting the stream does not help. Only solution is to restart mopidy.

Usually the issue does not occur, as long as I make sure to stop playback instead of using pause. I suspect that mopidy is buffering the stream in the background. Is there a way to disable this?

Jan 14 10:05:12 rpimedia mopidy[14965]: WARNING  [FileBackend-4] mopidy.file.library Failed looking up file:///var/lib/mopidy/m3u/DRP6Beat.m3u8: Timeout after 1000ms
Jan 14 11:24:11 rpimedia mopidy[14965]: OverflowError: Python int too large to convert to C long
Jan 14 11:24:11 rpimedia mopidy[14965]: The above exception was the direct cause of the following exception:
Jan 14 11:24:11 rpimedia mopidy[14965]: Traceback (most recent call last):
Jan 14 11:24:11 rpimedia mopidy[14965]:   File "/usr/lib/python3/dist-packages/mopidy/audio/actor.py", line 211, in on_message
Jan 14 11:24:11 rpimedia mopidy[14965]:     elif msg.type == Gst.MessageType.BUFFERING:
Jan 14 11:24:11 rpimedia mopidy[14965]: SystemError: <built-in method get_value of gi.FieldInfo object at 0x75389908> returned a result with an error set
Jan 14 11:24:11 rpimedia mopidy[14965]: OverflowError: Python int too large to convert to C long
Jan 14 11:24:11 rpimedia mopidy[14965]: The above exception was the direct cause of the following exception:
Jan 14 11:24:11 rpimedia mopidy[14965]: Traceback (most recent call last):
Jan 14 11:24:11 rpimedia mopidy[14965]:   File "/usr/lib/python3/dist-packages/mopidy/audio/actor.py", line 211, in on_message
Jan 14 11:24:11 rpimedia mopidy[14965]:     elif msg.type == Gst.MessageType.BUFFERING:
Jan 14 11:24:11 rpimedia mopidy[14965]: SystemError: <built-in method get_value of gi.FieldInfo object at 0x75389908> returned a result with an error set
Jan 14 11:24:11 rpimedia mopidy[14965]: OverflowError: Python int too large to convert to C long
Jan 14 11:24:11 rpimedia mopidy[14965]: The above exception was the direct cause of the following exception:
Jan 14 11:24:11 rpimedia mopidy[14965]: Traceback (most recent call last):
Jan 14 11:24:11 rpimedia mopidy[14965]:   File "/usr/lib/python3/dist-packages/mopidy/audio/actor.py", line 211, in on_message
Jan 14 11:24:11 rpimedia mopidy[14965]:     elif msg.type == Gst.MessageType.BUFFERING:
Jan 14 11:24:11 rpimedia mopidy[14965]: SystemError: <built-in method get_value of gi.FieldInfo object at 0x75389908> returned a result with an error set
Jan 14 11:24:11 rpimedia mopidy[14965]: OverflowError: Python int too large to convert to C long
Jan 14 11:24:11 rpimedia mopidy[14965]: The above exception was the direct cause of the following exception:
Jan 14 11:24:11 rpimedia mopidy[14965]: Traceback (most recent call last):
Jan 14 11:24:11 rpimedia mopidy[14965]:   File "/usr/lib/python3/dist-packages/mopidy/audio/actor.py", line 211, in on_message
Jan 14 11:24:11 rpimedia mopidy[14965]:     elif msg.type == Gst.MessageType.BUFFERING:
Jan 14 11:24:11 rpimedia mopidy[14965]: SystemError: <built-in method get_value of gi.FieldInfo object at 0x75389908> returned a result with an error set

@kingosticks
Copy link
Member

I suspect that mopidy is buffering the stream in the background. Is there a way to disable this?

Any gstreamer buffering is restricted to a few MB. But the gstreamer wall time will be incrementing the whole time, perhaps that is getting too large and is exposing some type mismatch in the gst python bindings. There technically is a way to prevent any buffering by setting "live" mode for the stream but that's not exposed to the user. Plus, if the issue is related to the incrementing wall time then disabling buffering probably won't help. If you are interested in hacking that mode always enabled, look at https://github.com/mopidy/mopidy/blob/develop/mopidy/audio/actor.py#L615

@herrernst
Copy link
Contributor

I probably have a similar problem, I immediately get the following crash when playing https://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_6music/bbc_6music.isml/bbc_6music-audio%3d48000.m3u8

Oct 12 21:55:30 rpi3 mopidy[325]: OverflowError: Python int too large to convert to C long
Oct 12 21:55:30 rpi3 mopidy[325]: The above exception was the direct cause of the following exception:
Oct 12 21:55:30 rpi3 mopidy[325]: Traceback (most recent call last):
Oct 12 21:55:30 rpi3 mopidy[325]:   File "/usr/lib/python3/dist-packages/mopidy/audio/actor.py", line 212, in on_message
Oct 12 21:55:30 rpi3 mopidy[325]:     elif msg.type == Gst.MessageType.BUFFERING:
Oct 12 21:55:30 rpi3 mopidy[325]: SystemError: <built-in method get_value of gi.FieldInfo object at 0x75733968> returned a result with an error set

Playing it directly via Gstreamer works though: gst-launch-1.0 playbin uri=https://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_6music/bbc_6music.isml/bbc_6music-audio%3d48000.m3u8

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

4 participants