Out Of Memory Caused by Unknown Codecs of Music Files

Server Version#: 1.41.9.9961 on Fedora
Player Version#: Plex Web 4.147.1

Recently I noticed that when the plex server is scanning a specific music library, all memory (16G) + swap space (8G) was occupied by the Plex Media Scanner process. This triggered the oom-killer and the Plex Media Server is forced to restart.

This behaviour was also observed on another Debian box as well. The symptom was probably introduced sometime ago but only until recent it got my attention, as I migrated the plex server to a new Fedora box.

Trawling through the logs I found Plex Media Scanner Matcher.{n}.log contain large amount of same warning info: WARN - [FFMPEG] - Unknown encoding, which roughly occurred when oom event was triggered.

I started investigating the music files in that specific library and after sometime, I nailed it down to one particular file. I created a new library, only put that file in, scan the library, the oom symptom was reproduced.

I took that file out (by renaming it’s extension name) from the original library, then scan that library again, the oom symptom is gone.

I used ffprobe to probe the codec of that music file, and here is the result:

ffprobe version 5.1.6-0+deb12u1 Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=0+deb12u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Unknown encoding
[mp3 @ 0x560b4fd06080] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from './02 Pastorale.mp3':
  Metadata:
    publisher       : Polygram
    date            : 1996
    track           : 2
    iTunNORM        :  000004D0 000003E7 00001ECA 00002150 0002BF65 00024A07 0000727C 00006EE6 0002BF20 0002BF65
    artist          : Secret Garden
    album           : Songs From A Secret Garden
    title           : Pastorale
    album_artist    : Secret Garden
    composer        : Rolf Lovland
    id3v2_priv.WM/MediaClassPrimaryID: \xbc}`\xd1#\xe3\xe2K\x86\xa1H\xa4*(D\x1e
    id3v2_priv.WM/MediaClassSecondaryID: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
    id3v2_priv.WM/WMContentID: \xab4w\x7f\xd1S\xfaH\xa7lu,\xaa\xe6\xa6\x0a
    id3v2_priv.WM/UniqueFileIdentifier: A\x00M\x00G\x00a\x00_\x00i\x00d\x00=\x00R\x00 \x00 \x00 \x002\x004\x005\x006\x005\x005\x00;\x00A\x00M\x00G\x00p\x00_\x00i\x00d\x00=\x00P\x00 \x00 \x00 \x002\x000\x007\x003\x003\x003\x00;\x00A\x00M\x00G\x00t\x00_\x00i\x00d\x00=\x00T\x00 \x00 \x001\x002\x00
  Duration: 00:03:51.22, start: 0.000000, bitrate: 136 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s

I suspect Plex Scanner might utilise similar tool but didn’t handle the exception correctly, being trapped in some infinite loop and consumes all memory resources.

Here is the link to the unknown encoding music file, if you or Plex Developers are interested to test it out:
02-Pastorale.mp3

I guess with the help of ffprobe and some basic scripting, you could scan your music library and identify any “unknown encoding” music file and process it (i.e.: re-rip it with good tool) as a work around.

There may be other reasons that causes OOM in other people’s instances, I just wanted to share my experience with the symptoms and the workaround. Hopefully this could be helpful to those people who face the same issue.

Thank you for this.

I’ve written and submitted the ticket to Engineering.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.