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

Read timeout error #74

Open
BEisem opened this issue Mar 31, 2023 · 9 comments
Open

Read timeout error #74

BEisem opened this issue Mar 31, 2023 · 9 comments

Comments

@BEisem
Copy link
Contributor

BEisem commented Mar 31, 2023

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
Copy link

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
Copy link
Contributor Author

BEisem commented Apr 22, 2023

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
Copy link
Contributor Author

BEisem commented Apr 22, 2023

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.

#78

@RemiRigal
Copy link
Owner

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
Copy link
Contributor Author

BEisem commented Apr 23, 2023

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
Copy link

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
Copy link

x1ao4 commented Jan 18, 2024

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/plex_server.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
Copy link

edrock200 commented Feb 19, 2024

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
Copy link

jrcalvert commented Feb 20, 2024 via email

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

7 participants