Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databroker shall send UNAVAILABLE if terminating subscriptions on shutdown #125

Open
BjoernAtBosch opened this issue Jan 16, 2025 · 0 comments

Comments

@BjoernAtBosch
Copy link
Contributor

BjoernAtBosch commented Jan 16, 2025

The broker currently sends gRPC status code OK to consumers if terminating running subscriptions on a clean shutdown (e.g. caused by SigInt).

Instead it should send the code UNAVAILABLE because the result of a shutdown of the broker will be its unavailability.

Reasoning:

OK isn't a proper status code for that situation. A status OK signals that the stream has regularly ended. It makes sense in case where something finite is streamed, like file contents or a movie. When the end is reached the provider sends the ok to signal that all data has been send.

In the databroker case, a stream of signal updates is as by its nature an endless stream. Therefore, there is no reason for the broker to terminate an existing subscription - except in error cases. Also, from a consumer's perspective a subscription should live as long as the consumer is not cancelling it.

A shutdown of the broker - regardless of being intentionally (clean shutdown) as well as caused by an unexpected failure - is from that perspective always an exceptional situation for all the involved components, i.e. consumers, providers, and the broker itself: They basically expect to "run forever". (Of course they need to be prepared for possible unavailability of other components, but this is always an exceptional situation.

Therefore, I would go for the status code UNAVAILABLE.

I wouldn't use ABORTED because

  1. any error returned will abort the subscription - so this gives no extra meaning,
  2. it wouldn't fully match the description of ABORTED as given by the gRPC documentation of status codes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant