Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full Sync Using Kitana Not Working / "failed (Trakt.tv: The read operation timed out" / "Max retries exceeded with url [...] Caused by ReadTimeoutError" #635

Open
jeff15110168 opened this issue Dec 23, 2022 · 7 comments

Comments

@jeff15110168
Copy link

So I had been using Cornishman's fork from 12/18/21 (specifically the 5:45PM EST 0519e91 branch) and given the recent Trakt crash, was trying to see if it was possible to re-push all my Plex watched activity to Trakt now that the API was back up as of 12/20/22. I wasn't able to actually push Plex -> Trakt using Kitana functionality so I ended up just manually marking in Trakt itself what I watched in the ~9-10 day period Trakt was down. While doing that task, I did find out that I actually was using an older fork of Plex-Trakt-Scrobbler as @rg9400 had a newer fork 962b72f dated 8/18/22.

Naturally - I updated to rg9400's fork (was hoping that maybe the reason Plex -> Trakt wasn't pushing updates would be fixed with this rg9400 fork + I have a separate issue that if I mark something as watched in Trakt i.e. I watch a movie in theaters / its not yet in my my Plex library, then eventually I do add it to Plex, it won't pull the watched status from Trakt). I watched a show and saw that Active Scrobbling works with rg9400's fork installed but when I went into Kitana to try run a full sync or "push all to trakt.tv", I get the error message: "Last run 1 minute ago, taking 1 minute, failed (Trakt.tv: The read operation timed out)." I opened the trakt plugin log (Logs/PPMS Plugin Logs/PMS Plugin/com.plexapp.plugins.trakttv.log) and get the error message at the bottom.

I reverted back to Cornishman's 0519e91 12/18/21 fork and I no longer have that read error ("full sync: Last run 49 seconds ago, taking 50 seconds, was successful") when trying a full sync in Kitana so something specific with rg9400 seems to be conflicting with my Plex setup. I do remember a year ago troubleshooting with Cornishman some Plex authentication issues (detailed in thread here: #596 (comment)) so I'm wondering if its related at all to this or maybe if the smart folks here know what could be causing my setup issues with rg9400's fork. I'd like to be able to use the latest and greatest Plex-Trakt-Scrobbler from rg9400 if i can figure out the specific issue causing this.

bigger snippet of log using rg9400 fork:
https://gist.github.com/jeff15110168/f0a12671f9cb1522702a1be2268db45f

2022-12-23 10:00:49,074 - plugin.sync.main (151626498b38) : WARNING (plugin.sync.main:177) - Exception raised in sync task: MaxRetryError: HTTPSConnectionPool(host='api.trakt.tv', port=443): Max retries exceeded with url: /sync/collection (Caused by ReadTimeoutError("HTTPSConnectionPool(host='api.trakt.tv', port=443): Read timed out. (read timeout=24)")) Traceback (most recent call last): File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/main.py", line 173, in run_wrapper self.run() File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/main.py", line 260, in run 'stop' File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/main.py", line 277, in _trigger func() File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/elapsed/main.py", line 64, in inner return func(*args, **kwargs) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/modes/full.py", line 46, in finish self.current.artifacts.send() File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/core/task/artifacts.py", line 30, in send self.send_actions() File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/elapsed/main.py", line 64, in inner return func(*args, **kwargs) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/core/task/artifacts.py", line 47, in send_actions self.send_action(data, action, **request) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/core/task/artifacts.py", line 101, in send_action response = func(kwargs) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/interfaces/base/__init__.py", line 20, in wrap return func(*args, **kwargs) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/interfaces/sync/core/mixins.py", line 70, in add 'validate_token' File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/core/http.py", line 152, in post return self.request('POST', path, params, data, **kwargs) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/core/http.py", line 107, in request return self.send(prepared) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/trakt/core/http.py", line 125, in send response = self.session.send(request, timeout=timeout) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/requests/sessions.py", line 609, in send r = adapter.send(request, **kwargs) File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/requests/adapters.py", line 487, in send raise ConnectionError(e, request=request) ConnectionError: MaxRetryError: HTTPSConnectionPool(host='api.trakt.tv', port=443): Max retries exceeded with url: /sync/collection (Caused by ReadTimeoutError("HTTPSConnectionPool(host='api.trakt.tv', port=443): Read timed out. (read timeout=24)")) 2022-12-23 10:00:51,776 - plex_activity.sources.s_logging.main (1516265b5b38) : INFO (plex_activity.sources.s_logging.main:84) - Unable to read log file 2022-12-23 10:00:59,136 - plugin.core.backup.sources.database (151626498b38) : INFO (plugin.core.backup.sources.database:25) - [trakt/1] Backing up database to '/config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.plugins.trakttv/Backups/trakt/1.bgr/2022/12/23_100059_28828.db'

@jeff15110168
Copy link
Author

jeff15110168 commented Dec 23, 2022

Adding relevant commentary from a concurrent reddit thread if helpful:

enchained:

