Taxel / PlexTraktSync

A python script that syncs the movies, shows and ratings between trakt and Plex (without needing a PlexPass or Trakt VIP subscription)
MIT License
1.62k stars 105 forks source link

Plex Server Timeout Error on Library Item #1827

Closed slunat closed 8 months ago

slunat commented 8 months ago

Confirmation

The problem

ERROR HTTPSConnectionPool(host='192-168-10-X.[redacted].plex.direct', port=32400): Read timed out. (read timeout=300)

I have been having this issue since trying to sync yesterday. It only gets so far into syncing my TV show library and fails everytime. It tends to fail on the same item a lot, but sometimes it des pass that item and fails on a different one. Yesterday I actually had it go all the way to 99% before timing out and crashing. I was initially having this issue on a previous version, I believe it was either 0.28.16 or 0.26.18, before updating it to .20 see if it would fix my issue.

I did do a search through existing issues and came across extending the Plex timeout to something longer than the default 30 seconds, which I tried by extending to 300 seconds. Unfortunately, I haven't noticed any improvement at all and it still stalls in the same place. It honestly feels like I'm maybe hitting rate limits or something with how it always locks up in the same place.

I have also tried deleting the cache file and the servers.yml and going through the connection steps again, but it still errors at the same point when running the sync.

I have pasted my logs and config below.

Steps to reproduce the behavior

  1. Run plextraktsync sync command

Error trace / logs

