Skip to main content
Version: 2.16.0

Graceful shutdown

Glasswall Halo implements graceful shutdown to allow services to complete in-flight requests while rejecting new requests during the shutdown process.

This ensures that outstanding work is handled correctly and reduces the risk of data loss or partially processed requests.

Synchronous API and Asynchronous API

The Glasswall Halo APIs use the ASP.NET Core graceful shutdown mechanism. More information is available in the Microsoft documentation for Kestrel shutdown timeout.

By default, the shutdown timeout is set to 60 seconds. This value defines how long the server will wait after shutdown begins before open connections are forcefully closed.

During this period:

  • Kestrel waits for active request processing to complete.
  • No new connections or requests are accepted.

It is possible for some background tasks to continue running after the shutdown timeout has elapsed. This behaviour is described in the Microsoft documentation for hosted services stop handling.

Even after cancellation is requested, tasks are not abandoned. The host waits for all tasks to complete before final termination.

Report aggregator and Engine services

The Report Aggregator and Engine services are implemented as hosted services, allowing custom logic to be executed during service startup and shutdown.

Further details are available in the Microsoft documentation for IHostedService.

When shutdown begins:

  • Both services allow in-flight requests to complete.
  • A default shutdown timeout of 5 seconds is enforced.
  • If the timeout is exceeded, the service is forcefully terminated.

This design ensures predictable shutdown behaviour while balancing reliability and shutdown speed.