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

Crash when Google sheets api is not available #21

Open
Jaakkonen opened this issue May 15, 2023 · 0 comments
Open

Crash when Google sheets api is not available #21

Jaakkonen opened this issue May 15, 2023 · 0 comments

Comments

@Jaakkonen
Copy link
Member

It looks like that the piikki backup system can fail when Google APIs are unavailable (TLS read times out). This causes the bot to crash. Expected behavior is to do exponential backoff retry asynchronously and continue running.

Here probably just syncing the entire document at once would be best off since we wouldn't need to track the changes that have failed while the Google API is unreachable.

# error.log


2020-05-28 07:00:12,563 - googleapiclient.discovery - INFO - URL being requested: GET https://www.googleapis.com/discovery/v1/apis/sheets/v4/rest
2020-05-28 07:00:14,724 - googleapiclient.discovery - INFO - URL being requested: GET https://sheets.googleapis.com/v4/spreadsheets/1y-zFM-3GE44BLpv4O6TOfU_o6Mtu9ZwyfGWQhCZ7WoE/values/A1%3AF?alt=json
2020-05-28 07:01:14,810 - JobQueue - ERROR - An uncaught error was raised while executing job Backup
Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/telegram/ext/jobqueue.py, line 280, in tick
    job.run(self._dispatcher)
  File /usr/lib/python3.6/site-packages/telegram/ext/jobqueue.py, line 416, in run
    self.callback(dispatcher.bot, self)
  File /root/fk-kiltisbot/piikki.py, line 345, in backup
    transactions = drive.export_transactions()
  File /root/fk-kiltisbot/drive.py, line 150, in export_transactions
    result = sheet.values().get(spreadsheetId=settings.secrets[sheets][tapahtumat], range=A1:F).execute()
  File /usr/lib/python3.6/site-packages/googleapiclient/_helpers.py, line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File /usr/lib/python3.6/site-packages/googleapiclient/http.py, line 851, in execute
    method=str(self.method), body=self.body, headers=self.headers)
  File /usr/lib/python3.6/site-packages/googleapiclient/http.py, line 184, in _retry_request
    raise exception
  File /usr/lib/python3.6/site-packages/googleapiclient/http.py, line 165, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
  File /usr/lib/python3.6/site-packages/google_auth_httplib2.py, line 198, in request
    uri, method, body=body, headers=request_headers, **kwargs)
  File /usr/lib/python3/dist-packages/httplib2/__init__.py, line 1313, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File /usr/lib/python3/dist-packages/httplib2/__init__.py, line 1063, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File /usr/lib/python3/dist-packages/httplib2/__init__.py, line 1016, in _conn_request
    response = conn.getresponse()
  File /usr/lib/python3.6/http/client.py, line 1356, in getresponse
    response.begin()
  File /usr/lib/python3.6/http/client.py, line 307, in begin
    version, status, reason = self._read_status()
  File /usr/lib/python3.6/http/client.py, line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), iso-8859-1)
  File /usr/lib/python3.6/socket.py, line 586, in readinto
    return self._sock.recv_into(b)
  File /usr/lib/python3.6/ssl.py, line 1012, in recv_into
    return self.read(nbytes, buffer)
  File /usr/lib/python3.6/ssl.py, line 874, in read
    return self._sslobj.read(len, buffer)
  File /usr/lib/python3.6/ssl.py, line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out2020-05-28 07:00:00,148 - googleapiclient.discovery_cache - WARNING - file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/__init__.py, line 36, in autodetect
    from google.appengine.api import memcache
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py, line 33, in <module>
    from oauth2client.contrib.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py, line 37, in <module>
    from oauth2client.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/__init__.py, line 41, in autodetect
    from . import file_cache
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py, line 41, in <module>
    'file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
