Skip to content

Session cancel: a background process left in the group survives when the shell exits normally #111

Description

@Daily-AC

Found by adversarial review round 3 of PR #109. Severity P2; same behaviour as main before the PR (nothing killed background children then either), so not a regression, but ADR 0011 now claims the group is the unit of cleanup.

Probe: sleep 600 </dev/null >/dev/null 2>&1 & echo $! > pidfile; exit. The shell exits, reap() clears the container's PGID, Close returns, and the sleep keeps running with PGID == the old shell PID. It never called setsid/setpgid, so it is not in the documented escape list.

Suggested fix: distinguish "group leader exited" from "group cleaned up"; on Close after a natural exit, kill the group once before dropping the identity (needs the reap-window fix from the sibling issue so the kill cannot hit a reused PGID).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions