Skip to content

Stop Linux backend when its parent exits - #296

Merged
huacnlee merged 1 commit into
mainfrom
fix/issue-278-backend-lifetime
Sep 27, 2026
Merged

huacnlee merged 1 commit into
mainfrom
fix/issue-278-backend-lifetime

Conversation

@huacnlee

@huacnlee huacnlee commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

When the shell process or creating thread exits while another process still holds the backend's stdin open, omamail serve can remain alive and retain account sessions and the outbox lock. On Linux, register PR_SET_PDEATHSIG before starting the protocol runtime and fail startup if registration fails or the parent exits during registration. The signal is SIGKILL, so inherited signal dispositions cannot keep the orphan alive.

The regression runs the backend with isolated XDG directories and empty accounts. A separate supervisor holds stdin open, kills the launcher, and verifies the backend exits; normal system.quit and EOF shutdown remain covered. The old binary failed the parent-death case and the updated binary passes. cargo test --locked --target-dir .worktrees/review-pr-284/target --test backend_lifetime -- --nocapture, cargo fmt --all --check, and git diff --check passed on top of main.

Addresses #278. This protects the reported reparented-process path. It does not identify a backend whose parent process/thread remains alive after a shell component leak, nor one adopted before its first parent observation. An interrupted send may remain in unknown recovery state and is not automatically resent. Security review: PASS for the parent-lifetime boundary; no real accounts or credentials were used.

Release Notes

  • On Linux, the Omamail backend now exits with the shell that started it, instead of staying behind and holding account sessions and the outbox lock.

@huacnlee
huacnlee merged commit c0de260 into main Sep 27, 2026
24 of 25 checks passed
@huacnlee
huacnlee deleted the fix/issue-278-backend-lifetime branch September 27, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant