Open
Description
When a server shuts down it gives a grace period to requests to finish. However, there is no indication to requests that they should finish, i.e. ServerCallContext.CancellationToken
isn't raised. To find out about cancellation, someone needs to look at IHostApplicationLifetime.ApplicationStopping
.
Knowing about app shutdown is important for long running gRPC streaming calls that are watching ServerCallContext.CancellationToken
to figure out if they should stop. They could wait until the shutdown timeout limit is reached, delaying app shutdown and preventing a completely graceful shutdown.
Ideas:
- Add a
RaiseStreamingCancellationOnStopping
option to gRPC server.ServerCallContext.CancellationToken
would automatically be canceled on app stopping. Having raised the cancellation token could create confusion about whether a call is still allowed to write to the response stream. This is problematic. - Documentation. Discuss shutdown and using
IHostApplicationLifetime.ApplicationStopping
in an app to end streaming calls on stopping.
Documentation is probably the safer course of action.