mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3254] [CLOSED] [TUI] procs: find engine orphans adopted by systemd --user, and wait until they are really gone #4532
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4532
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3254
Author: @toel1234
Created: 10/19/2026
Status: ❌ Closed
Base:
main← Head:fix/orphans-systemd-user📝 Commits (1)
dc36dfe[TUI] procs: find engine orphans adopted by systemd --user, and wait until they are really gone📊 Changes
1 file changed (+8 additions, -4 deletions)
View changed files
📝
strata_control/procs.py(+8 -4)📄 Description
Problem and result
On a systemd Linux desktop,
stratanever found an engine left behind by an earlier run without a launch record.systemd --userboth adopts orphans (subreaper) and is an ancestor of every desktop terminal.orphans_of()put every ancestor except pid 1 into "my own processes", so an orphan whose new parent issystemd --userlooked started by this server and was skipped. The orphan kept holding the GPU.After that was fixed, a second Linux issue showed:
end_one()returned "ended" while the process was still exiting. It waited onis_same()(start token and command line), and an exiting Linux process has an empty/proc/<pid>/cmdlinebefore it is gone.After: ancestors named like an init (
INIT_NAMES, already used for the adopted-parent check) are not counted as starters, the same as pid 1. After the signal,end_one()waits on the start token alone, which is unique per process lifetime and never matches a reused PID. The kill itself is still only sent after the fullis_same()check.Related discussion
none. Focused fix.
Approach
Two small changes in
strata_control/procs.py. Both are needed for the existing testtest_an_engine_orphan_of_this_executable_is_found_and_a_live_one_is_not: with only the first it still fails (process reported ended, start token still live), with both it passes. Windows behaviour is unchanged apart from the wait loop now comparing the start token, which is the same valueis_same()compared first.Validation
Passed:
python -m pytest tests/terminal/test_procs.py5 times in a row: 7 passed each. Ubuntu, GNOME on Wayland, Python 3.12.3, the process treesystemd(1) > systemd --user > gnome-shell > … > pytest.python -m pytest tests/terminal -qwith this branch and #3255 merged: 852 passed, 17 skipped, 0 failed (445.96 s).systemd --user(pid 5687 here), whichpsutil.Process().parents()also lists.Failed:
none observed.
Not run:
end_one()only changes which check the wait loop uses.Limits
A process stuck in exit (empty command line, start token still live) is now reported "stuck" after the 10 s wait instead of "ended".
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.