ampache / ampache

A web based audio/video streaming application and file manager allowing you to access your music & videos from anywhere, using almost any internet enabled device.
http://ampache.org
GNU Affero General Public License v3.0
3.55k stars 590 forks source link

UNABLE TO READ 'playtime_seconds' error creates a infinite loop on a catalog add operation #3754

Open Verbocutane opened 10 months ago

Verbocutane commented 10 months ago

Description

A catalog containing an audio media with an invalid (or missing) "playtime_seconds" result in an incomplete catalog creation and an infinite error loop when trying to update the catalog (a new error log is created each 3 seconds until the administrator logs out).

To reproduce

Steps to reproduce the behavior:

  1. Go to "Admin\Show Catalogs" section
  2. On an existing catalog in which you have a media creating a "UNABLE TO READ 'playtime_seconds'" error, select action "Add" and click "GO"
  3. You should see "Server-Sent events connection error. Re-connection.." pop-up coming up over and over again

Environment

Client type

Logs

(local.catalog) -> Unable to get filesize for ... (Ampache\Module\Util\VaInfo) -> UNABLE TO READ 'playtime_seconds'. This is probably a bad file ...

lachlan-00 commented 10 months ago

can you do a compoer install / composer update?

i was getting this when getid3 wasn't installed correctly

Verbocutane commented 10 months ago

I have the latest composer version (V2.6.6) and the installation did not issue any error or warning

Note : it turns out that the files on which this error occurred were completely corrupted (empty files). After removing those files, the process of catalog creation finally finished.

Maybe a better behaviour would have been issue 1 error per corrupted file and skip it, but the error happened on the same file over and over again until it was removed (then it would loop on the next corrupted file until this one was also removed, and so on)

lachlan-00 commented 10 months ago

empty file? i'll create an empty text file and try to replicate and bypass those issues

lachlan-00 commented 10 months ago

db54ee6c7 should fix that now. a bad file will be added from what can be parsed but it also won't crash the process

lachlan-00 commented 10 months ago

should be a return on the file size check too. that would stop it getting to the VaInfo class all together so that's set with fc296ec3e now too

BlueNalgene commented 3 months ago

+1

I'm getting this behavior but I do not have empty files. If I remember correctly, these files were created by a conversion from a flac/cue combo to mp3. I am getting the same infinite error loop. My logs look like:

2024-08-06T04:46:58+00:00 [mediabox] (Ampache\Repository\Model\Catalog) -> Reading tags from /media/storage2/Sounds/R/Rammstein/Herzeleid/04. Asche zu Asche.mp3
2024-08-06T04:46:58+00:00 [mediabox] (Ampache\Module\Util\VaInfo) -> UNABLE TO READ 'playtime_seconds'. This is probably a bad file 04. Asche zu Asche
2024-08-06T04:46:58+00:00 [mediabox] (Ampache\Module\Util\VaInfo) -> get_tag_type: Couln't find tags, this is probably a bad file
2024-08-06T04:46:58+00:00 [mediabox] (Ampache\Module\Util\VaInfo) -> _get_plugin_tags: musicbrainz is not a valid metadata_order plugin
2024-08-06T04:46:58+00:00 [mediabox] (Ampache\Module\Util\VaInfo) -> _get_plugin_tags: theaudiodb is not a valid metadata_order plugin

I am running 6.6, which suggests the error was not killed in 6.2.

================ Edit

Investigating further, there seems to be an encoding error with my files. The example above reads:

$ ffprobe Rammstein/Herzeleid/04.\ Asche\ zu\ Asche.mp3 
ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --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 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --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 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mp3, from 'Rammstein/Herzeleid/04. Asche zu Asche.mp3':
  Metadata:
    DISCID          : 8C0B9D0B
    title           : Asche zu Asche
    artist          : Rammstein
    album_artist    : Rammstein
    album           : Herzeleid
    genre           : Industrial
    track           : 04/11
    date            : 1995
  Duration: 00:03:51.78, start: 0.025056, bitrate: 5145 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
    Metadata:
      encoder         : LAME3.98r
  Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 3214x3138 [SAR 600:600 DAR 1607:1569], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : CD.jpg
      comment         : Media (e.g. label side of CD)
  Stream #0:2: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 3652x2801 [SAR 600:600 DAR 3652:2801], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : Back.jpg
      comment         : Cover (back)
  Stream #0:3: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 8.jpg
      comment         : Cover (front)
  Stream #0:4: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 7.jpg
      comment         : Cover (front)
  Stream #0:5: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 6.jpg
      comment         : Cover (front)
  Stream #0:6: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 5.jpg
      comment         : Cover (front)
  Stream #0:7: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 4.jpg
      comment         : Cover (front)
  Stream #0:8: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 3.jpg
      comment         : Cover (front)
  Stream #0:9: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 2.jpg
      comment         : Cover (front)
  Stream #0:10: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 1.jpg
      comment         : Cover (front)
  Stream #0:11: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 5675x2817 [SAR 600:600 DAR 5675:2817], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : 1.jpg
      comment         : Cover (front)

while a working file reads:

$ ffprobe Radiohead/Radiohead\ -\ In\ Rainbows/01\ -\ Radiohead\ -\ 15\ Step.mp3 
ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --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 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --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 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[mp3 @ 0x560cba974d00] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'Radiohead/Radiohead - In Rainbows/01 - Radiohead - 15 Step.mp3':
  Metadata:
    publisher       : ATO
    title           : 15 Step
    artist          : Radiohead
    album_artist    : Radiohead
    album           : In Rainbows
    composer        : Radiohead
    track           : 01
    genre           : Alternative
    date            : 2007
    id3v2_priv.WM/Provider: A\x00M\x00G\x00\x00\x00
    id3v2_priv.WM/WMCollectionGroupID: o\xbc\x7fhZuFN\x95w\x05,A\xf3\xc9D
    id3v2_priv.WM/WMCollectionID: o\xbc\x7fhZuFN\x95w\x05,A\xf3\xc9D
    id3v2_priv.WM/UniqueFileIdentifier: A\x00M\x00G\x00a\x00_\x00i\x00d\x00=\x00R\x00 \x00 \x001\x002\x003\x009\x007\x007\x007\x00;\x00A\x00M\x00G\x00p\x00_\x00i\x00d\x00=\x00P\x00 \x00 \x00 \x00 \x004\x001\x000\x009\x002\x00;\x00A\x00M\x00G\x00t\x00_\x00i\x00d\x00=\x00T\x00 \x001\x002\x003\x00
    id3v2_priv.WM/WMContentID: e\x1bX\xa7$\x84JM\xae&8\xe7\xfc\xde`J
    id3v2_priv.WM/MediaClassSecondaryID: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
    id3v2_priv.WM/MediaClassPrimaryID: \xbc}`\xd1#\xe3\xe2K\x86\xa1H\xa4*(D\x1e
  Duration: 00:03:57.35, start: 0.000000, bitrate: 160 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 160 kb/s
  Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 200x181 [SAR 96:96 DAR 200:181], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : folder.jpg
      comment         : Cover (front)

A notable difference is that working files have the ffprobe info line which reads Estimating duration from bitrate, this may be inaccurate. My problematic files don't have that. Perhaps there is an encoding detection problem for playtime_seconds which does not behave nicely.

I'm including this info here with this issue since it is related to the infinite error loop. Let me know if I should open a new issue for this specific topic.