2024-02-23 15:33:47,938 INFO[PlexTraktSync]:PlexTraktSync [0.28.20]
2024-02-23 15:33:47,981 INFO[PlexTraktSync.PlexServerConnection]:Connecting with url: https://192-168-10-X.[redacted].plex.direct:32400, timeout 300 seconds
2024-02-23 15:33:48,124 INFO[PlexTraktSync]:Sync Movie sections: ['All Movies', 'Requested Movies']
2024-02-23 15:33:48,125 INFO[PlexTraktSync]:Sync Show sections: ['All TV']
2024-02-23 15:33:50,675 INFO[PlexTraktSync.TraktUserList]:Downloaded Trakt list 'Apple+ TV Shows/Series  2021-2025' (104 items): https://trakt.tv/lists/21100816
2024-02-23 15:33:50,680 INFO[PlexTraktSync.TraktUserList]:Downloaded Trakt list 'Disney+ TV Shows/Series (2021—2025)' (169 items): https://trakt.tv/lists/21100819
2024-02-23 15:33:50,687 INFO[PlexTraktSync.TraktUserList]:Downloaded Trakt list 'Netflix TV Shows/Series 2021-2025' (388 items): https://trakt.tv/lists/21100803
2024-02-23 15:33:50,692 INFO[PlexTraktSync.TraktUserList]:Downloaded Trakt list 'Top Ten Pirated Movies of The Week (Torrent Freak.com)' (10 items): https://trakt.tv/lists/21100890
2024-02-23 15:33:50,696 INFO[PlexTraktSync.TraktUserList]:Downloaded Trakt list 'Disney Plus' (126 items): https://trakt.tv/lists/24735000
2024-02-23 15:33:50,701 INFO[PlexTraktSync.TraktUserList]:Downloaded Trakt list 'Amazon Prime' (161 items): https://trakt.tv/lists/23472724
2024-02-23 15:33:50,706 INFO[PlexTraktSync.TraktUserList]:Downloaded Trakt list 'Netflix' (311 items): https://trakt.tv/lists/23472715
2024-02-23 15:33:50,711 INFO[PlexTraktSync.TraktUserList]:Downloaded Trakt list 'Apple TV' (127 items): https://trakt.tv/lists/23472732
2024-02-23 15:33:50,882 INFO[PlexTraktSync.TraktUserList]:Adding Air Force One Down (2024) (206877) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:52,887 INFO[PlexTraktSync.TraktUserList]:Adding The Iron Claw (2023) (206876) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:54,015 WARNING[PlexTraktSync]:Passengers Rearranged (2016): Skipping <PlexGuid:local://164387> because provider 'local' has no external Id
2024-02-23 15:33:55,555 INFO[PlexTraktSync]:All Movies processed in 7.0 seconds
2024-02-23 15:33:55,888 INFO[PlexTraktSync.TraktUserList]:Adding Air Force One Down (2024) (206920) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:55,892 WARNING[PlexTraktSync.TraktUserList]:Duplicate Air Force One Down (2024) #206877 with Air Force One Down (2024) #206920
2024-02-23 15:33:55,903 INFO[PlexTraktSync.TraktUserList]:Adding American Fiction (2023) (203307) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:55,906 WARNING[PlexTraktSync.TraktUserList]:Duplicate American Fiction (2023) #203270 with American Fiction (2023) #203307
2024-02-23 15:33:55,919 INFO[PlexTraktSync.TraktUserList]:Adding Anyone But You (2023) (203326) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:55,921 WARNING[PlexTraktSync.TraktUserList]:Duplicate Anyone But You (2023) #203282 with Anyone But You (2023) #203326
2024-02-23 15:33:55,927 INFO[PlexTraktSync.TraktUserList]:Adding Aquaman and the Lost Kingdom (2023) (201632) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:55,930 WARNING[PlexTraktSync.TraktUserList]:Duplicate Aquaman and the Lost Kingdom (2023) #201612 with Aquaman and the Lost Kingdom (2023) #201632
2024-02-23 15:33:55,960 INFO[PlexTraktSync.TraktUserList]:Adding The Beekeeper (2024) (201850) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:55,962 WARNING[PlexTraktSync.TraktUserList]:Duplicate The Beekeeper (2024) #201709 with The Beekeeper (2024) #201850
2024-02-23 15:33:56,323 WARNING[PlexTraktSync]:Disconnect: The Wedding Planner (2023): Skipping <PlexGuid:tvdb://342172> not found on Trakt
2024-02-23 15:33:56,985 INFO[PlexTraktSync.TraktUserList]:Adding The Iron Claw (2023) (206919) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:56,987 WARNING[PlexTraktSync.TraktUserList]:Duplicate The Iron Claw (2023) #206876 with The Iron Claw (2023) #206919
2024-02-23 15:33:57,368 INFO[PlexTraktSync.TraktUserList]:Adding The Marvels (2023) (200744) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:57,371 WARNING[PlexTraktSync.TraktUserList]:Duplicate The Marvels (2023) #200651 with The Marvels (2023) #200744
2024-02-23 15:33:57,451 INFO[PlexTraktSync.TraktUserList]:Adding Oppenheimer (2023) (177560) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:57,453 WARNING[PlexTraktSync.TraktUserList]:Duplicate Oppenheimer (2023) #164348 with Oppenheimer (2023) #177560
2024-02-23 15:33:58,127 WARNING[PlexTraktSync]:TheMoviesBoss the Noel Diary (2022): Skipping <PlexGuid:local://176966> because provider 'local' has no external Id
2024-02-23 15:33:58,167 WARNING[PlexTraktSync]:Una Torta Per L Uomo Giusto (2023): Skipping <PlexGuid:local://184657> because provider 'local' has no external Id
2024-02-23 15:33:58,332 WARNING[PlexTraktSync]:The Witches (2020): Skipping <PlexGuid:local://204655> because provider 'local' has no external Id
2024-02-23 15:33:58,341 INFO[PlexTraktSync.TraktUserList]:Adding Wonka (2023) (201453) to Plex list Top Ten Pirated Movies of The Week (Torrent Freak.com)
2024-02-23 15:33:58,343 WARNING[PlexTraktSync.TraktUserList]:Duplicate Wonka (2023) #201441 with Wonka (2023) #201453
2024-02-23 15:33:58,349 WARNING[PlexTraktSync]:Www Torrenting Com Bert Kreischer Razzle Dazzle (2023): Skipping <PlexGuid:local://177125> because provider 'local' has no external Id
2024-02-23 15:33:58,352 WARNING[PlexTraktSync]:Www Torrenting Com Nick Kroll Little Big Boy (2022): Skipping <PlexGuid:local://177122> because provider 'local' has no external Id
2024-02-23 15:33:58,354 WARNING[PlexTraktSync]:Www Torrenting Com Sommore Queen Chandelier (2023): Skipping <PlexGuid:local://184743> because provider 'local' has no external Id
2024-02-23 15:33:58,356 WARNING[PlexTraktSync]:Www Torrenting Com Who Are You Charlie Brown (2021): Skipping <PlexGuid:local://168017> because provider 'local' has no external Id
2024-02-23 15:33:58,373 INFO[PlexTraktSync]:Requested Movies processed in 2.8 seconds
2024-02-23 15:33:58,373 INFO[PlexTraktSync.Walker]:Preload shows data
2024-02-23 15:34:00,076 INFO[PlexTraktSync]:All TV processed in 1.7 seconds
2024-02-23 15:34:00,077 INFO[PlexTraktSync.Walker]:Preloaded shows data (899 shows)
2024-02-23 15:34:04,638 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e01/Cannibal Women in the Avocado Jungle of Death (2014): Skipping <PlexGuid:tmdb://3785983> not found on Trakt
2024-02-23 15:34:04,643 WARNING[PlexTraktSync]:13 Nights of Elvira (2014): Skipping <PlexGuid:tmdb://204121> not found on Trakt
2024-02-23 15:34:04,648 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e02/Puppet Master (2014): Skipping <PlexGuid:tmdb://4282202> not found on Trakt
2024-02-23 15:34:04,652 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e03/Dollman (2014): Skipping <PlexGuid:tmdb://4282212> not found on Trakt
2024-02-23 15:34:04,657 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e04/Evil bong (2014): Skipping <PlexGuid:tmdb://4282230> not found on Trakt
2024-02-23 15:34:04,661 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e05/The Gingerdead Man (2014): Skipping <PlexGuid:tmdb://4282235> not found on Trakt
2024-02-23 15:34:04,665 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e06/Hideous! (2014): Skipping <PlexGuid:tmdb://4282236> not found on Trakt
2024-02-23 15:34:04,670 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e07/Hobgoblins (2014): Skipping <PlexGuid:tmdb://4282237> not found on Trakt
2024-02-23 15:34:04,675 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e08/Oblivion (2014): Skipping <PlexGuid:tmdb://4282238> not found on Trakt
2024-02-23 15:34:04,681 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e09/Demonic Toys (2014): Skipping <PlexGuid:tmdb://4282239> not found on Trakt
2024-02-23 15:34:04,685 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e10/Seed People (2014): Skipping <PlexGuid:tmdb://4282240> not found on Trakt
2024-02-23 15:34:04,689 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e11/Shrunken Heads (2014): Skipping <PlexGuid:tmdb://4282241> not found on Trakt
2024-02-23 15:34:04,694 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e12/Trancers (2014): Skipping <PlexGuid:tmdb://4282242> not found on Trakt
2024-02-23 15:34:04,698 WARNING[PlexTraktSync]:13 Nights of Elvira/s01e13/Night of the Living Dead (2014): Skipping <PlexGuid:tmdb://4282243> not found on Trakt
2024-02-23 15:34:05,016 WARNING[PlexTraktSync]:28 Days Haunted/s01e28/Episode 28: Skipping <PlexGuid:local://206172> because provider 'local' has no external Id
2024-02-23 15:34:06,115 WARNING[PlexTraktSync]:Archer/s03e00/Episode 0: Skipping <PlexGuid:local://172913> because provider 'local' has no external Id
2024-02-23 15:34:07,476 WARNING[PlexTraktSync]:The Blacklist/s05e00/Episode 0: Skipping <PlexGuid:local://181643> because provider 'local' has no external Id
2024-02-23 15:34:08,025 WARNING[PlexTraktSync]:Brassic/s05e09/A Very Brassic Christmas (2023): Skipping <PlexGuid:tmdb://5018356> not found on Trakt
2024-02-23 15:34:08,800 WARNING[PlexTraktSync]:El Chapo/s01e08/Episode 8: Skipping <PlexGuid:local://184157> because provider 'local' has no external Id
2024-02-23 15:34:08,818 WARNING[PlexTraktSync]:El Chapo/s01e09/Episode 9: Skipping <PlexGuid:local://184158> because provider 'local' has no external Id
2024-02-23 15:34:09,758 WARNING[PlexTraktSync]:Curb Your Enthusiasm/s01e00/Episode 0: Skipping <PlexGuid:local://203357> because provider 'local' has no external Id
2024-02-23 15:34:10,377 WARNING[PlexTraktSync]:Derek/s00e15/Episode 15 (2012): Skipping <PlexGuid:local://202020> because provider 'local' has no external Id
2024-02-23 15:34:10,394 WARNING[PlexTraktSync]:Derek/s01e00/Episode 0: Skipping <PlexGuid:local://202012> because provider 'local' has no external Id
2024-02-23 15:34:12,361 WARNING[PlexTraktSync]:Fraggle Songs/s03e11/The Beanbarrow, The Burden And The Bright Bouquet (1985): Skipping <PlexGuid:tmdb://953495> not found on Trakt
2024-02-23 15:34:12,403 WARNING[PlexTraktSync]:Fresh Meat/s00e01/Episode 1: Skipping <PlexGuid:local://178258> because provider 'local' has no external Id
2024-02-23 15:34:12,581 WARNING[PlexTraktSync]:Fresh Meat/s00e03/Episode 3: Skipping <PlexGuid:local://178260> because provider 'local' has no external Id
2024-02-23 15:34:12,597 WARNING[PlexTraktSync]:Fresh Meat/s00e04/Episode 4: Skipping <PlexGuid:local://178261> because provider 'local' has no external Id
2024-02-23 15:34:12,619 WARNING[PlexTraktSync]:Fresh Meat/s00e05/Episode 5: Skipping <PlexGuid:local://178262> because provider 'local' has no external Id
2024-02-23 15:34:12,636 WARNING[PlexTraktSync]:Fresh Meat/s00e06/Episode 6: Skipping <PlexGuid:local://178263> because provider 'local' has no external Id
2024-02-23 15:34:12,654 WARNING[PlexTraktSync]:Fresh Meat/s00e07/Episode 7: Skipping <PlexGuid:local://178264> because provider 'local' has no external Id
2024-02-23 15:34:12,671 WARNING[PlexTraktSync]:Fresh Meat/s00e08/Episode 8: Skipping <PlexGuid:local://178265> because provider 'local' has no external Id
2024-02-23 15:34:12,693 WARNING[PlexTraktSync]:Fresh Meat/s00e09/Episode 9: Skipping <PlexGuid:local://178266> because provider 'local' has no external Id
2024-02-23 15:34:12,709 WARNING[PlexTraktSync]:Fresh Meat/s00e10/Episode 10: Skipping <PlexGuid:local://178267> because provider 'local' has no external Id
2024-02-23 15:34:12,725 WARNING[PlexTraktSync]:Fresh Meat/s00e11/Episode 11: Skipping <PlexGuid:local://178268> because provider 'local' has no external Id
2024-02-23 15:34:12,741 WARNING[PlexTraktSync]:Fresh Meat/s00e12/Episode 12: Skipping <PlexGuid:local://178269> because provider 'local' has no external Id
2024-02-23 15:34:12,758 WARNING[PlexTraktSync]:Fresh Meat/s00e13/Episode 13: Skipping <PlexGuid:local://178270> because provider 'local' has no external Id
2024-02-23 15:34:12,774 WARNING[PlexTraktSync]:Fresh Meat/s00e14/Episode 14: Skipping <PlexGuid:local://178271> because provider 'local' has no external Id
2024-02-23 15:34:12,803 WARNING[PlexTraktSync]:Fresh Meat/s00e15/Episode 15: Skipping <PlexGuid:local://178272> because provider 'local' has no external Id
2024-02-23 15:34:12,832 WARNING[PlexTraktSync]:Fresh Meat/s00e16/Episode 16: Skipping <PlexGuid:local://178273> because provider 'local' has no external Id
2024-02-23 15:34:12,850 WARNING[PlexTraktSync]:Fresh Meat/s00e17/Episode 17: Skipping <PlexGuid:local://178274> because provider 'local' has no external Id
2024-02-23 15:34:12,871 WARNING[PlexTraktSync]:Fresh Meat/s00e18/Episode 18: Skipping <PlexGuid:local://178275> because provider 'local' has no external Id
2024-02-23 15:34:12,888 WARNING[PlexTraktSync]:Fresh Meat/s00e19/Episode 19: Skipping <PlexGuid:local://178276> because provider 'local' has no external Id
2024-02-23 15:34:12,905 WARNING[PlexTraktSync]:Fresh Meat/s00e20/Episode 20: Skipping <PlexGuid:local://178277> because provider 'local' has no external Id
2024-02-23 15:34:12,925 WARNING[PlexTraktSync]:Fresh Meat/s00e21/Episode 21: Skipping <PlexGuid:local://178278> because provider 'local' has no external Id
2024-02-23 15:34:12,940 WARNING[PlexTraktSync]:Fresh Meat/s00e22/Episode 22: Skipping <PlexGuid:local://178279> because provider 'local' has no external Id
2024-02-23 15:34:12,958 WARNING[PlexTraktSync]:Fresh Meat/s00e23/Episode 23: Skipping <PlexGuid:local://178280> because provider 'local' has no external Id
2024-02-23 15:34:12,975 WARNING[PlexTraktSync]:Fresh Meat/s00e24/Episode 24: Skipping <PlexGuid:local://178281> because provider 'local' has no external Id
2024-02-23 15:34:12,991 WARNING[PlexTraktSync]:Fresh Meat/s00e25/Episode 25: Skipping <PlexGuid:local://178282> because provider 'local' has no external Id
2024-02-23 15:34:13,006 WARNING[PlexTraktSync]:Fresh Meat/s00e26/Episode 26: Skipping <PlexGuid:local://178283> because provider 'local' has no external Id
2024-02-23 15:34:13,024 WARNING[PlexTraktSync]:Fresh Meat/s00e27/Episode 27: Skipping <PlexGuid:local://178284> because provider 'local' has no external Id
2024-02-23 15:34:13,045 WARNING[PlexTraktSync]:Fresh Meat/s00e28/Episode 28: Skipping <PlexGuid:local://178285> because provider 'local' has no external Id
2024-02-23 15:34:13,058 WARNING[PlexTraktSync]:Fresh Meat/s00e29/Episode 29: Skipping <PlexGuid:local://178286> because provider 'local' has no external Id
2024-02-23 15:34:13,078 WARNING[PlexTraktSync]:Fresh Meat/s00e30/Episode 30: Skipping <PlexGuid:local://178287> because provider 'local' has no external Id
2024-02-23 15:34:13,096 WARNING[PlexTraktSync]:Fresh Meat/s00e31/Episode 31: Skipping <PlexGuid:local://178288> because provider 'local' has no external Id
2024-02-23 15:34:13,112 WARNING[PlexTraktSync]:Fresh Meat/s00e32/Episode 32: Skipping <PlexGuid:local://178289> because provider 'local' has no external Id
2024-02-23 15:34:13,128 WARNING[PlexTraktSync]:Fresh Meat/s00e33/Episode 33: Skipping <PlexGuid:local://178290> because provider 'local' has no external Id
2024-02-23 15:34:13,146 WARNING[PlexTraktSync]:Fresh Meat/s00e34/Episode 34: Skipping <PlexGuid:local://178291> because provider 'local' has no external Id
2024-02-23 15:34:13,176 WARNING[PlexTraktSync]:Fresh Meat/s00e35/Episode 35: Skipping <PlexGuid:local://178292> because provider 'local' has no external Id
2024-02-23 15:34:14,150 WARNING[PlexTraktSync]:Goofy in How to Stay at Home/s01e04/Episode 4: Skipping <PlexGuid:local://188813> because provider 'local' has no external Id
2024-02-23 15:34:14,162 INFO[PlexTraktSync]:Adding to collection: The Grand Tour/s03e11/Sea to Unsalty Sea (2019)
2024-02-23 15:39:14,252 ERROR[PlexTraktSync]:HTTPSConnectionPool(host='192-168-10-X.[redacted].plex.direct', port=32400): Read timed out. (read timeout=300)
Traceback (most recent call last):
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/urllib3/connectionpool.py", line 537, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/urllib3/connection.py", line 466, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 1374, in getresponse
    response.begin()
  File "/usr/lib/python3.11/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 706, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1278, in recv_into
    return self.read(nbytes, buffer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ssl.py", line 1134, in read
    return self._sslobj.read(len, buffer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

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

Traceback (most recent call last):
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/urllib3/connectionpool.py", line 847, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/urllib3/connectionpool.py", line 793, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/urllib3/connectionpool.py", line 539, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/urllib3/connectionpool.py", line 370, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='192-168-10-X.[redacted].plex.direct', port=32400): Read timed out. (read timeout=300)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/cli.py", line 26, in wrap
    cmd(*args, **kwargs)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/commands/sync.py", line 68, in sync
    runner.sync(walker=w, dry_run=config.dry_run)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/sync.py", line 79, in sync
    self.sync_collection(episode, dry_run=dry_run)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/sync.py", line 119, in sync_collection
    m.add_to_collection()
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/media/Media.py", line 141, in add_to_collection
    self.trakt_api.add_to_collection(self.trakt, self.plex)
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/trakt/TraktApi.py", line 189, in add_to_collection
    item = dict(**m.ids, **pm.to_json())
                           ^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/plex/PlexLibraryItem.py", line 393, in to_json
    "resolution": self.resolution,
                  ^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/plex/PlexLibraryItem.py", line 242, in resolution
    stream = self.video_streams[0]
             ^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plextraktsync/plex/PlexLibraryItem.py", line 194, in video_streams
    return self.item.videoStreams()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plexapi/base.py", line 778, in videoStreams
    self.reload()
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plexapi/base.py", line 395, in reload
    return self._reload(key=key, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plexapi/base.py", line 404, in _reload
    data = self._server.query(key)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/plexapi/server.py", line 759, in query
    response = method(url, headers=headers, timeout=timeout, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/requests_cache/session.py", line 126, in get
    return self.request('GET', url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/requests_cache/session.py", line 182, in request
    return super().request(method, url, *args, headers=headers, **kwargs)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/requests_cache/session.py", line 229, in send
    response = self._send_and_cache(request, actions, cached_response, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/requests_cache/session.py", line 253, in _send_and_cache
    response = super().send(request, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/plextraktsync/lib/python3.11/site-packages/requests/adapters.py", line 532, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='192-168-10-X.[redacted].plex.direct', port=32400): Read timed out. (read timeout=300)

Expected behavior

script does not time out and runs sync to completion.

Inspect of problematic items

No response

Workarounds

No response

Install method

pipx

Config file contents

cache:
  path: $PTS_CACHE_DIR/trakt_cache

# You may want to use per server libraries config instead:
# - https://github.com/Taxel/PlexTraktSync#libraries
excluded-libraries:
  - Downloaded TV
  - Requested TV
  - Downloaded Movies
  - Requested Movies
  - Downloaded Kids Movies
  - Downloaded Bollywood Movies
  - Weddings
  - Drone Footage
config:
  dotenv_override: true

plex:
  timeout: 300

logging:
  append: true
  # Whether to show timestamps in console messages
  console_time: false
  debug: false
  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
sync:
  # 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

  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

# 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

0.28.20

Python Version

3.11.2

Plex Server Version

1.40.0.7998-c29d4c0c8

Operating System and Version

Proxmox Container, Debian 12 Standard 12.2-1

glensc commented 8 months ago

This is clearly problem at plex server side. Check it's logs, enable it's debug logging. There's no rate limits towards plex server. Might be slow io so it fails to process some item. but 300s is quite long timeout already.

glensc commented 8 months ago

Try syncing only problematic item only. Try figuring out what the problematic item is.

This might help with debug:

but it assumes the crash happens after plex has given out the id, seems in your case it timeouts before that.

glensc commented 8 months ago

You should also disable sync features to minimize the effect. at least the logs would be less noisy if you (for example) don't sync liked lists.

slunat commented 8 months ago

I think I have found the culprit. The specific media item (Grand Tour S03E11) that it was trying to add to collection had not yet had the metadata scan in Plex completed for it, which meant Plex did not yet know what format the file was in. After I manually added that item to the trakt collection, I re-ran the script and it managed to go past that episode, but failed the next one. After checking the episode it was failing, it also had not yet had the metadata scan completed.

You will know better than me, but I suspect the script is hanging trying to grab the media information like the resolution and audio from Plex as it adds this data when adding it to collection. However in the instance the metadata scan has not yet completed, the script will hang trying to add to collection since the data does not exist in Plex.

I don't see this being a common issue at all, it was related to a separate problem that was preventing those specific media items to not be able to be scanned for metadata as I had left them scanning for several hours and they still wouldnt complete. I do think that was more of a local file issue than anything else and I have not had this issue with other stuff. I have since removed those files from my library and the scan has been able to complete successfully without failing.

I suppose if anything, maybe add some sort of way to have the script skip adding files to collection that are missing metadata or maybe just add them without the data, so that the script doesn't hang and fail and instead can happily sync everything else it can. As I say though I don't particularly think this is a common issue at all.

glensc commented 8 months ago

You will know better than me, but I suspect the script is hanging trying to grab the media information like the resolution and audio from Plex as it adds this data when adding it to collection. However in the instance the metadata scan has not yet completed, the script will hang trying to add to collection since the data does not exist in Plex.

I think if you skip "collection" feature (collection: false), then it will not try to obtain info about media files

glensc commented 8 months ago

I suppose if anything, maybe add some sort of way to have the script skip adding files to collection that are missing metadata or maybe just add them without the data, so that the script doesn't hang and fail and instead can happily sync everything else it can. As I say though I don't particularly think this is a common issue at all.

this is automatic. if item has no match, then it's not processed, at least the "collection" task will be skipped. you can force manually with "Unmatch".

slunat commented 8 months ago

You will know better than me, but I suspect the script is hanging trying to grab the media information like the resolution and audio from Plex as it adds this data when adding it to collection. However in the instance the metadata scan has not yet completed, the script will hang trying to add to collection since the data does not exist in Plex.

I think if you skip "collection" feature (collection: false), then it will not try to obtain info about media files

I know but this also completely turns off the collections feature which I still want to function. I like being able to see what is already in my library in Trakt so I don’t add it to the list and have it download again.

slunat commented 8 months ago

I suppose if anything, maybe add some sort of way to have the script skip adding files to collection that are missing metadata or maybe just add them without the data, so that the script doesn't hang and fail and instead can happily sync everything else it can. As I say though I don't particularly think this is a common issue at all.

this is automatic. if item has no match, then it's not processed, at least the "collection" task will be skipped. you can force manually with "Unmatch".

sure but that’s about matching the content. I’m talking specifically about content that has successfully matched, but the metadata in Plex is missing because Plex has not scanned the metadata of the file yet. So if I go to the media item in Plex and click on get info, it tells me nothing about the files format at all because it hasn’t scanned that data yet. In that scenario, the script breaks so a way for the script to skip these items in this scenario would be ideal. Like I say though I don’t think this is a massively common scenario so I wouldn’t blame you for not wanting to spend time working on that. In most cases people will have plextraktsync scheduled to run so it should complete on the next run. In my case I spent two days trying to fix this issue because the same media item was refusing to retrieve metadata.

glensc commented 8 months ago

so I wouldn’t blame you for not wanting to spend time working on that

the thing is, there's nothing can be done. as it's plex media server internals that's broken.

I know but this also completely turns off the collections feature which I still want to function.

i gave as info, so you can test if that prevents the timeout or not. can you test this?

I’m talking specifically about content that has successfully matched, but the metadata in Plex is missing because Plex has not scanned the metadata of the file yet.

i proposed the unmatch, to see if this could be used as band-aid for timeout problem. can you test this?

slunat commented 8 months ago

Sorry I can’t test this. The items in my library that were missing the metadata now have the metadata and so the script is running through successfully and not timing out. Without being in that situation again I can’t test this and I don’t know of a way to manually put it in that situation. If it happens again and I notice it I’ll try it.