-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Service Unavailable (503) gRPC error from datastore occurs every 30 minutes #2896
Comments
@quom thanks for the report! There's a new auth module that is used in Could you update |
Thanks - I've updated the library and so far it looks to have worked. |
Reopened - after a few hours of looking stable the exact same issue has reoccured. |
Sorry to hear that @quom. @dhermes or @jonparrott, I'm guessing the token is expiring? If so, what's the right way to refresh the token? ( I don't see any issues with Bigtable on https://status.cloud.google.com. |
@quom if you immediately retry the action, does it work the second time? from google.cloud.exceptions import ServiceUnavailable
self.client = datastore.Client(project=project)
query = self.client.query(kind=kind)
try:
query_iter = query.fetch()
except ServiceUnavailable:
query_iter = query.fetch() |
@daspecster re-trying immediately worked for me. I got this error while trying to update an existing entity. >>> entity['test'] = 0
>>>
>>> client.put(entity)
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/_http.py", line 253, in _grpc_catch_rendezvous
yield
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/_http.py", line 356, in commit
return self._stub.Commit(request_pb)
File "/usr/local/lib/python3.5/site-packages/grpc/_channel.py", line 481, in __call__
return _end_unary_response_blocking(state, False, deadline)
File "/usr/local/lib/python3.5/site-packages/grpc/_channel.py", line 432, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.UNAVAILABLE, {"created":"@1482491988.272167000","description":"Secure read failed","file":"src/core/lib/security/transport/secure_endpoint.c","file_line":157,"grpc_status":14,"referenced_errors":[{"created":"@1482491988.272010000","description":"EOF","file":"src/core/lib/iomgr/tcp_posix.c","file_line":235}]})>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/client.py", line 335, in put
self.put_multi(entities=[entity])
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/client.py", line 362, in put_multi
current.commit()
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/batch.py", line 265, in commit
self._commit()
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/batch.py", line 242, in _commit
self.project, self._commit_request, self._id)
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/_http.py", line 628, in commit
response = self._datastore_api.commit(project, request)
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/_http.py", line 356, in commit
return self._stub.Commit(request_pb)
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/google/cloud/datastore/_http.py", line 260, in _grpc_catch_rendezvous
raise error_class(exc.details())
google.cloud.exceptions.ServiceUnavailable: 503 {"created":"@1482491988.272167000","description":"Secure read failed","file":"src/core/lib/security/transport/secure_endpoint.c","file_line":157,"grpc_status":14,"referenced_errors":[{"created":"@1482491988.272010000","description":"EOF","file":"src/core/lib/iomgr/tcp_posix.c","file_line":235}]} |
@daspecster Yep it does work if you immediately retry but this logic should ideally be in the client library |
@quom, I agree. I added this issue to #2694 as another example. I'm not sure when retry logic will get added but there is support to do so. I'm glad retrying is working for you. It sounds like adding retry logic is all that's left for this issue and since we're tracking that in #2694, is it ok if we close this issue? |
Same error seen here, using the library in a django app via mod_wsgi and apache2. End of the trace I get is here:
|
I'm seeing the error as well - though I imagine there's nothing this library can do about it other than add retry logic. @hir3npatel you can handle this by retrying with exponential backoff yourself since the library isn't doing it for us. |
Generating a datastore grpc client for each request is not required and can lead to auth issues. Here is one of the auth issues in question: googleapis/google-cloud-python#3085 Also note the following issue which is causing the client to need resetting every 30 mins: googleapis/google-cloud-python#2896. This will hopefully be fixed soon.
We are seeing this error quite a bit too, especially since increasing the threads that the worker has to interact with datastore: I'm using exponential backoff, and in this particular case I had overlooked a simple "get" to retrieve one entity that resulted in the exception: I added an additional retry to this function, and I hope this resolves the issue! But +1 from me that it would be great if this retry could be built into the client. |
OS type and version
Running on docker centos image on GCE
Python version and virtual environment information
python --version
Python 3.5.2
google-cloud-python version
pip show google-cloud
,pip show google-<service>
orpip freeze
google-cloud==0.21.1
Stacktrace if available
Stacktrace from one of the errors:
Steps to reproduce
Occurs regularly every 30 mins.
Code example
The text was updated successfully, but these errors were encountered: