---
title: "Graceful VM exits, some dials"
description: "Fly.io introduces configurable VM shutdown behavior for applications whose clients, connections, or transactions need more than the default five-second termination window. After sending SIGINT, Fly normally waits five seconds before forcefully terminating a VM; the new kill_timeout setting extends that wait to as much as five minutes on Shared CPU VMs or 24 hours on dedicated CPU VMs, while kill_signal selects among several signals. The post demonstrates HAProxy’s soft-stop mode with SIGUSR1 to drain existing TCP connections and Postgres’s smart shutdown with SIGTERM to let open transactions commit before termination. It also describes infrastructure considerations: deploys and other releases can disrupt in-flight connections, so Fly drains connections where possible and offers ways to reduce reliance on shared HTTP and TLS handlers, plus stateless UDP and experimental stateless TCP load balancing."
---

# Graceful VM exits, some dials

[Fly.io](https://yomu.fyi/company/fly-io) · Dec 29, 2020

**Type:** Announcement

## Summary

Fly.io introduces configurable VM shutdown behavior for applications whose clients, connections, or transactions need more than the default five-second termination window. After sending SIGINT, Fly normally waits five seconds before forcefully terminating a VM; the new kill\_timeout setting extends that wait to as much as five minutes on Shared CPU VMs or 24 hours on dedicated CPU VMs, while kill\_signal selects among several signals. The post demonstrates HAProxy’s soft-stop mode with SIGUSR1 to drain existing TCP connections and Postgres’s smart shutdown with SIGTERM to let open transactions commit before termination. It also describes infrastructure considerations: deploys and other releases can disrupt in-flight connections, so Fly drains connections where possible and offers ways to reduce reliance on shared HTTP and TLS handlers, plus stateless UDP and experimental stateless TCP load balancing.

## Context

VMs are shut down for deploys, scaling, maintenance, and other reasons. The default SIGINT followed by a five-second wait works for many application servers but can terminate long-lived video sessions or database transactions before they finish.

## Approach / What changed

Fly.io adds kill\_timeout to control how long a VM remains alive after a shutdown signal, with limits of five minutes for Shared CPU VMs and 24 hours for dedicated CPU VMs. The kill\_signal option allows SIGINT, SIGTERM, SIGQUIT, SIGUSR1, SIGUSR2, SIGKILL, or SIGSTOP, enabling application-specific graceful shutdown behavior.

## Takeaways

- The default VM shutdown sequence sends SIGINT, waits five seconds, and then forcefully terminates a still-running VM.
- HAProxy can use SIGUSR1 for soft-stop behavior, stopping new connections while existing TCP connections drain.
- Postgres can use SIGTERM with a five-minute timeout to commit open transactions through its smart shutdown mode.

**Tags:** [Deployment](https://yomu.fyi/topic/deployment), [Fly Machines](https://yomu.fyi/topic/fly-machines), [Reliability](https://yomu.fyi/topic/reliability)

- Source: [Fly.io](https://fly.io/blog/graceful-vm-exits-some-dials)
- Source URL: https://fly.io/blog/graceful-vm-exits-some-dials
- Ingested by Yomu: 2026-09-02T11:58:22.513Z

[Read original post](https://fly.io/blog/graceful-vm-exits-some-dials)
