H7 Graceful server shutdown on SIGTERM #70

Closed
opened 2026-11-10 01:08:07 +00:00 by claude · 2 comments
Owner

Depends on: F6

A headless server stopped with SIGTERM dies with exit 143 and no stats or stop log line, because Godot 4.7.2 doesn't pass the signal to scripts. The _exit_tree fallback in HeadlessServer never runs. Found while finishing F6 (#6).

Acceptance

  • Stopping a server with SIGTERM or SIGINT writes the stats and stop lines and exits 0. A launcher that traps the signal and asks the server to quit (for example through a local control channel once networking exists) is acceptable.
  • Tested in tools/smoke.sh.
**Depends on:** F6 A headless server stopped with SIGTERM dies with exit 143 and no `stats` or `stop` log line, because Godot 4.7.2 doesn't pass the signal to scripts. The `_exit_tree` fallback in `HeadlessServer` never runs. Found while finishing F6 (#6). **Acceptance** - Stopping a server with SIGTERM or SIGINT writes the `stats` and `stop` lines and exits 0. A launcher that traps the signal and asks the server to quit (for example through a local control channel once networking exists) is acceptable. - Tested in `tools/smoke.sh`.
claude added this to the v0.9 Hardening milestone 2026-11-10 01:08:07 +00:00
claude added the type/featurepriority/low labels 2026-11-10 01:08:07 +00:00
Author
Owner

Deferred for the Monday 2026-11-16 build, because it is low priority and the schedule is more than a day behind. N7's packaging needs graceful shutdown, so N7 covers SIGTERM, and this closes with it if that's enough. — tidewall-build

Deferred for the Monday 2026-11-16 build, because it is low priority and the schedule is more than a day behind. N7's packaging needs graceful shutdown, so N7 covers SIGTERM, and this closes with it if that's enough. — tidewall-build
eric closed this issue 2026-11-13 03:07:34 +00:00
Author
Owner

Done with N7 (8eb6e58), plus a smoke test (0797b11).

The engine still can't catch SIGTERM, so the packaged wrapper packaging/server/tidewall-server traps SIGTERM and SIGINT and creates the server's --stop-file. The server checks for that file four times a second, then stops cleanly: it tells everyone connected it shut down, writes stats and stop, and exits 0. If the server hasn't gone after 15 s, the wrapper kills it. A stale stop file left over from an earlier run is removed when the server starts.

tools/smoke.sh, which make check runs, now starts a server through the wrapper, sends it SIGTERM, and checks for exit 0, a stats line and a clean stop line. make server-package-check checks the same thing through docker compose stop.

A server run directly (tools/godot.sh -- --server) still dies on SIGTERM without those lines. That is the engine's behaviour, and anything that runs a server should go through the wrapper.

— tidewall-build

Done with N7 (8eb6e58), plus a smoke test (0797b11). The engine still can't catch SIGTERM, so the packaged wrapper `packaging/server/tidewall-server` traps SIGTERM and SIGINT and creates the server's `--stop-file`. The server checks for that file four times a second, then stops cleanly: it tells everyone connected it shut down, writes `stats` and `stop`, and exits 0. If the server hasn't gone after 15 s, the wrapper kills it. A stale stop file left over from an earlier run is removed when the server starts. `tools/smoke.sh`, which `make check` runs, now starts a server through the wrapper, sends it SIGTERM, and checks for exit 0, a `stats` line and a clean `stop` line. `make server-package-check` checks the same thing through `docker compose stop`. A server run directly (`tools/godot.sh -- --server`) still dies on SIGTERM without those lines. That is the engine's behaviour, and anything that runs a server should go through the wrapper. — tidewall-build
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#70