fix: disable Rocket signal handling to prevent zombie process#276
Draft
lohrm-spf wants to merge 2 commits intoglzr-io:mainfrom
Draft
fix: disable Rocket signal handling to prevent zombie process#276lohrm-spf wants to merge 2 commits intoglzr-io:mainfrom
lohrm-spf wants to merge 2 commits intoglzr-io:mainfrom
Conversation
Rocket 0.5 registers signal handlers for SIGTERM/SIGINT that replace the OS defaults. When an external process (e.g. GlazeWM) sends SIGTERM to Zebar, Rocket catches the signal and gracefully shuts down the HTTP server — but the Tauri event loop keeps the process alive. This leaves a zombie Zebar that holds the single-instance lock, preventing any new instance from starting, while the asset server is no longer running so widgets cannot render. Disable Rocket's ctrlc and Unix signal triggers so that SIGTERM/SIGINT fall through to the OS default (process termination).
When a window manager (e.g. GlazeWM) restarts, it can destroy Zebar's widget windows externally. The placeholder window keeps the process alive but widget_states is now empty. If the WM then re-launches zebar, the single-instance handler received CliCommand::Empty and unconditionally no-op'd — leaving the process running with zero visible widgets. Now the Empty command only no-ops when widgets are still alive. If widget_states is empty, startup() is called to recreate them from the startup config.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ctrlcand Unixsignalsshutdown triggers in the asset server configuration.Problem
Zombie path 1: Rocket signal handling
Rocket 0.5 registers signal handlers (SIGTERM by default on Unix, SIGINT via
ctrlc) that replace the OS defaults. When an external process manager (e.g. GlazeWM) sends SIGTERM to Zebar:launch().awaitreturnsOk(())— no error is loggedtauri-plugin-single-instancelock is still held by the zombiezebarinstance detects the lock, communicates with the zombie, and exitsZombie path 2: External window destruction
When a window manager restarts (e.g. GlazeWM during development), it can destroy Zebar's widget windows externally. The placeholder window keeps the process alive, but
widget_statesis now empty. If the WM then re-launcheszebar:CliCommand::EmptyEmptyFix
Rocket signal handling
Disable Rocket's signal handling so SIGTERM/SIGINT fall through to the OS default (process termination). The asset server lifecycle is now tied to the process — when the process dies, everything dies, and the single-instance lock is released.
shutdown.ctrlc = false— Rocket won't intercept Ctrl-Cshutdown.signals = [](Unix only) — Rocket won't intercept SIGTERMNormal Tauri-initiated shutdown still works: when the Tauri event loop exits, the tokio runtime is dropped, cancelling the Rocket background task.
Single-instance widget recovery
The
Emptycommand now only no-ops when widgets are still alive. Ifwidget_statesis empty,startup()is called to recreate widgets from the startup config.