Security Features Home Extensions Ecosystem

Graceful shutdown & handover provide ways to upgrade the server and it’s config with zero downtime or interrupted connections.

Graceful shutdown works by closing the listening socket and completing any connections.

Handover means the control over a port is handed over from one Kvarn instance to another. This is achieved through multiple processes binding the same port, and the old instance then quitting. When both instances are listening, the incoming request are split between them.


This is only available on Unix, see the Tokio docs.


When you restart the Kvarn server,

The communication between binaries are done using Unix sockets (which isn’t a problem since binding to the same port isn’t supported on Windows).


Graceful shutdown is only enabled when the respective cargo feature is enabled. It is supported on all platforms.

This is an optional feature because it’s performance implications. An atomic integer is accessed a few times for each connection/request. This can be avoided when no graceful shutdown is needed.