tonic icon indicating copy to clipboard operation
tonic copied to clipboard

Shutdown (and fail) existing requests?

Open bjchambers opened this issue 4 years ago • 1 comments

Feature Request

Is there a way to shutdown and either immediately fail all pending requests or wait some period of time and then fail them?

I've looked at Graceful Shutdown, and as far as I can tell there is no timeout.

Motivation

The use case would be if the process receives a panic or a kill signal (due to a panic or something). Right now, the server just goes away and the gRPC clients wait until they receive a timeout (which may take a long time due if the requests were expected to take a long time to return). Failing fast would be much better.

Proposal

This may be covered by just documenting (and/or extending) the graceful shutdown mechanism. But, it isn't clear exactly what "graceful shutdown" means.

bjchambers avatar Nov 30 '21 19:11 bjchambers

Right now, the server just goes away and the gRPC clients wait until they receive a timeout

If you drop the server, I'd expect all open connections to be closed and all in-flight requests to fail with an HTTP/2 reset code (that should result in an error response).

Is the issue that the client buffers requests when it can't connect to the service?

olix0r avatar Nov 30 '21 22:11 olix0r