Summary
Phase 12 work item. The current SIGTERM-only force-stop is a /* SHORTCUT */
in three places in src/main.c. A compositor or greeter that ignores SIGTERM
will leave the seat stuck forever — the daemon sends SIGTERM, never gets
SIGCHLD, and never restarts the greeter.
Background
Three call sites in main.c currently send only SIGTERM and rely on the
process exiting promptly:
on_seat_removed — seat hotunplugged while greeter running
on_can_graphical_changed — GPU removed from seat while greeter running
on_drm_change — display disconnected while greeter running
All three have identical /* SHORTCUT: no SIGTERM→SIGKILL escalation (Phase 12) */
comments.
Proposed design
Use a timerfd per seat to implement escalation:
- Send SIGTERM and arm a per-seat timerfd (e.g. 5 s timeout).
- Register the timerfd with the event loop.
- When the timerfd fires: if the process is still alive (seat still in
SEAT_STOPPING), send SIGKILL.
- When SIGCHLD arrives: cancel and close the timerfd.
The timerfd approach fits naturally into the existing poll-based event loop
(event_add / event_remove) and avoids blocking the daemon.
Related
- Depends on #2 (introduce
SEAT_STOPPING state) — the escalation timer
should only fire if the seat is still in SEAT_STOPPING.
- The
session_shutdown path in session.c already implements SIGTERM→SIGKILL
escalation using a blocking poll() loop. That shortcut should also be
replaced as part of this work.
Summary
Phase 12 work item. The current SIGTERM-only force-stop is a
/* SHORTCUT */in three places in
src/main.c. A compositor or greeter that ignores SIGTERMwill leave the seat stuck forever — the daemon sends SIGTERM, never gets
SIGCHLD, and never restarts the greeter.
Background
Three call sites in
main.ccurrently send only SIGTERM and rely on theprocess exiting promptly:
on_seat_removed— seat hotunplugged while greeter runningon_can_graphical_changed— GPU removed from seat while greeter runningon_drm_change— display disconnected while greeter runningAll three have identical
/* SHORTCUT: no SIGTERM→SIGKILL escalation (Phase 12) */comments.
Proposed design
Use a
timerfdper seat to implement escalation:SEAT_STOPPING), send SIGKILL.The timerfd approach fits naturally into the existing
poll-based event loop(
event_add/event_remove) and avoids blocking the daemon.Related
SEAT_STOPPINGstate) — the escalation timershould only fire if the seat is still in
SEAT_STOPPING.session_shutdownpath insession.calready implements SIGTERM→SIGKILLescalation using a blocking
poll()loop. That shortcut should also bereplaced as part of this work.