Attempt to better handle HTTP ReadTimeout/ConnectionError errors#1046
Conversation
Slower devices are not always fast enough to send the signal in faster way while other operations are carried out, this cause to ActionController to crash because receive the playback data after Kodi 'Player.OnPlay' event and will no longer manage events
|
i also had issues with timeout errors. i am not sure if the reason only applies to me but i found a solution. i hope it is of use to someone. |
|
interesting i found various articles on the net that talk about this |
I just wanted to document this. Maybe we could add this to the FAQ. |
Check if this PR fulfills these requirements:
Types of changes
Description
Some users have encountered HTTP errors as:
ConnectionError: ('Connection aborted.', error("(104, 'ECONNRESET')",))Issue #1004
ReadTimeout: HTTPSConnectionPool(host='www.n*****x.com', port=443): Read timed out. (read timeout=None)Issue #914
I have no idea if the cause is the network or the Netflix servers, or a bug in Requests/Urlib module
this problem happen only with some users on linux/windows platform and on both Kodi 18/19 (python 2 and 3)
For the "Connection aborted ... ECONNRESET" error case, has been tried every type of solutions provided from:
psf/requests#4937
psf/requests#3845
Solutions tried:
Nothing works
I don't remember in which Issue message, but i read about a possible Request or Urlib bug that in some situations doesn't close opened persistent connections anymore, therefore on next http request cause the ConnectionError ... ECONNRESET.
Perhaps something similar is true, because if you force to close the connection by add on each HTTP request the header
Connection: closethe ConnectionError ... ECONNRESET error not happen anymore,although i don't understand why it only happens to certain users
but forcing close the connetion on each request does not seem to me to be good practice to do with HTTP1.1 servers.
so as workaround i added a simple retry loop.
In case of Feature change / Breaking change:
Describe the current behavior
Describe the new behavior
Screenshots (if appropriate):