RemiRigal / Plex-Auto-Languages

Automated language selection for Plex TV Shows !
MIT License
406 stars 15 forks source link

Read timeout error #74

Open BEisem opened 1 year ago

BEisem commented 1 year ago

Is this project being developed any more? It's fantastic when it works, but I'm finding that I am getting fairly regular read timeouts where it seems like pal loses its connection with Plex.

requests.exceptions.ReadTimeout: HTTPConnectionPool(host='127.0.0.1', port=32400): Read timed out. (read timeout=30)

It would be great if pal could somehow survive these timeouts, because when it happens, I end up having to restart the service. If it could just pick up again once the connection is resumed, that would be great.

luizfeliperc commented 1 year ago

I'm facing the same problem. When PAL receives a timeout it does not recover and needs to restart the service for it to work again. image

BEisem commented 1 year ago

Yes, that's exactly what I'm seeing as well. It would be nice to be able to either (1) increase the read timeout from 30s to something higher (since my Plex does always come back, I guess sometimes it takes longer than 30 seconds) or, (2) be able to survive that timeout, and right itself once it regains connection.

BEisem commented 1 year ago

I just issued a pull request, I've actually never done it before so I don't know if I did it right. My recommended change would adjust the default 30 second timeout and make it 60 seconds instead.

https://github.com/RemiRigal/Plex-Auto-Languages/pull/78

RemiRigal commented 1 year ago

Is this project being developed any more?

Yes it is, I've just been struggling to get some time to work on this project lately.

Yes, that's exactly what I'm seeing as well. It would be nice to be able to either (1) increase the read timeout from 30s to something higher (since my Plex does always come back, I guess sometimes it takes longer than 30 seconds) or, (2) be able to survive that timeout, and right itself once it regains connection.

I would prefer making PAL more resilient to those timeouts, increasing the tolerance will only reduce the number of occurrences.

BEisem commented 1 year ago

I would prefer making PAL more resilient to those timeouts, increasing the tolerance will only reduce the number of occurrences.

I agree 100%, that is definitely the better option. Hopefully you'll have a way to make it more resilient!

Knecht-Ruprecht commented 8 months ago

I have the same issue, and somewhat constantly: My NAS seems to go into overload whenever I start or restart a container, which I assume leads to Plex never responding in time on startup. Plex itself runs fine and things smoothen shortly after the Docker service did its thing, but as PAL seems to never recover from the error caused by the slowdown, I basically cannot use it. Is there any workaround yet?

x1ao4 commented 5 months ago

plex-auto-languages | Traceback (most recent call last): plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 536, in _make_request plex-auto-languages | response = conn.getresponse() plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 461, in getresponse plex-auto-languages | httplib_response = super().getresponse() plex-auto-languages | File "/usr/local/lib/python3.8/http/client.py", line 1348, in getresponse plex-auto-languages | response.begin() plex-auto-languages | File "/usr/local/lib/python3.8/http/client.py", line 316, in begin plex-auto-languages | version, status, reason = self._read_status() plex-auto-languages | File "/usr/local/lib/python3.8/http/client.py", line 277, in _read_status plex-auto-languages | line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") plex-auto-languages | File "/usr/local/lib/python3.8/socket.py", line 669, in readinto plex-auto-languages | return self._sock.recv_into(b) plex-auto-languages | socket.timeout: timed out plex-auto-languages | plex-auto-languages | The above exception was the direct cause of the following exception: plex-auto-languages | plex-auto-languages | Traceback (most recent call last): plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 486, in send plex-auto-languages | resp = conn.urlopen( plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 844, in urlopen plex-auto-languages | retries = retries.increment( plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 470, in increment plex-auto-languages | raise reraise(type(error), error, _stacktrace) plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/urllib3/util/util.py", line 39, in reraise plex-auto-languages | raise value plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 790, in urlopen plex-auto-languages | response = self._make_request( plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 538, in _make_request plex-auto-languages | self._raise_timeout(err=e, url=url, timeout_value=read_timeout) plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 370, in _raise_timeout plex-auto-languages | raise ReadTimeoutError( plex-auto-languages | urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.31.19', port=32400): Read timed out. (read timeout=30) plex-auto-languages | plex-auto-languages | During handling of the above exception, another exception occurred: plex-auto-languages | plex-auto-languages | Traceback (most recent call last): plex-auto-languages | File "main.py", line 118, in plex-auto-languages | plex_auto_languages.start() plex-auto-languages | File "main.py", line 77, in start plex-auto-languages | if count % 60 == 0 and not self.plex.is_alive: plex-auto-languages | File "/app/plex_auto_languages/plex_server.py", line 122, in is_alive plex-auto-languages | return self.connected and self._alert_listener is not None and self._alert_listener.is_alive() plex-auto-languages | File "/app/plex_auto_languages/plexserver.py", line 39, in connected plex-auto-languages | = self._plex.library.sections() plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/plexapi/library.py", line 58, in sections plex-auto-languages | self._loadSections() plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/plexapi/library.py", line 46, in _loadSections plex-auto-languages | for elem in self._server.query(key): plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/plexapi/server.py", line 747, in query plex-auto-languages | response = method(url, headers=headers, timeout=timeout, kwargs) plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 602, in get plex-auto-languages | return self.request("GET", url, kwargs) plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 589, in request plex-auto-languages | resp = self.send(prep, send_kwargs) plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 703, in send plex-auto-languages | r = adapter.send(request, kwargs) plex-auto-languages | File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 532, in send plex-auto-languages | raise ReadTimeout(e, request=request) plex-auto-languages | requests.exceptions.ReadTimeout: HTTPConnectionPool(host='192.168.31.19', port=32400): Read timed out. (read timeout=30)

Same here. Restarting the container fixes the issue temporarily, but after a while, it times out again.

edrock200 commented 4 months ago

Redeploy PAL with label "autoheal=true" then add autoheal container https://github.com/willfarrell/docker-autoheal

19-02-2024 20:08:14 Container /plexpal (fa146517f0e4) found to be unhealthy - Restarting container now with 60s timeout

jrcalvert commented 4 months ago

Thank-you, I am trying that now.

On Mon, 19 Feb 2024 at 20:15, edrock200 @.***> wrote:

Redeploy PAL with label "autoheal=true" then add autoheal container https://github.com/willfarrell/docker-autoheal

— Reply to this email directly, view it on GitHub https://github.com/RemiRigal/Plex-Auto-Languages/issues/74#issuecomment-1953108933, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADXRBWTFC4CC2KQR6LSDUYLYUOXGBAVCNFSM6AAAAAAWOY4CXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJTGEYDQOJTGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

Jason Calvert @.***