The hand-over test ends every process its scene started, the login of a sign-in its runner held included #190

Merged
agra merged 2 commits from task/3863-tests-runner-handover-sx-leaves-its-stub into master 2026-10-30 10:51:12 +02:00
Owner

Tracker: #3863

tests/runner_handover.sx ended its scene by sending kill -9 to the runners it had started: the slot processes named in the fake systemd's pid files, and the terminal runner. A runner starts each login (and each harness) in a process group of its own. So a login that a runner held when it was killed kept running, reparented to launchd. Once the test removed its root, the stub's device login (while [ ! -e "$here/approved" ]; do sleep 0.1; done) could never end, and it went on forking a sleep ten times a second.

Which runs leak. Passing runs leak nothing: in four passing runs on s32 (one alone, three side by side), the runner itself ended the logins of "Held", which the hand-over fails, and of "Next", which the test cancels. tests/sign_in.sx already pins that cancel ("the runner ends its login and removes its home"). A run whose hand-over fails leaks "Held". An arm of master with LATER set to VERSION, so Update all asks no runner, fails 22 checks. "Held" keeps waiting at slot a, and check_terminal's kill -9 of the slots orphans its login: pid 48099, ppid 1, its root gone, its cwd sign-in 1's home (/private/tmp/sak-sign-in-1-…). The leaks seen on max line up with release reviews whose hand-over versions failed the test.

What changes.

  • end_scene replaces both kills. It ends every process whose command names the scene's root (runners, the stub logins, the fake systemctl's held-back starts), and the process group each one leads, so a login dies together with the sleep it is waiting in.
  • The terminal runner is no longer killed at the end of check_terminal. check_held_at_end posts a sign-in to it and waits until it is waiting. So the test always ends with a runner that holds a login.
  • After end_scene, the test checks "once the test ends, nothing it started still runs, the login of the sign-in a runner held included". It polls pgrep -f on the root until nothing matches.
  • A runner killed with SIGKILL runs no home teardown. So the test removes the home of the sign-in held at the end itself, reading it from the environment the stub's login recorded.

Regression, fail-before and pass-after (s32, sx af8455c3, dist/ built at the head):

  • An arm of this branch's test whose teardown kills only the runners (pkill -9 -f '<root>[/]home/.sak-runner/bin/', which is what master did), fails exactly the new check: RUNNER HANDOVER FAIL (1 checks). It leaves pid 54944, the stub's device login under /tmp/sak-runner_handover-guLLd2/signin/, with ppid 1, its root gone and its cwd sign-in 3's home. That is the task's symptom. The orphan and its home were removed by hand afterwards.
  • The head: RUNNER HANDOVER OK. No login of its scene is left running, and no /tmp/sak-sign-in-* home is left.
  • The no-hand-over arm built on this branch fails the same 22 checks as master's, passes "once the test ends, nothing it started still runs", and leaves no login running.

Gates.

  • fast: gate run 913 passed at 95678ea2.
  • full: gate run 916 passed at 95678ea2, and gate run 917 passed at the head, 45b59678. In both, tests/runner_handover.sx passed and left no login running. Gate run 916 left the held sign-in's home under /tmp, which the second commit removes. Gate run 917 left none.

Not covered. The homes of the runs whose runner the test kills mid-scene (check_killed, check_hand_over, under /tmp/sak-run-<id>-<hex>) are still left, as before this change.

Tracker: [#3863](https://sak.swipelab.com/tasks/3863) `tests/runner_handover.sx` ended its scene by sending `kill -9` to the runners it had started: the slot processes named in the fake systemd's pid files, and the terminal runner. A runner starts each login (and each harness) in a process group of its own. So a login that a runner held when it was killed kept running, reparented to launchd. Once the test removed its root, the stub's device login (`while [ ! -e "$here/approved" ]; do sleep 0.1; done`) could never end, and it went on forking a `sleep` ten times a second. **Which runs leak.** Passing runs leak nothing: in four passing runs on s32 (one alone, three side by side), the runner itself ended the logins of "Held", which the hand-over fails, and of "Next", which the test cancels. `tests/sign_in.sx` already pins that cancel ("the runner ends its login and removes its home"). A run whose hand-over fails leaks "Held". An arm of master with `LATER` set to VERSION, so Update all asks no runner, fails 22 checks. "Held" keeps waiting at slot a, and `check_terminal`'s `kill -9` of the slots orphans its login: pid 48099, ppid 1, its root gone, its cwd sign-in 1's home (`/private/tmp/sak-sign-in-1-…`). The leaks seen on max line up with release reviews whose hand-over versions failed the test. **What changes.** - `end_scene` replaces both kills. It ends every process whose command names the scene's root (runners, the stub logins, the fake systemctl's held-back starts), and the process group each one leads, so a login dies together with the `sleep` it is waiting in. - The terminal runner is no longer killed at the end of `check_terminal`. `check_held_at_end` posts a sign-in to it and waits until it is `waiting`. So the test always ends with a runner that holds a login. - After `end_scene`, the test checks "once the test ends, nothing it started still runs, the login of the sign-in a runner held included". It polls `pgrep -f` on the root until nothing matches. - A runner killed with SIGKILL runs no home teardown. So the test removes the home of the sign-in held at the end itself, reading it from the environment the stub's login recorded. **Regression, fail-before and pass-after** (s32, sx af8455c3, `dist/` built at the head): - An arm of this branch's test whose teardown kills only the runners (`pkill -9 -f '<root>[/]home/.sak-runner/bin/'`, which is what master did), fails exactly the new check: `RUNNER HANDOVER FAIL (1 checks)`. It leaves pid 54944, the stub's device login under `/tmp/sak-runner_handover-guLLd2/signin/`, with ppid 1, its root gone and its cwd sign-in 3's home. That is the task's symptom. The orphan and its home were removed by hand afterwards. - The head: `RUNNER HANDOVER OK`. No login of its scene is left running, and no `/tmp/sak-sign-in-*` home is left. - The no-hand-over arm built on this branch fails the same 22 checks as master's, passes "once the test ends, nothing it started still runs", and leaves no login running. **Gates.** - `fast`: gate run 913 passed at 95678ea2. - `full`: gate run 916 passed at 95678ea2, and gate run 917 passed at the head, 45b59678. In both, `tests/runner_handover.sx` passed and left no login running. Gate run 916 left the held sign-in's home under `/tmp`, which the second commit removes. Gate run 917 left none. **Not covered.** The homes of the runs whose runner the test kills mid-scene (`check_killed`, `check_hand_over`, under `/tmp/sak-run-<id>-<hex>`) are still left, as before this change.
agra merged commit 8c6fed60de into master 2026-10-30 10:51:12 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sx/sak!190
No description provided.