Task running SayHello coroutine gets cancelled and CancelledError is raised inside it
When SayHello coroutine finishes, grpclib server internally re-raises CancelledError as TimeoutError or StreamTerminatedError to explain why request was cancelled
However, I still end up with the following in my application logs:
Application error
Traceback (most recent call last):
File "/home/audriusb/code/python_prod/.venv/lib/python3.7/site-packages/grpclib/server.py", line 440, in request_handler
await method_func(stream)
File "/home/audriusb/code/python_prod/src/framework/base.py", line 122, in GetValues
raise e
File "/home/audriusb/code/python_prod/src/framework/base.py", line 114, in GetValues
raise e
File "/home/audriusb/code/python_prod/src/framework/base.py", line 97, in GetValues
async for m in impl:
File "/home/audriusb/code/python_prod/src/framework/base.py", line 172, in calculate
async for a in aiter:
File "/home/audriusb/code/python_prod/src/handler.py", line 21, in impl
await asyncio.sleep(90000)
File "/home/audriusb/.pyenv/versions/3.7.9/lib/python3.7/asyncio/tasks.py", line 595, in sleep
return await future
concurrent.futures._base.CancelledError
I see there is cancel handling in the wrapper object, but I think that is mostly for client cancelling the stream, not server calls being cancelled because it's shutting down?
The docs as per https://grpclib.readthedocs.io/en/latest/errors.html#server-side state:
The docs state:
However, I still end up with the following in my application logs:
I don't see any handling of CancelledError around the code that invokes the handler: https://github.com/vmagamedov/grpclib/blob/master/grpclib/server.py#L440
I see there is cancel handling in the wrapper object, but I think that is mostly for client cancelling the stream, not server calls being cancelled because it's shutting down?