Ok, so after trying many things I couldn’t find the underlying cause other than that the error happens after the connection goes idle after some time.
Doing a retry immediately after is possible so with the help of the grpc library it actually not so difficult to handle the exception (example http://avi.im/grpc-errors/#python)
import grpc
…
if e.code(): # http://avi.im/grpc-errors/#python
# e.details() #
status_code = e.code()
status = str(status_code)
print("Exception Status Code", status_code)
return status
then look for the error code in the response
e.g. if status == “StatusCode.UNAVAILABLE”:
and try again whenever necessary