# Graceful Shutdown

> A mechanism that, on a stop signal, stops accepting work, drains in-flight work and closes connections before the process exits.

Record: `architecture:graceful-shutdown`
Kind: mechanism
Layer: [Correctness Core](https://banes-lab.com/records/layer/correctness-core.md)
Severity: contextual
Scope: service, runtime, resilience
Canonical: https://banes-lab.com/ontology#architecture-graceful-shutdown

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Chaos Engineering](https://banes-lab.com/records/architecture/chaos-engineering.md) and before [RAID Redundancy](https://banes-lab.com/records/architecture/raid-redundancy.md).

## Repair

- Refactored by: Implement Graceful Drain on Shutdown
- Detected by: dropped in-flight work on deploy/restart
- Violated by: processes terminated mid-request with no drain
- Measured by: requests lost per restart
- Enforced by: operations review

## Requires

- [Lifecycle Signals](https://banes-lab.com/records/lexicon/lifecycle-signals.md)

## Reinforces

- [Reliability](https://banes-lab.com/records/lexicon/reliability.md)
- [Data Integrity](https://banes-lab.com/records/lexicon/data-integrity.md)

## Enables

- [In-Flight Work Drain](https://banes-lab.com/records/lexicon/in-flight-work-drain.md)
- [Connection Cleanup](https://banes-lab.com/records/lexicon/connection-cleanup.md)

## Conflicts with

- [Hard Process Kill](https://banes-lab.com/records/lexicon/hard-process-kill.md)

## In tension with

- [Shutdown Latency](https://banes-lab.com/records/lexicon/shutdown-latency.md)

## Tensions

- [Graceful Shutdown / Shutdown Latency](https://banes-lab.com/records/tension/graceful-shutdown-shutdown-latency.md)

## Severity

- [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)

## Category

- [Self-Healing / Recovery / Deployment Safety](https://banes-lab.com/records/architecture-category/self-healing-recovery-deployment-safety.md)

## Linked from

- [Computation and resource](https://banes-lab.com/software-architecture/principles/computation-and-resource.md)
- [Quality Attributes](https://banes-lab.com/ontology/lexicon/lexicon-category-quality-attributes.md)
- [Self-Healing / Recovery / Deployment Safety](https://banes-lab.com/ontology/lexicon/lexicon-category-self-healing-recovery-deployment-safety.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The resolutions](https://banes-lab.com/ontology/schema/the-resolutions.md)
