Taxel / PlexTraktSync

A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with container crashing randomly

coreyh74 opened this issue · comments

Confirmation

  • I have read the README.md on the project homepage
  • I have checked if identical issue already exists
  • I have tried downgrading to find version that can be used as a workaround

The problem

I am trying to run PlexTraktSync and it is running for a short while, and then it will crash the container. It is random when it happens. It could be after a few minutes, or sometimes its 30 minutes or so. It is running all the collections, etc. I am attaching the most newest log from the last run. I did turn off the collections and it does the sync watch just fine, but once I turn collections back on, it will crash randomly. Trying to do the initial collection scan. It wouldn't let me paste my whole log here, so I copy/pasted towards the end when it crashed. Hope it helps.

Error trace / logs

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 454, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/http/client.py", line 1378, in getresponse
    response.begin()
  File "/usr/local/lib/python3.11/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 844, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 538, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 370, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='REMOVED', port=80): Read timed out. (read timeout=30)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/plextraktsync/cli.py", line 25, in wrap
    cmd(*args, **kwargs)
  File "/app/plextraktsync/commands/sync.py", line 68, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/app/plextraktsync/sync.py", line 66, in sync
    self.sync_collection(movie, dry_run=dry_run)
  File "/app/plextraktsync/sync.py", line 128, in sync_collection
    m.add_to_collection()
  File "/app/plextraktsync/media.py", line 137, in add_to_collection
    self.trakt_api.add_to_collection(self.trakt, self.plex)
  File "/app/plextraktsync/trakt/TraktApi.py", line 182, in add_to_collection
    **pm.to_json(),
      ^^^^^^^^^^^^
  File "/app/plextraktsync/plex/PlexLibraryItem.py", line 325, in to_json
    "resolution": self.resolution,
                  ^^^^^^^^^^^^^^^
  File "/app/plextraktsync/plex/PlexLibraryItem.py", line 209, in resolution
    stream = self.video_streams[0]
             ^^^^^^^^^^^^^^^^^^
  File "/app/plextraktsync/plex/PlexLibraryItem.py", line 161, in video_streams
    return self.item.videoStreams()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/plexapi/video.py", line 105, in videoStreams
    self.reload()
  File "/usr/local/lib/python3.11/site-packages/plexapi/base.py", line 382, in reload
    return self._reload(key=key, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/plexapi/base.py", line 391, in _reload
    data = self._server.query(key)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/plexapi/server.py", line 746, in query
    response = method(url, headers=headers, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests_cache/session.py", line 103, in get
    return self.request('GET', url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests_cache/session.py", line 159, in request
    return super().request(method, url, *args, headers=headers, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests_cache/session.py", line 206, in send
    response = self._send_and_cache(request, actions, cached_response, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests_cache/session.py", line 230, in _send_and_cache
    response = super().send(request, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 532, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='REMOVED', port=80): Read timed out. (read timeout=30)
2023-07-08 07:03:15,220 DEBUG[PlexTraktSync.BackgroundTask]:Shutdown, run timed events now

Expected behavior

to continue to sync collections

Steps to reproduce the behavior

docker-compose up -d plextraktsync

Inspect of problematic items

No response

Workarounds

No response

Install method

docker-compose

Config file contents

cache:
  path: $PTS_CACHE_DIR/trakt_cache

excluded-libraries:
  - Concerts
  - Fitness

config:
  dotenv_override: true

plex:
  timeout: 300

logging:
  append: true
  # Whether to show timestamps in console messages
  console_time: false
  debug: true
  filename: plextraktsync.log
  # Additional logger names to apply filtering
  filter_loggers:
#    - plexapi
#    - requests_cache.backends
#    - requests_cache.backends.base
#    - requests_cache.backends.sqlite
#    - requests_cache.policy.actions
#    - requests_cache.session
#    - trakt.core
#    - urllib3.connectionpool
  filter:
#    # Filter out all messages with level WARNING
#    - level: WARNING
#    # Filter out message with level WARNING and containing a text
#    - level: WARNING
#      message: "not found on Trakt"
#    - message: "because provider local has no external Id"
#    - message: "because provider none has no external Id"
#    - message: "Retry using search for specific Plex Episode"
#    # Filter out messages by requests_cache
#    - name: requests_cache.backends
#    - name: requests_cache.backends.base
#    - name: requests_cache.backends.sqlite
#    - name: requests_cache.policy.actions
#    - name: requests_cache.session

# settings for 'sync' command (default)
sync:
  plex_to_trakt:
    collection: true
    # Clear collected state of items not present in Plex
    clear_collected: false
    ratings: true
    watched_status: true
    # If plex_to_trakt watchlist=false and trakt_to_plex watchlist=true
    # the Plex watchlist will be overwritten by Trakt watchlist
    watchlist: true
  trakt_to_plex:
    liked_lists: true
    ratings: true
    watched_status: true
    # If trakt_to_plex watchlist=false and plex_to_trakt watchlist=true
    # the Trakt watchlist will be overwritten by Plex watchlist
    watchlist: true
    # If you prefer to fetch trakt watchlist as a playlist instead of
    # plex watchlist, toggle this to true (is read only if watchlist=true)
    watchlist_as_playlist: false
  # Setting for whether ratings from one platform should have priority.
  # Valid values are trakt, plex or none. (default: plex)
  # none - No rating priority. Existing ratings are not overwritten.
  # trakt - Trakt ratings have priority. Existing Plex ratings are overwritten.
  # plex - Plex ratings have priority. Existing Trakt ratings are overwritten.
  rating_priority: plex

# settings for 'watch' command
watch:
  add_collection: false
  remove_collection: false
  # what video watched percentage (0 to 100) triggers the watched status
  scrobble_threshold: 80
  # true to scrobble only what's watched by you, false for all your PMS users
  username_filter: true
  # Show the progress bar of played media in terminal
  media_progressbar: true

xbmc-providers:
  movies: imdb
  shows: tvdb

##### Advanced settings below this line, don't edit unless you know what you're doing #####
#http_cache:
  # https://requests-cache.readthedocs.io/en/main/user_guide/expiration.html#url-patterns
  # https://requests-cache.readthedocs.io/en/main/user_guide/expiration.html#expiration-values
  #
  # The value is seconds to cache.
  # Or one of the following special values:
  # - DO_NOT_CACHE: Skip both reading from and writing to the cache
  # - EXPIRE_IMMEDIATELY: Consider the response already expired, but potentially usable
  # - NEVER_EXPIRE: Store responses indefinitely
  #
  # The value can be also suffixed with a time unit:
  # - 5m, 1h, 3d
  # See full documentation at:
  # - https://github.com/wroberts/pytimeparse#pytimeparse-time-expression-parser
  #
  # NOTE: If there is more than one match, the first match will be used in the order they are defined
#  policy:
#    "*.trakt.tv/users/me": 1d
#    "*.trakt.tv/users/likes/lists": DO_NOT_CACHE

# vim:ts=2:sw=2:et

Version

latest

Python Version

n/a

Operating System and Version

Ubuntu 22.04

Duplicate of #1455