2020-05-28 07:00:00,181 - googleapiclient.discovery - INFO - URL being requested: GET https://www.googleapis.com/discovery/v1/apis/sheets/v4/rest
2020-05-28 07:00:07,901 - googleapiclient.discovery - INFO - URL being requested: GET https://sheets.googleapis.com/v4/spreadsheets/1DYq5i7HDH4_5WkjF92pwEA8fb-woAY5wh5bCwMUIp8w?alt=json
2020-05-28 07:00:10,716 - googleapiclient.discovery - INFO - URL being requested: POST https://sheets.googleapis.com/v4/spreadsheets/1DYq5i7HDH4_5WkjF92pwEA8fb-woAY5wh5bCwMUIp8w:batchUpdate?alt=json
2020-05-28 07:00:11,756 - googleapiclient.discovery - INFO - URL being requested: POST https://sheets.googleapis.com/v4/spreadsheets/1DYq5i7HDH4_5WkjF92pwEA8fb-woAY5wh5bCwMUIp8w/values/2020-05-28T07.00%21A1:append?valueInputOption=RAW&alt=json
2020-05-28 07:00:12,561 - googleapiclient.discovery_cache - WARNING - file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/__init__.py, line 36, in autodetect
    from google.appengine.api import memcache
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py, line 33, in <module>
    from oauth2client.contrib.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py, line 37, in <module>
    from oauth2client.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/__init__.py, line 41, in autodetect
    from . import file_cache
  File /usr/lib/python3.6/site-packages/googleapiclient/discovery_cache/file_cache.py, line 41, in <module>
    'file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
2020-05-28 07:00:12,563 - googleapiclient.discovery - INFO - URL being requested: GET https://www.googleapis.com/discovery/v1/apis/sheets/v4/rest
2020-05-28 07:00:14,724 - googleapiclient.discovery - INFO - URL being requested: GET https://sheets.googleapis.com/v4/spreadsheets/1y-zFM-3GE44BLpv4O6TOfU_o6Mtu9ZwyfGWQhCZ7WoE/values/A1%3AF?alt=json
2020-05-28 07:01:14,810 - JobQueue - ERROR - An uncaught error was raised while executing job Backup
Traceback (most recent call last):
  File /usr/lib/python3.6/site-packages/telegram/ext/jobqueue.py, line 280, in tick
    job.run(self._dispatcher)
  File /usr/lib/python3.6/site-packages/telegram/ext/jobqueue.py, line 416, in run
    self.callback(dispatcher.bot, self)
  File /root/fk-kiltisbot/piikki.py, line 345, in backup
    transactions = drive.export_transactions()
  File /root/fk-kiltisbot/drive.py, line 150, in export_transactions
    result = sheet.values().get(spreadsheetId=settings.secrets[sheets][tapahtumat], range=A1:F).execute()
  File /usr/lib/python3.6/site-packages/googleapiclient/_helpers.py, line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File /usr/lib/python3.6/site-packages/googleapiclient/http.py, line 851, in execute
    method=str(self.method), body=self.body, headers=self.headers)
  File /usr/lib/python3.6/site-packages/googleapiclient/http.py, line 184, in _retry_request
    raise exception
  File /usr/lib/python3.6/site-packages/googleapiclient/http.py, line 165, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
  File /usr/lib/python3.6/site-packages/google_auth_httplib2.py, line 198, in request
    uri, method, body=body, headers=request_headers, **kwargs)
  File /usr/lib/python3/dist-packages/httplib2/__init__.py, line 1313, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File /usr/lib/python3/dist-packages/httplib2/__init__.py, line 1063, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File /usr/lib/python3/dist-packages/httplib2/__init__.py, line 1016, in _conn_request
    response = conn.getresponse()
  File /usr/lib/python3.6/http/client.py, line 1356, in getresponse
    response.begin()
  File /usr/lib/python3.6/http/client.py, line 307, in begin
    version, status, reason = self._read_status()
  File /usr/lib/python3.6/http/client.py, line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), iso-8859-1)
  File /usr/lib/python3.6/socket.py, line 586, in readinto
    return self._sock.recv_into(b)
  File /usr/lib/python3.6/ssl.py, line 1012, in recv_into
    return self.read(nbytes, buffer)
  File /usr/lib/python3.6/ssl.py, line 874, in read
    return self._sslobj.read(len, buffer)
  File /usr/lib/python3.6/ssl.py, line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
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

1 participant