morpheus65535 / bazarr

Bazarr is a companion application to Sonarr and Radarr. It manages and downloads subtitles based on your requirements. You define your preferences by TV show or movie and Bazarr takes care of everything for you.
https://www.bazarr.media
GNU General Public License v3.0
2.86k stars 223 forks source link

When Bazarr encounters a media file it can't parse, it crashes the entire app #711

Closed jasonla closed 4 years ago

jasonla commented 4 years ago

Describe the bug When running Bazarr in docker using the LinuxServer image of latest, Bazarr's web server and the schedule will crash if it encounters a video file it cannot parse.

To Reproduce Steps to reproduce the behavior:

  1. Let Bazarr run in docker.
  2. Configure it to talk to a Sonarr instance in docker on the same machine (127.0.0.1:8989)
  3. Allow it to run into a file that cannot be played or parsed by FFProbe
  4. The entire app will crash if it runs into enough of these files.

Expected behavior It shouldn't crash.

Screenshots If applicable, add screenshots to help explain your problem.

Software (please complete the following information):

Additional context So the issue is, Bazarr runs into a file downloaded by Sonarr that isn't actually a valid video file. That's not the fault of Bazarr, I understand that. But if It encounters and error, it shouldn't crash the entire Bazarr app. It should just skip the file, no?

I've verified that /04x02 Arkangel.mkv and 04x03 Crocodile.mkv are not playable by VLC or parsable by MediaInfo.

Logs:


