Liking cljdoc? Tell your friends :D

hive-compose.promote.orphan

Processes a dead rootless dockerd left behind, and what they still hold. Pure: every function reads a process Snapshot taken at the boundary (hive-compose.adapter.procfs), never /proc itself.

When rootless dockerd dies (systemd-oomd killed docker.service on 2026-11-05), its containers read Exited (255) but their processes keep running: the container's first process is reparented to the user's systemd --user, keeps its subuid and keeps its mounts. Starting or recreating the service then runs a second copy on the same volume in other PID and IPC namespaces, where e.g. postgres' own data-dir interlock cannot see the first (incident 20261105135748-5afc73f2).

A live container's process is a child of its containerd-shim, never of systemd --user, so the parent alone tells an orphan from a live one; a process whose cgroup names a container the daemon reports running is still taken as owned.

Snapshot: {:manager-pid n ; the user's systemd --user :subuid [first count] ; the user's /etc/subuid range :procs [{:pid :ppid :uid :name :args :cgroup "0::/..../docker-<id>.scope" :mounts [root ..] ; mountinfo field 4, subuid procs only :listening #{port}}]} ; LISTEN sockets of its netns, subuid procs only

Ownership seam: container-of and owner name the container a process belongs to; DC-SHARED (a section refusing to recreate a service another live section holds) can map that container to its compose project and service the same way.

Processes a dead rootless dockerd left behind, and what they still hold.
Pure: every function reads a process Snapshot taken at the boundary
(`hive-compose.adapter.procfs`), never /proc itself.

When rootless dockerd dies (systemd-oomd killed docker.service on
2026-11-05), its containers read Exited (255) but their processes keep
running: the container's first process is reparented to the user's
`systemd --user`, keeps its subuid and keeps its mounts. Starting or
recreating the service then runs a second copy on the same volume in
other PID and IPC namespaces, where e.g. postgres' own data-dir interlock
cannot see the first (incident 20261105135748-5afc73f2).

A live container's process is a child of its containerd-shim, never of
`systemd --user`, so the parent alone tells an orphan from a live one; a
process whose cgroup names a container the daemon reports running is
still taken as owned.

Snapshot:
  {:manager-pid n                 ; the user's `systemd --user`
   :subuid      [first count]     ; the user's /etc/subuid range
   :procs [{:pid :ppid :uid :name :args
            :cgroup     "0::/..../docker-<id>.scope"
            :mounts     [root ..]  ; mountinfo field 4, subuid procs only
            :listening  #{port}}]} ; LISTEN sockets of its netns, subuid procs only

Ownership seam: `container-of` and `owner` name the container a process
belongs to; DC-SHARED (a section refusing to recreate a service another
live section holds) can map that container to its compose project and
service the same way.
raw docstring

container-ofclj

(container-of text)

The container id a /proc/<pid>/cgroup text names (a docker-<id>.scope cgroup), nil when the process is in no container scope.

The container id a /proc/<pid>/cgroup `text` names (a `docker-<id>.scope`
cgroup), nil when the process is in no container scope.
sourceraw docstring

container-process?clj

(container-process? subuid pr)

True when pr ran in a container: its uid is in the subuid range (a non-root container user), or its cgroup is a container scope (container root maps to the user's own uid, outside the range).

True when `pr` ran in a container: its uid is in the subuid range (a
non-root container user), or its cgroup is a container scope (container
root maps to the user's own uid, outside the range).
sourceraw docstring

describeclj

(describe found)

One line naming found orphans and what each holds, for a refusal.

One line naming `found` orphans and what each holds, for a refusal.
sourceraw docstring

holdsclj

(holds prs {:keys [volumes ports]})

What processes prs hold of resources ({:volumes #{name} :ports #{port}}): {:volumes :ports}, each a sorted set. A volume is held when one of their mounts lies in it, a port when one of them listens on it.

What processes `prs` hold of `resources` ({:volumes #{name} :ports
#{port}}): {:volumes :ports}, each a sorted set. A volume is held when one
of their mounts lies in it, a port when one of them listens on it.
sourceraw docstring

in-subuid?clj

(in-subuid? [first-id n] uid)

True when uid falls in range [first count].

True when `uid` falls in range [first count].
sourceraw docstring

listening-portsclj

(listening-ports text uid)

#{port} of the LISTEN sockets in /proc/<pid>/net/tcp(6) text owned by uid (the table's uid column, as the reader's namespace sees it). A process on the host network sees every host socket in that table; the uid keeps only its own. Pure.

#{port} of the LISTEN sockets in /proc/<pid>/net/tcp(6) `text` owned by
`uid` (the table's uid column, as the reader's namespace sees it). A
process on the host network sees every host socket in that table; the
uid keeps only its own. Pure.
sourceraw docstring

manager-pidclj

(manager-pid procs uid)

The pid of uid's systemd --user among procs, nil when none runs.

The pid of `uid`'s `systemd --user` among `procs`, nil when none runs.
sourceraw docstring

mount-rootclj

(mount-root line)

Field 4 (the root of the mount within its filesystem) of a mountinfo line.

Field 4 (the root of the mount within its filesystem) of a mountinfo line.
sourceraw docstring

orphansclj

(orphans snapshot live resources)

[Orphan] of snapshot holding any of resources, by root pid. An Orphan: {:pid :name :args :container :pids [pid of it and below] :holds}. live is the set of running container ids (may be empty: the parent rule already leaves live containers out). Pure.

[Orphan] of `snapshot` holding any of `resources`, by root pid. An Orphan:
{:pid :name :args :container :pids [pid of it and below] :holds}. `live`
is the set of running container ids (may be empty: the parent rule
already leaves live containers out). Pure.
sourceraw docstring

ownerclj

(owner pr live)

{:container id :live? bool} of process pr given live (the full ids of the containers the daemon runs), nil outside any container scope.

{:container id :live? bool} of process `pr` given `live` (the full ids of
the containers the daemon runs), nil outside any container scope.
sourceraw docstring

parse-statusclj

(parse-status text)

{:name :ppid :uid} of a /proc/<pid>/status text (uid: the real one), nil when it carries none of them. Pure.

{:name :ppid :uid} of a /proc/<pid>/status `text` (uid: the real one),
nil when it carries none of them. Pure.
sourceraw docstring

parse-subuidclj

(parse-subuid text user)

[first count] of user in /etc/subuid text (lines name:first:count), nil when the user has no range. Pure.

[first count] of `user` in /etc/subuid `text` (lines `name:first:count`),
nil when the user has no range. Pure.
sourceraw docstring

rootsclj

(roots {:keys [manager-pid subuid procs]} live)

The orphan roots of snapshot: container processes (container-process?) whose parent is systemd --user, none of a container in live. Empty when the snapshot has no manager or no range (not rootless).

The orphan roots of `snapshot`: container processes (`container-process?`)
whose parent is `systemd --user`, none of a container in `live`. Empty when
the snapshot has no manager or no range (not rootless).
sourceraw docstring

volume-ofclj

(volume-of root)

The docker volume a mount root lies in (.../volumes/<name>/_data[/..]), nil for any other mount.

The docker volume a mount root lies in (`.../volumes/<name>/_data[/..]`),
nil for any other mount.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close