I have created a GRPC server-streaming rpc in Go and client is in Dart.
Normally when running the server locally, if client gets disconnected early while the server is still serving the stream, the context
in streaming rpc gets canceled, and server stops serving the stream.
But this isn't same on Cloud Run, when client gets disconnected the server
doesn't cancel the context
. So, server is never notified that the stream is closed from the client side, unless the container reaches the timeout limit.
Therefore, if timeout is set to 1hour then server is billed for 1hour even when client gets disconnected early.
Does Cloud Run require some special magic or is it not supported currently?
Only workaround currently is to use smaller timeout (~1min) and then create a retry logic on client side.