19/12/2019 08:31:21|INFO    |root                            |BAZARR Finished searching for missing Subtitles. Check History for more information.|
19/12/2019 11:31:21|INFO    |root                            |BAZARR Finished searching for missing Subtitles. Check History for more information.|
19/12/2019 14:31:21|INFO    |root                            |BAZARR Finished searching for missing Subtitles. Check History for more information.|
19/12/2019 17:31:21|INFO    |root                            |BAZARR Finished searching for missing Subtitles. Check History for more information.|
19/12/2019 20:31:21|INFO    |root                            |BAZARR Finished searching for missing Subtitles. Check History for more information.|
19/12/2019 23:31:21|INFO    |root                            |BAZARR Finished searching for missing Subtitles. Check History for more information.|
20/12/2019 02:31:21|INFO    |root                            |BAZARR Finished searching for missing Subtitles. Check History for more information.|
20/12/2019 04:22:21|ERROR   |root                            |BAZARR error when trying to analyze this .mkv file: /media/storage/TV/Black Mirror/Season 04/04x02 Arkangel.mkv|'Traceback (most recent call last):\n  File "/app/bazarr/bazarr/list_subtitles.py", line 37, in store_subtitles\n    subtitle_languages = embedded_subs_reader.list_languages(file)\n  File "/app/bazarr/bazarr/embedded_subs_reader.py", line 26, in list_languages\n    data = parser.parseFfprobe(file)\n  File "/app/bazarr/bazarr/../libs/pyprobe/pyprobe.py", line 40, in parseFfprobe\n    fdict = self._executeFfprobe(inputFile)\n  File "/app/bazarr/bazarr/../libs/pyprobe/pyprobe.py", line 71, in _executeFfprobe\n    outputJson = self._executeParser(self._ffprobe, commandArgs, inputFile)\n  File "/app/bazarr/bazarr/../libs/pyprobe/pyprobe.py", line 184, in _executeParser\n    "Error occurred during execution - " + e.output\nIOError: Error occurred during execution - {\n    "error": {\n        "code": -1094995529,\n        "string": "Invalid data found when processing input"\n    }\n}\n'|
20/12/2019 04:22:22|ERROR   |root                            |BAZARR error when trying to analyze this .mkv file: /media/storage/TV/Black Mirror/Season 04/04x03 Crocodile.mkv|'Traceback (most recent call last):\n  File "/app/bazarr/bazarr/list_subtitles.py", line 37, in store_subtitles\n    subtitle_languages = embedded_subs_reader.list_languages(file)\n  File "/app/bazarr/bazarr/embedded_subs_reader.py", line 26, in list_languages\n    data = parser.parseFfprobe(file)\n  File "/app/bazarr/bazarr/../libs/pyprobe/pyprobe.py", line 40, in parseFfprobe\n    fdict = self._executeFfprobe(inputFile)\n  File "/app/bazarr/bazarr/../libs/pyprobe/pyprobe.py", line 71, in _executeFfprobe\n    outputJson = self._executeParser(self._ffprobe, commandArgs, inputFile)\n  File "/app/bazarr/bazarr/../libs/pyprobe/pyprobe.py", line 184, in _executeParser\n    "Error occurred during execution - " + e.output\nIOError: Error occurred during execution - {\n    "error": {\n        "code": -1094995529,\n        "string": "Invalid data found when processing input"\n    }\n}\n'|
20/12/2019 04:36:02|INFO    |root                            |BAZARR All existing episode subtitles indexed from disk.|```
jasonla commented 4 years ago

This is even stranger. I turned on debug logging and the last few messages before Bazarr crashes looks normal, except for one message:

21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |Sleeping: 0.001 21a47779-7ef6-4924-9d65-0340a410ff99|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |sql_queue: 0|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |run: SELECT radarrId FROM table_movies WHERE path=?, (u'/media/storage/Love Blooms (2019)/Love Blooms (2018) PREUMS WEBDL-1080p.mkv',)|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |run: commit|
21/12/2019 05:00:06|DEBUG   |root                            |BAZARR storing those languages to DB: []|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |execute: SELECT radarrId, subtitles, languages, forced FROM table_movies WHERE radarrId=452, None|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |Sleeping: 0.001 dd4bd66d-dbb5-4aad-91ae-8c7c050c7c4e|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |sql_queue: 0|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |run: SELECT radarrId, subtitles, languages, forced FROM table_movies WHERE radarrId=452, []|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |run: commit|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |execute: UPDATE table_movies SET missing_subtitles=? WHERE radarrId=?, ('[]', 452)|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |Sleeping: 0.001 42634ca4-3cb7-413a-8ca1-2fb8f62e15d2|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |sql_queue: 0|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |run: UPDATE table_movies SET missing_subtitles=? WHERE radarrId=?, ('[]', 452)|
21/12/2019 05:00:06|DEBUG   |sqlite3worker                   |run: commit|
21/12/2019 05:00:06|DEBUG   |root                            |BAZARR ended subtitles indexing for this file: /media/storage/Love Blooms (2019)/Love Blooms (2018) PREUMS WEBDL-1080p.mkv|
21/12/2019 05:00:06|DEBUG   |root                            |BAZARR started subtitles indexing for this file: /media/storage/Love, Simon (2018)//Love, Simon (2018).mkv|
21/12/2019 05:00:06|DEBUG   |root                            |BAZARR is trying to index embedded subtitles.|
21/12/2019 05:00:07|DEBUG   |sqlite3worker                   |execute: SELECT code3 FROM table_settings_languages WHERE enabled=1, None|
21/12/2019 05:00:07|DEBUG   |sqlite3worker                   |Sleeping: 0.001 7636fb15-d8fc-428f-a02f-cc5e1a2d2e49|
21/12/2019 05:00:07|DEBUG   |sqlite3worker                   |sql_queue: 0|
21/12/2019 05:00:07|DEBUG   |sqlite3worker                   |run: SELECT code3 FROM table_settings_languages WHERE enabled=1, []|
21/12/2019 05:00:07|DEBUG   |sqlite3worker                   |run: commit|
21/12/2019 05:00:07|DEBUG   |subliminal_patch.core           |external subs: scanning path /media/storage/Love, Simon (2018)/Love, Simon (2018).mkv|
21/12/2019 05:00:07|DEBUG   |subliminal_patch.core           |Found subtitles {u'Love, Simon (2018).en.srt': <Language [en]>, u'Love, Simon (2018).sub': None}|
21/12/2019 05:00:07|DEBUG   |subliminal_patch.core           |external subs: found {u'Love, Simon (2018).en.srt': <Language [en]>, u'Love, Simon (2018).sub': None}|
21/12/2019 05:00:07|DEBUG   |root                            |BAZARR falling back to file content analysis to detect language.|

BAZARR falling back to file content analysis to detect language is the last message before the process just dies.

morpheus65535 commented 4 years ago

Could you test with the dev branch please? I'm about to merge dev to master and I don't want to find a fix for 8.3.4 if it's fixed by "itself" in 8.4.

jasonla commented 4 years ago

Development throws errors on the config page.



Sorry, the requested URL 'http://192.168.1.119:6767/settings' caused an error:

Internal Server Error

Exception:

'%' must be followed by '%' or '(', found: '[redactedpassword]%[reactedpassword]'

Traceback:

Traceback (most recent call last):
  File "/app/bazarr/bazarr/../libs/bottle.py", line 866, in _handle
    return route.call(**args)
  File "/app/bazarr/bazarr/../libs/bottle.py", line 1744, in wrapper
    rv = callback(*a, **ka)
  File "/app/bazarr/bazarr/main.py", line 129, in wrapper
    return func(*a, **ka)
  File "/app/bazarr/bazarr/main.py", line 1191, in _settings
    return template('settings', bazarr_version=bazarr_version, settings=settings, settings_languages=settings_languages,
  File "/app/bazarr/bazarr/../libs/bottle.py", line 3623, in template
    return TEMPLATES[tplid].render(kwargs)
  File "/app/bazarr/bazarr/../libs/bottle.py", line 3413, in render
    self.execute(stdout, env)
  File "/app/bazarr/bazarr/../libs/bottle.py", line 3400, in execute
    eval(self.co, env)
  File "/app/bazarr/views/settings.tpl", line 73, in <module>
    % include('settings_subtitles.tpl')
  File "/app/bazarr/bazarr/../libs/bottle.py", line 3390, in _include
    return self.cache[_name].execute(env['_stdout'], env)
  File "/app/bazarr/bazarr/../libs/bottle.py", line 3400, in execute
    eval(self.co, env)
  File "/app/bazarr/views/settings_subtitles.tpl", line 383, in <module>
    % include('providers.tpl')
  File "/app/bazarr/bazarr/../libs/bottle.py", line 3390, in _include
    return self.cache[_name].execute(env['_stdout'], env)
  File "/app/bazarr/bazarr/../libs/bottle.py", line 3400, in execute
    eval(self.co, env)
  File "/app/bazarr/views/providers.tpl", line 499, in <module>
    <input name="settings_subscene_password" type="password" value="{{settings.subscene.password if settings.subscene.password != None else ''}}">
  File "/app/bazarr/bazarr/../libs/simpleconfigparser/__init__.py", line 59, in __getattr__
    return self.parser.get(self.section, name, raw, vars)
  File "/app/bazarr/bazarr/../libs/simpleconfigparser/__init__.py", line 129, in get
    return configparser.get(self, section, option, raw=raw, vars=vars).strip('"\'')
  File "/usr/lib/python3.8/configparser.py", line 799, in get
    return self._interpolation.before_get(self, section, option, value,
  File "/usr/lib/python3.8/configparser.py", line 395, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/lib/python3.8/configparser.py", line 442, in _interpolate_some
    raise InterpolationSyntaxError(
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: ```
morpheus65535 commented 4 years ago

