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

Photoframe freezing when loss of network connection? #186

Open
ccshc opened this issue Mar 10, 2021 · 6 comments
Open

Photoframe freezing when loss of network connection? #186

ccshc opened this issue Mar 10, 2021 · 6 comments

Comments

@ccshc
Copy link

ccshc commented Mar 10, 2021

Hi,

I think my network connection is dropping occasionally, which seems to cause the PhotoFrame to just keep showing the same picture.

The summary is ConnectionError: HTTPSConnectionPool fails 5 times, which eventually triggers an error when it trys to display a photo which it hasn't got.

I can solve this by rebooting.

A possible solution would be that if the network fails to connect, have a longer delay (eg a minute) between retries rather than instantaneously trying again.

The full log is below:

Mar 10 14:04:17 photoframe photoframe[396]: 2021-03-10 14:04:17,843 - WARNING - jpegexiforient is missing, no auto rotate available. Did you forget to run "apt install libjpeg-turbo-progs" ?
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,339 - ERROR - Issues downloading
Mar 10 14:05:09 photoframe photoframe[396]: Traceback (most recent call last):
Mar 10 14:05:09 photoframe photoframe[396]:   File "/root/photoframe/modules/oauth.py", line 72, in request
Mar 10 14:05:09 photoframe photoframe[396]:     result = auth.get(uri, stream=stream, params=params, timeout=180)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get
Mar 10 14:05:09 photoframe photoframe[396]:     return self.request('GET', url, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests_oauthlib/oauth2_session.py", line 358, in request
Mar 10 14:05:09 photoframe photoframe[396]:     headers=headers, data=data, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
Mar 10 14:05:09 photoframe photoframe[396]:     resp = self.send(prep, **send_kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
Mar 10 14:05:09 photoframe photoframe[396]:     r = adapter.send(request, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 487, in send
Mar 10 14:05:09 photoframe photoframe[396]:     raise ConnectionError(e, request=request)
Mar 10 14:05:09 photoframe photoframe[396]: ConnectionError: HTTPSConnectionPool(host='photoslibrary.googleapis.com', port=443): Max retries exceeded with url: /v1/mediaItems/AHQdp5MMuc5aQ4ct9ipZvvVaJC9n_PBjMV9KTtW7-ZHG_mHBwGGb79p1gb-fkO76Gz6lWHZbRBiIb-kTLxHGclAtTKGG8G3Fxg (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,370 - WARNING - Retrying again, attempt #1
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,466 - ERROR - Issues downloading
Mar 10 14:05:09 photoframe photoframe[396]: Traceback (most recent call last):
Mar 10 14:05:09 photoframe photoframe[396]:   File "/root/photoframe/modules/oauth.py", line 72, in request
Mar 10 14:05:09 photoframe photoframe[396]:     result = auth.get(uri, stream=stream, params=params, timeout=180)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get
Mar 10 14:05:09 photoframe photoframe[396]:     return self.request('GET', url, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests_oauthlib/oauth2_session.py", line 358, in request
Mar 10 14:05:09 photoframe photoframe[396]:     headers=headers, data=data, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
Mar 10 14:05:09 photoframe photoframe[396]:     resp = self.send(prep, **send_kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
Mar 10 14:05:09 photoframe photoframe[396]:     r = adapter.send(request, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 487, in send
Mar 10 14:05:09 photoframe photoframe[396]:     raise ConnectionError(e, request=request)
Mar 10 14:05:09 photoframe photoframe[396]: ConnectionError: HTTPSConnectionPool(host='photoslibrary.googleapis.com', port=443): Max retries exceeded with url: /v1/mediaItems/AHQdp5MMuc5aQ4ct9ipZvvVaJC9n_PBjMV9KTtW7-ZHG_mHBwGGb79p1gb-fkO76Gz6lWHZbRBiIb-kTLxHGclAtTKGG8G3Fxg (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,484 - WARNING - Retrying again, attempt #2
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,566 - ERROR - Issues downloading
Mar 10 14:05:09 photoframe photoframe[396]: Traceback (most recent call last):
Mar 10 14:05:09 photoframe photoframe[396]:   File "/root/photoframe/modules/oauth.py", line 72, in request
Mar 10 14:05:09 photoframe photoframe[396]:     result = auth.get(uri, stream=stream, params=params, timeout=180)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get
Mar 10 14:05:09 photoframe photoframe[396]:     return self.request('GET', url, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests_oauthlib/oauth2_session.py", line 358, in request
Mar 10 14:05:09 photoframe photoframe[396]:     headers=headers, data=data, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
Mar 10 14:05:09 photoframe photoframe[396]:     resp = self.send(prep, **send_kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
Mar 10 14:05:09 photoframe photoframe[396]:     r = adapter.send(request, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 487, in send
Mar 10 14:05:09 photoframe photoframe[396]:     raise ConnectionError(e, request=request)
Mar 10 14:05:09 photoframe photoframe[396]: ConnectionError: HTTPSConnectionPool(host='photoslibrary.googleapis.com', port=443): Max retries exceeded with url: /v1/mediaItems/AHQdp5MMuc5aQ4ct9ipZvvVaJC9n_PBjMV9KTtW7-ZHG_mHBwGGb79p1gb-fkO76Gz6lWHZbRBiIb-kTLxHGclAtTKGG8G3Fxg (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,580 - WARNING - Retrying again, attempt #3
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,660 - ERROR - Issues downloading
Mar 10 14:05:09 photoframe photoframe[396]: Traceback (most recent call last):
Mar 10 14:05:09 photoframe photoframe[396]:   File "/root/photoframe/modules/oauth.py", line 72, in request
Mar 10 14:05:09 photoframe photoframe[396]:     result = auth.get(uri, stream=stream, params=params, timeout=180)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get
Mar 10 14:05:09 photoframe photoframe[396]:     return self.request('GET', url, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests_oauthlib/oauth2_session.py", line 358, in request
Mar 10 14:05:09 photoframe photoframe[396]:     headers=headers, data=data, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
Mar 10 14:05:09 photoframe photoframe[396]:     resp = self.send(prep, **send_kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
Mar 10 14:05:09 photoframe photoframe[396]:     r = adapter.send(request, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 487, in send
Mar 10 14:05:09 photoframe photoframe[396]:     raise ConnectionError(e, request=request)
Mar 10 14:05:09 photoframe photoframe[396]: ConnectionError: HTTPSConnectionPool(host='photoslibrary.googleapis.com', port=443): Max retries exceeded with url: /v1/mediaItems/AHQdp5MMuc5aQ4ct9ipZvvVaJC9n_PBjMV9KTtW7-ZHG_mHBwGGb79p1gb-fkO76Gz6lWHZbRBiIb-kTLxHGclAtTKGG8G3Fxg (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,664 - WARNING - Retrying again, attempt #4
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,751 - ERROR - Issues downloading
Mar 10 14:05:09 photoframe photoframe[396]: Traceback (most recent call last):
Mar 10 14:05:09 photoframe photoframe[396]:   File "/root/photoframe/modules/oauth.py", line 72, in request
Mar 10 14:05:09 photoframe photoframe[396]:     result = auth.get(uri, stream=stream, params=params, timeout=180)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get
Mar 10 14:05:09 photoframe photoframe[396]:     return self.request('GET', url, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests_oauthlib/oauth2_session.py", line 358, in request
Mar 10 14:05:09 photoframe photoframe[396]:     headers=headers, data=data, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
Mar 10 14:05:09 photoframe photoframe[396]:     resp = self.send(prep, **send_kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
Mar 10 14:05:09 photoframe photoframe[396]:     r = adapter.send(request, **kwargs)
Mar 10 14:05:09 photoframe photoframe[396]:   File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 487, in send
Mar 10 14:05:09 photoframe photoframe[396]:     raise ConnectionError(e, request=request)
Mar 10 14:05:09 photoframe photoframe[396]: ConnectionError: HTTPSConnectionPool(host='photoslibrary.googleapis.com', port=443): Max retries exceeded with url: /v1/mediaItems/AHQdp5MMuc5aQ4ct9ipZvvVaJC9n_PBjMV9KTtW7-ZHG_mHBwGGb79p1gb-fkO76Gz6lWHZbRBiIb-kTLxHGclAtTKGG8G3Fxg (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,755 - WARNING - Retrying again, attempt #5
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,757 - ERROR - Failed to download due to network issues
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,769 - WARNING - jpegexiforient is missing, no auto rotate available. Did you forget to run "apt install libjpeg-turbo-progs" ?
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,771 - WARNING - File /tmp/framed_cb306b23-6a7f-456d-9e6d-8118f09b5c9f does not exist, so cannot get dimensions
Mar 10 14:05:09 photoframe photoframe[396]: 2021-03-10 14:05:09,776 - WARNING - Cannot frame /tmp/framed_cb306b23-6a7f-456d-9e6d-8118f09b5c9f since we cannot determine image dimensions
Mar 10 14:05:24 photoframe photoframe[396]: Exception in thread Thread-6:
Mar 10 14:05:24 photoframe photoframe[396]: Traceback (most recent call last):
Mar 10 14:05:24 photoframe photoframe[396]:   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
Mar 10 14:05:24 photoframe photoframe[396]:     self.run()
Mar 10 14:05:24 photoframe photoframe[396]:   File "/usr/lib/python2.7/threading.py", line 754, in run
Mar 10 14:05:24 photoframe photoframe[396]:     self.__target(*self.__args, **self.__kwargs)
Mar 10 14:05:24 photoframe photoframe[396]:   File "/root/photoframe/modules/slideshow.py", line 328, in presentation
Mar 10 14:05:24 photoframe photoframe[396]:     self.showPreloadedImage(result)
Mar 10 14:05:24 photoframe photoframe[396]:   File "/root/photoframe/modules/slideshow.py", line 261, in showPreloadedImage
Mar 10 14:05:24 photoframe photoframe[396]:     logging.warning("Trying to show image '%s', but file does not exist!" % filename)
Mar 10 14:05:24 photoframe photoframe[396]: NameError: global name 'filename' is not defined
@mrworf
Copy link
Owner

mrworf commented Mar 10, 2021

Actually, there's backoff logic:

			time.sleep(tries / 10) # Back off 10, 20, ... depending on tries
			tries += 1
			logging.warning('Retrying again, attempt #%d', tries)

But I could have messed up and the division isn't turning into fractions, just zero which would explain what you're seeing :) Good catch

@ccshc
Copy link
Author

ccshc commented Mar 10, 2021

I think that is just returning 0 delay! Maybe change it to time.sleep(tries * 10)?

@mrworf
Copy link
Owner

mrworf commented Mar 10, 2021

Yes, I think I confused it with minutes which is why it's a division. Should have been multiplied since it's seconds.

dadr pushed a commit to dadr/photoframe that referenced this issue Jun 17, 2021
dadr pushed a commit to dadr/photoframe that referenced this issue Jun 17, 2021
Internet went out today, and I experienced mrworf#186.
@dadr dadr mentioned this issue Jun 17, 2021
mrworf pushed a commit that referenced this issue Jun 27, 2021
* Update base.py

Changed the way `sum` was computed in `getImagesTotal()` to avoid black screen with "no (new) images could be found" in the warning log.

* Update display.py

Fix Fill and Do Nothing image handling.

* Update base.py

Addresses #186
@mrworf
Copy link
Owner

mrworf commented Aug 6, 2021

Changes for the backoff timer as well as the use of a faulty variable name have been fixed on latest. Please let me know how it works @ccshc

@dadr
Copy link
Contributor

dadr commented Aug 7, 2021

I've been meaning to look back at this again. I still have seen this error with the revised code. If I read it correctly, the slideshow will stop if the Internet connection is down for ~2.5 min. That has happened to me several times, and the photoframe does not recover after the Internet comes back. I'd rather have it back off a bit more and then continue to test for connectivity periodically. Maybe every 5 min?

@mrworf
Copy link
Owner

mrworf commented Aug 7, 2021

I actually found the issue the other night, just need to test some more.

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

3 participants