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

Random failure to update Calendar #86

Open
feh123 opened this issue Jul 23, 2024 · 5 comments
Open

Random failure to update Calendar #86

feh123 opened this issue Jul 23, 2024 · 5 comments

Comments

@feh123
Copy link

feh123 commented Jul 23, 2024

I am running a Calendar version I last updated in Apr-22 on a raspberry pi +3B. I set the crontab to update every hour. I am not quite sure of the timing but in the last month I have seen that the update does not always work. I see a list of errors instead of diary entries. Somewhat guessing it has failed around 10 times in the last month - so not a large failure rate.

I usually just log into the pi and run sudo ./run.sh - that works every time. So this is not a major issue for me however I thought I would look at the run log of a failed update and paste it here to see if anything stands out as a reason for the failure. It does not seem to be related to anything I am doing.

Failed update run.log - it seems to be unable to reach www.googleapis.com but why? I don't see any issue with my wifi router connection. Any thoughts much appreciated!
ADD WEATHER INFO

2024-07-23:15:01:01 INFO [screen-weather-get.py:71] Getting weather from Accuweather
2024-07-23:15:01:01 INFO [utility.py:99] Found in cache.
2024-07-23:15:01:01 INFO [screen-weather-get.py:97] weather - {'temperatureMin': 12.4, 'temperatureMax': 22.5, 'icon': 'day_partly_cloudy_rain', 'description': 'Times of sun and clouds'}
2024-07-23:15:01:01 INFO [screen-weather-get.py:115] Getting weather alert from Met Office RSS Feed
2024-07-23:15:01:01 INFO [utility.py:111] https://www.metoffice.gov.uk/public/data/PWSCache/WarningsRSS/Region/ee
2024-07-23:15:01:02 INFO [utility.py:114] Cache file is stale. Fetching from source.
2024-07-23:15:01:10 INFO [metofficerssfeed.py:12] get_alert -

<title>Met Office warnings for East of England</title>
https://www.metoffice.gov.uk/weather/warnings-and-advice/uk-warnings
Weather warnings of severe and extreme weather from the Met Office
en-gb
(c) Crown copyright
Tue, 16 Jul 2024 19:01:32 GMT
dc:creator[email protected]</dc:creator>


2024-07-23:15:01:10 INFO [screen-weather-get.py:124] alert -
2024-07-23:15:01:10 INFO [screen-weather-get.py:169] Updating SVG

ADD CALENDAR INFO

2024-07-23:15:01:12 INFO [screen-calendar-get.py:182] Fetching Google Calendar Events
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/httplib2/init.py", line 1343, in _conn_request
conn.connect()
File "/usr/local/lib/python3.9/dist-packages/httplib2/init.py", line 1119, in connect
address_info = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)
File "/usr/lib/python3.9/socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/pi/waveshare-epaper-display/screen-calendar-get.py", line 193, in
main()
File "/home/pi/waveshare-epaper-display/screen-calendar-get.py", line 183, in main
google_events = get_google_events(max_event_results)
File "/home/pi/waveshare-epaper-display/screen-calendar-get.py", line 108, in get_google_events
events_result = service.events().list(
File "/usr/local/lib/python3.9/dist-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/googleapiclient/http.py", line 922, in execute
resp, content = _retry_request(
File "/usr/local/lib/python3.9/dist-packages/googleapiclient/http.py", line 221, in _retry_request
raise exception
File "/usr/local/lib/python3.9/dist-packages/googleapiclient/http.py", line 190, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/google_auth_httplib2.py", line 218, in request
response, content = self.http.request(
File "/usr/local/lib/python3.9/dist-packages/httplib2/init.py", line 1701, in request
(response, content) = self._request(
File "/usr/local/lib/python3.9/dist-packages/httplib2/init.py", line 1421, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/usr/local/lib/python3.9/dist-packages/httplib2/init.py", line 1350, in _conn_request
raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
httplib2.error.ServerNotFoundError: Unable to find the server at www.googleapis.com

EXPORT TO PNG


DISPLAY ON EPAPER

2024-07-23:15:01:33 INFO [display.py:34] Display image file on screen

Successful update:

@mendhak
Copy link
Owner

mendhak commented Jul 23, 2024

It's really hard to say since these libraries are at a 'higher level in the network stack' so there's something happening to cause this, but the question is what.

You said you've seen, let's say, 10 failures in the past month. That isn't a huge amount but not a small amount either, especially if you consider you're only running this once an hour. If you were running this once a minute you'd see 600 errors, or failed updates. It does feel like there's some kind of issue in the network, so you'd have to troubleshoot that.

I don't know much about your ISP or setup but you could look at changing the DNS on your RPI to Google or Cloudflare. https://pimylifeup.com/raspberry-pi-dns-settings/ The article lists both G DNS and CF DNS. If doing so eliminates your errors then you know it's a problem with your ISP or network.

@feh123
Copy link
Author

feh123 commented Jul 24, 2024

Hi @mendhak thanks a lot for these ideas. I have changed the Pi's DNS to 1.1.1.1 1.0.0.1 using pimylifeup, it's a very interesting link! I may move more to Cloudflare. My router download speed is always better than 60Mbps and my network is always better than 30Mbps. My usual network problem is my VPN glitches but there is no VPN on my router only individual devices. I stream radio and video quite a lot and it's very rare to see a network outage or lag. So it's a bit of a mystery. I will let you know how Cloudflare goes and meanwhile you can close this. Thanks again, Calendar is great.

@jmason
Copy link
Contributor

jmason commented Jul 24, 2024

I've seen DNS issues a fair bit on my setup, as my screen is in a bit of a crappy spot for the wifi. Any of the scripts run from my version of run.sh which interact with the network use this idiom:

timeout $TIMEOUT python3 screen-calendar-get.py || \
    timeout $TIMEOUT python3 screen-calendar-get.py || \
    timeout $TIMEOUT python3 screen-calendar-get.py || exit 1

@feh123
Copy link
Author

feh123 commented Jul 25, 2024

Hi @jmason. Thanks for this. My Calendar failed again last night so the Cloudflare DNS might have helped but was not a solution. I am not a coder so I am not sure what your code means. I can, just about, wire my Calendar to my router so I will try that approach now.

@jmason
Copy link
Contributor

jmason commented Jul 25, 2024

That would be a worth a try - if it works more reliably on a wired connection, it's a good indication that your WiFi may be the culprit

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