Please provide your config.ini file. Could be something about a post-processing script?

morpheus65535 commented 4 years ago

I've made a small fix for your % somewhere in your config.ini file. You can update from dev branch and try again.

morpheus65535 commented 4 years ago

Is it fixed?

jasonla commented 4 years ago

I’m out on vacation so I can’t test it. I’ll get back the 5th.

On Jan 1, 2020, at 1:13 PM, morpheus65535 notifications@github.com wrote:

 Is it fixed?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jasonla commented 4 years ago

I'm back and I've been running the dev image (6914811e781e) for about 5 days now.

1) The change you made in commit d4fdee1e9f81d has allowed the config page to work, and it's parsing the subscene password correctly now. 👍

2) I haven't experienced the random crashes anymore, however, I did a clean install of Bazarr, so it's not trying to parse previously existing media. It's only been looking up media added after the fresh install. I'd like to keep this open for a little while longer while I add back the previous media to the monitor list.

Part of me wonders if it's some bad data that sonarr/radarr is passing back to bazarr that is causing these random crashes that don't have any explanation/logs in bazarr. 🤷‍♂

morpheus65535 commented 4 years ago

Thanks for the feedback. I'll keep it open for a couple of days then I'll close it if nothing else happen. If you feel the need, you can reopen it afterwards.