pannal / plex-for-kodi

Unoffical Plex for Kodi add-on releases.
GNU General Public License v2.0
237 stars 30 forks source link

Set max_retries=1 for HTTP/HTTPS adapters #115

Closed stigger closed 1 month ago

stigger commented 1 month ago

Description:

After restoring from the hibernated state, all previously established TCP connections are being reset. As a result, the section refresh triggered by the system.wakeup listener fails, so the user have to switch to some other section in order to see any content. Allowing retries fixes this problem.

Checklist:

pannal commented 1 month ago

Looks like a great catch. Is there any specific device this has been verified on? I remember testing the suspend states on the SHIELD Pro 2019 and it worked flawlessly.

I don't doubt this fix, I'd just like to know if this is device specific :)

stigger commented 1 month ago

I encountered the problem on Ugoos AM6B+: always reproduces when the hibernation time was longer than 5 minutes (the UpdateHubTask period). Works correctly for me after the change.

pannal commented 1 month ago

Interesting. This PR is fine, but I think it proxy-fixes a kodi/elec bug to be honest. The network device should completely be there once the python subsystem gets reactivated via the event.

I'll merge this commit, as it doesn't negatively impact anyone else, but could you make sure this issue gets reported back to the kodi/elec maintainers for this device?

Thanks!

stigger commented 1 month ago

The problem is not that the network is unavailable, the problem is that the client doesn't know that the server has closed the connection for some reason (e.g. tried to send a keepalive to the client while it was hibernated). When the client wakes up and tries to use the previously established connection, this results in an error, since the connection is not valid on the server side anymore.

I don't think there is anything that should be fixed in Kodi or CoreELEC. Although I can only guess why this does not reproduce for you as easily, I'm sure that in certain situations the issue can be triggered even for you. The easiest way that should do the trick: hibernate the Shield, wait 5 minutes, restart your Plex server, wake up the Shield.

pannal commented 1 month ago

Sounds reasonable to me. Thank you!