A wait that would close a cycle

A wait that would close a cycle

Before a wait on a resource starts — stado_wait::begin_on, blocking_on, until_on, blocking_on_lock, or stado waits open --awaits — Stado follows the graph from the resource's holders: each holder, every resource that holder waits on, those resources' holders, and so on. When a chain reaches the waiting process itself, or a process whose completion needs it (one of its ancestors, which waits for it to end), the wait could only stand until someone killed a process by hand, so it never starts. Its line says why:

czekanie odmowione: <what>; gdzie: <kind> <id>; przyczyna: a wait cycle: process <pid> (<command>) waits on <kind> <id>, held by process <holder>; process <holder> (<command>) waits on <kind> <id>, held by process <next>; …; process <last holder> needs process <pid> to end, so none of these waits can end

and the command fails: a lock wait with waiting for <lock> was refused: a wait cycle: …, stado waits open --awaits with the refusal class's status and the wait was not registered: it would close a wait cycle: …. An installation started by a step of an installation holding the same surface's lock is refused at once this way; so is an installation whose lock's holder waits on a lock its own parent holds, and an installation whose converge waits on a service whose process waits for a product revision that installation holds. A resource no running process holds ends every chain through it, so a wait whose chains end there starts as before. Stado's own operations record their edges: a product installation holds revision:<product>@<revision> from the moment it takes its surface lock until it ends, and every command Stado runs on the registry authority waits on host:<destination>, so a resolver command whose authority host is held, through other waits, by the installation running it is refused as waiting on the authority <destination> would close a wait cycle: … instead of standing; a destination the graph cannot name is refused as the authority host cannot be named in the wait-for graph: <cause>, and a holding that cannot be written ends the installation with <product>/<surface>: recording that it delivers <product>@<revision> in the wait-for graph failed: <cause>. A graph that cannot be read does not stop a program's own wait; graf czekan nieodczytany: <kind> <id>; przyczyna: <cause> stands beside its line, and graf czekan niezapisany: id: <id>; przyczyna: <cause> when its edge or a holding's release cannot be written. stado waits open --awaits asked for the check, so a graph it cannot read is its refusal: the register of open waits cannot be written: the wait-for graph cannot be read: <cause>. Each refusal of a resource names what is wrong, with exit status 2:

stado waits hold --resource: "<text>" is no resource: a resource is <kind>:<id>, kind one of lock, host, service, revision, unit, port
stado waits open --awaits: <word> is no resource kind; a resource is <kind>:<id>, kind one of lock, host, service, revision, unit, port
stado waits hold --resource: a <kind> resource needs an id that is not empty and holds no control character; got "<id>"

and release of something that is not an id fails with <id> is not a holding id: an id is <pid>-<n>, as stado waits holds lists it.

A cycle can still form after its waits began, when a resource passes to a new holder. stado waits cycles names every cycle standing among the waits of running processes, once each:

stado waits cycles [--json]

With none it prints no wait cycle stands among this machine's waits and exits 0. With any it fails with the refusal class's status and <n> wait cycle(s) stand on this machine; end one process in each: <cycle> | <cycle>; --json prints {"cycles": [{"links": [{"pid", "command", "awaits", "held_by"}], "closed_by", "said"}]} on stdout either way, each awaits as <kind>:<id>. A graph it cannot read fails with the wait-for graph of this machine's waits cannot be read: <cause>. Stado Desktop's Waits section reads the same commands with Read wait cycles, showing each cycle's text, and Read held resources, showing each holding as process <pid> holds <kind>:<id>. The real journey kompilator test --manifest-path stado-rs/Cargo.toml --test wait-cycle-install-lock holds a product's real surface lock and runs stado product install … --wait three ways: under a lock its own parent holds (refused, naming the cycle), under a lock a process that waits on nothing holds (the wait stands, no cycle listed), and through another install's wait (refused, then a standing cycle that stado waits cycles names). The real journey kompilator test --manifest-path stado-rs/Cargo.toml --test wait-cycle-resource runs stado waits hold | open --awaits | cycles | release | holds for itself and a child: the child holds service:example-api and waits for revision:example@next; a wait of the test on the service while it holds the revision is refused naming both links, one while nothing holds the revision is registered, a cycle formed by holding the revision afterwards is listed and ends with its release, and each malformed resource and id is refused as above.

Source: this website