I was also looking for the most up-to-date fork (currently using the official, but plan to upgrade agents someday anyway, and the official won't sync now due to the token bug).

From the commit history it looks like both forks token fix is identical:

0519e91

5fc3d4b

The only other change I could find in rg9400 2022 commits is this one #622 (comment) In theory you can apply it manually by editing Cornishman's fork library.py file like this 5fc3d4b#diff-88357b9d9d8c7642ac11f7d72ca2e12a997085bd91e4bdc4eed9d97728a65a4c

Looks like older commits from both forks just address new agents compatibility issues, but coded in a different way, and I am not sure which one to use and whether your error is connected to those changes or it's just a Trakt API issue. Since those fixes came in different years, maybe there's more info in related issues threads.

Did you check your sync results on Trakt after that successful full sync? Is everything as expected?

Actually it looks like rg9400 fixes were already merged to the official master branch in 2020, and Cornishman 2021 fixes were dedicated to later issues with those new agents (described here in details: #596)

So I'd think the best way would be to use Cornishman fork + rg9400 timestamp fix (seems like it is important if you care about collection sync). To fix that you just need to stop Plex server, find Trakttv.bundle folder, and either apply the highlighted lines on the right from the diff I linked by editing the file in Notepad, or simply replace library.py file with this one: https://raw.githubusercontent.com/trakt/Plex-Trakt-Scrobbler/5fc3d4bc8f0b5413f648cdbb2366850927166075/Trakttv.bundle/Contents/Libraries/Shared/plex_database/library.py

By checking sync results I meant opening Trakt history and seeing whether the missing scrobbles appeared, how the collection is doing, etc. I couldn't find any logs of sync or "sorting by added" on the Trakt side, so this might be the only way to confirm sync results.

@enchained
Copy link

ReadTimeoutError looks like it is something temporary - it appeared for me on the first full sync of Cornishman's fork, but the second sync few minutes later was successful.

I had an old plugin version and it looks like sync didn't work for me at all since 2021 (collection wasn't updating on trakt), but the realtime activity scrobbling worked fine before the service downtime.

When I made full sync on the fork, only collection Items were synced to trakt, missed plex watches after Dec 11 downtime did not sync, but I do not even now if they're supposed to - I always used scrobbling instead.

As for all the forks, I did a quick investigation (but didn't have the time to dig deep into the issue threads), and the timeline looks something like this:


Original plugin: https://github.com/trakt/Plex-Trakt-Scrobbler/

Latest release with only old Plex agents support: 1.3.3 (2018)


New agent support from rg9400 (i.e. all commits in his fork from 2020) was merged to the official repo in 2020 without a dedicated release (not sure if it is still compatible with old agents). To get this version you need to download zip from master branch of the official plugin.


In 2021 some other issues were fixed regarding new agents: #596

Fixes are in the master branch of https://github.com/Cornishman/Plex-Trakt-Scrobbler

Old agents didn’t work for me with this fork (not sure if supposed to).


Other fixes came after that:


  1. Plex token error fix for new plex servers:

Info: #615

Branch: https://github.com/Cornishman/Plex-Trakt-Scrobbler/tree/scrobble_fix_with_PlexOnlineToken_fix


  1. In 2022 sync started clearing out collection on trakt:

Info: #622 (comment)

Timestamp fix was made (commit also includes previous token fix):

Commit: 5fc3d4b


  1. This typo (identiifers) fix somehow wasn’t included in 1.3.3 or any of the forks, so it needs to be applied manually (this typo causes error in the logs):

Commit: 4d9b1e3


Conclusions:

For old agents: use 1.3.3 version + token fix + timestamp fix + typo fix (tested activity scrobbling and collection sync to trakt, but sync of previously watched episodes to trakt and playlists pull from trakt do not work for me).

For new agents: use https://github.com/Cornishman/Plex-Trakt-Scrobbler/tree/scrobble_fix_with_PlexOnlineToken_fix + timestamp fix + typo fix (just a recommendation, can’t test this until I upgrade my agents).


If I’ll have the time I may create a fork with 2 branches for both cases with proper descriptions, but listed fixes are small and can be easily applied manually in the meantime.

In the future, active forks can be discovered here: https://useful-forks.github.io/?repo=trakt/Plex-Trakt-Scrobbler

@jeff15110168
Copy link
Author

jeff15110168 commented Dec 25, 2022

So I just used rg9400 8/18/22 fork and marked a movie in Trakt (and rated it) and this morning I saw that my Plex picked up the watch status as watched / pushed the ratings. So Trakt -> Plex sync'd properly despite the error message. I also tried the opposite - marked a movie as watched in Plex and it pushed that update to my Trakt as watched too.

So I guess this goes to your first point that... active scrobbling is working, Trakt <-> Plex updates are working too, so what really is the significance of "sync failure"?

I need to read your other comments more closely - I'm using rg9400 but you're recommending I switch back to 12/18/21 Cornishman and manually apply two updates to have latest and greatest plugin?

@Mushin
Copy link

Mushin commented Jan 4, 2023

Has anyone got collections confirmed syncing with new agent please, using the above method?

Edit: confirmed this method works with new agent. Full collection syncing again. (make sure to clear cache on trakt after sync) #635 (comment)

@Wolf666
Copy link

Wolf666 commented Feb 8, 2023

use https://github.com/Cornishman/Plex-Trakt-Scrobbler/tree/scrobble_fix_with_PlexOnlineToken_fix + timestamp fix + typo fix

Definitely works with Plex 1.31.0.6654

@enchained
Copy link

this shows every time I try to update the pin in the plugin settings

I signed into the Plex and Trakt accounts here for each user http://trakt-for-plex.github.io/configuration and it worked (but I have older server version - 1.25.3.5409). I did not try setting up accounts via plugin settings in Kitana, since most settings are covered by that page already.

@karadoulis
Copy link

Did you find any solution? Mine doesn't work. I have tried every fork and every single one of the doesn't work. I think it might be dead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants