What happens to server-side execution when a GCP client-side timeout occurs?
0 reputation · 27 Nov 2022, 00:13 UTC
When using Google Cloud client libraries, developers typically implement timeouts or cancellation tokens to prevent application hangs. While these mechanisms ensure the client receives a DeadlineExceeded or Canceled status, the behavior of the backend service varies depending on the transport layer (gRPC vs. REST) and the specific API implementation.
For standard synchronous calls, gRPC services generally honor deadline metadata to stop processing. However, for Long-Running Operations (LROs), terminating the client-side polling loop or cancelling the local request context does not inherently signal the server to stop the underlying job. This creates a risk of orphaned tasks that continue to consume resources and incur costs despite the client having abandoned the request.
Technical Uncertainty
There is a lack of a standardized CancelOperation method across all GCP services, meaning cancellation logic is often fragmented. Furthermore, relying on default timeout values in the google::cloud::Options system can be unpredictable across library versions.
- Does a client-side timeout automatically trigger cooperative cancellation on the server for all gRPC-based services?
- Which specific mechanism should be used to ensure a Long-Running Operation is terminated on the backend when the client cancels the request?