FreeBSD: force-remove the jail on exit to reap detached daemons
Builds run in a non-persistent jail, which the kernel only auto-removes
once its *last* process exits. A build step that detaches a process
(e.g. a test running `git daemon --detach`, which reparents to PID 1)
leaves a straggler that keeps the jail -- and its devfs mount and ZFS
snapshot -- alive indefinitely. The mounts are then held busy, so the
manual umounts on the success path fail with EBUSY and are ignored,
and the jail leaks. On a long-lived worker these pile up until the host
grinds to a halt.
Replace the manual umounts with `jail -r`, run on every exit path. It
SIGKILLs any straggler so the jail's release actions can unmount devfs
and the cache mounts. On a clean exit the jail has already auto-removed,
so this is a harmless no-op.
a863b8
-
Jun 24 13:37 +00:00