Files
hyprland-headless-stream-pl…/docs/TODO/kill-can-leave-the-app-alive.md
T
Hermenix cbf58f6443 docs: two TODO items closed, and the cursor question answered
Closed: containers-do-not-bind and pointer-needs-a-container-or-a-screen. Both
were the same defect seen from two sides, and both are fixed by assigning
windows by pid -- two sessions now hold two outputs with a real browser on each,
and the pointer aims at a desk that has something in it.

The cursor item is rewritten with the answer rather than the speculation: the
compositor draws no cursor image for a virtual pointer, so no capture setting
can make one appear. The evidence is in the file, including the three wrong
answers that came before it and the boring measurement that settled it.

New item: killing a session left two browsers alive, found by counting windows
rather than sessions.
2026-10-03 19:45:42 +00:00

43 lines
2.3 KiB
Markdown

# Killing a session does not always kill the browser it started
## The issue
Three chromium processes outlived the sessions that had launched them, while the
broker reported those sessions as ended. Found by counting windows on the
compositor after a probe run: two windows left on the main screen whose sessions
no longer existed, with pids older than the session that had replaced them.
The kill path does signal the process group — the audit line says
`sent SIGTERM to process group 2966561` and that session's process *did* die —
so this is not "the kill does nothing". It is narrower: two of three killings
left a live browser behind, and the two that leaked were started while the
compositor was unreachable from the broker, so they had no container recorded at
all. That correlation is the only clue so far and it is not proof.
## Ideas
1. **Check whether the leak tracks the container record.** *(recommended first)*
Kill a session whose container is `owned` and one whose container is `null`,
several times, and count survivors. If the leak is limited to containerless
sessions, the fix is in the kill path's cleanup of a session that never got a
desk, not in the signal path.
2. **Re-read the survivors from the compositor after every kill.** The teardown
already has `container_survivors` for windows; the same shape applies to
processes, and `procmon` already knows how to identify them by
`(pid, starttime)`. A kill that leaves anything alive should say so in its
reply rather than returning a clean record.
3. **Make the idle reaper the backstop it already is.** A session that was
reaped instead of killed goes through the same teardown; if the leak is in
the exit path, the reaper may be leaking too — worth measuring once (1).
4. **A test that counts processes, not sessions.** Every existing assertion is
about the broker's view. One that counts the app's processes after a kill
would have caught this the first time it happened.
## Why it matters
Processes that outlive their sessions are exactly what the registry's whole
identity design (boot id, start time) exists to prevent, and the ones found were
still holding windows on the compositor — invisible to `session list`, visible
on screen. A machine that accumulates them slowly fills up with browsers nobody
owns, each holding a desk slot if the band is what limits sessions.