You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cgroup teardown refuses cleanup when a concurrent create prunes an empty scope cgroup #190
Found while attributing local failures on PR #189; present on unmodified main (3ea6214). In packages/core/src/containment.ts, destroyCgroupMembers checks existsSync(cgroupDir) and then guardCgroupKill calls statfs on the same path. createContainmentScope in any concurrent session prunes empty sibling scope cgroups in the same delegated parent, and a session that has launched nothing has an empty scope cgroup. When the prune lands between those two checks, teardown refuses with "refusing cgroup cleanup:
is not on a cgroup v2 filesystem" (or, a little later in the same window, "could not read /cgroup.procs" or "could not write /cgroup.kill"), the session is left in error status with the runtime dir kept, and the desktop integration test "refuses an explicit display owned by another server" fails when Vitest workers run other session-creating files in parallel on a delegated-cgroup host. The create side already documents this window (ensureContainmentScope re-creates a pruned scope; the supervisor retries its join); the destroy side has no equivalent handling.
Reproduction: a probe that loops createContainmentScope + destroyContainmentScope on empty scopes inside a private child cgroup while a sibling process loops create/rmdir produced the identical refusal 26/295 and 6/295 times on unmodified main and 29/295 and 3/295 times on the PR #189 build. The probe and outputs are preserved locally under ~/.pickforge/investigations/179/local-failures.
Treat a scope cgroup that disappears during destroy as vacated only when its members are provably gone: an ENOENT from statfs, cgroup.procs or cgroup.kill on a directory that existed at the start of destroy is the prune window, not a foreign path. Keep the refusal for a path that never was a cgroup v2 directory.
Do not weaken any ownership, evacuation or membership verification; the marker sweep still runs and must still confirm.
Add a regression that removes the empty scope directory between the existence check and the guard and asserts confirmed cleanup with no signals; add one where the path is a plain directory outside the cgroup filesystem and assert the refusal is kept.
Rerun packages/desktop-linux/test/integration.test.ts in the full parallel suite on a delegated-cgroup host and confirm the teardown failure no longer appears.
Activity
fix(core): treat a scope cgroup pruned during destroy as vacated
fix(core): treat a scope cgroup pruned during destroy as vacated