Skip to content

Wolverine instance graceful shutdown #2282

@AlexandreBossard

Description

@AlexandreBossard

Is your feature request related to a problem? Please describe.

When using container orchestration (like k8s, cloud-run, aspire, etc) during version roll-out deployment, new instances are spun-out while the old ones are gracefully shut down.

When handling HTTP requests, traffic is routed to the new instances while inflight requests have grace period to complete until they are forcefully interrupted.

We would like to know how wolverine is supposed to handle shutdown request. The only piece of doc we found is lacking the intended process followed by a sunsetting wolverine instances, especially regarding in flight and long running messages. Also, are CancellationTokens passed to handlers leveraged or not ? We have not found any occurrences of IHostApplicationLifetime.ApplicationStopping in the wolverine code base.

Describe the solution you'd like

Documentation of what is supposed to happen, guarantees wolverine provides, and/or the steps an implementer should take to achieve a graceful shutdown.

For the process itself, we expect the graceful shutdown process to be something as the following:

  • On receiving SIGTERM, stop pulling messages from the transport inbox
  • Let the inflight handlers complete
  • After a configurable timeout, abort all remaining handlers
  • Release wolverine node messages assignation (set it to zero)
  • Flush the outbox to the transport
  • Dies

This should guarantees smooth instance sunsetting, and no messages lost nor stale.

Describe alternatives you've considered

None, N/A.

Additional context

The ASP.Net documentation on graceful shutdown has lot of good information and examples.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions