node: a cancel that races a job's launch leaves its observer alive in the cgroup; the kill is written once, the wait never ends, and the node is degraded for good (production starts nothing since 23:34Z 11-14) #77

Closed
opened 2026-11-14 23:39:56 +00:00 by xemmerling · 0 comments
Owner

Production (fec2e2f2) has started no job since 23:34:30Z 11-14. Read at 23:36Z to 23:39Z, read-only. A heads-up for the peer: the fix is in node code and restores an invariant node/observe.rs states, so I am commissioning it.

What is seen

  • The node reports degraded since 23:33:41Z: "job j576-231307's processes are still in its cgroup 10 s after its kill (stuck in uninterruptible I/O), so its end waits for them". The server gives it no jobs. About 4,900 asks wait with kind degraded, 11 to 25 of 159 cores are busy, people's checks wait with CI's.
  • The job's cgroup t-jobs/ci/s-af63e94c860202a3/j576-231307 holds one process: pid 1675659, t __observe /var/lib/t/jobs/j576-231307/observed kept …, the job's observer. It is a child of the worker, in the worker's namespaces, started 23:33:30Z. State S, its main thread in __futex_wait, four fuser-N threads in fuse_dev_do_read, no signal pending. No process on the node is in state D.
  • The job was launched at 23:33:31Z ("a job launched") and its run was cancelled in the same seconds: from 23:26Z to 23:34Z a caller cancelled 567 head runs of ci:tilo through the API, about one a second.

What it says

The observer was never signalled. cgroup.kill was written before the observer was in the job's cgroup, and nothing wrote it again. JobCgroup::remove then waits for a cgroup that will not empty, Node::remove_cgroup raises Health::stuck after STALE_AFTER, and Health::still_stuck asks the cgroup at every read and gets "populated" for good.

node/health.rs says of this condition "a killed job's processes still in its cgroup end as the kernel empties it" and that "no node waits for a person or a restart to take jobs again". Both hold for a process that was killed. One that entered after the kill lives on, and one cancelled job then keeps the whole node out. node/observe.rs says the observer "ends with the job (cgroup.kill), never outlives it".

The missing mechanism

A job's cgroup is killed once. What enters it after the kill, a helper of a launch the cancel raced, is never ended. The fix I am commissioning: while a killed job's cgroup is still populated, the kill is written again, so the wait ends in the next round and not never; and a worker that re-attaches to such a job after an upgrade does the same.

What I did not do

No kill and no write on production, no pod deleted, no rollback. The stray process is still there for anyone who wants to read it.

2026-11-14 23:57Z: the fix is on main as 22b5bc22; its promote is under way

node: a killed job's cgroup is killed again while it is still populated (22b5bc22, landed 23:56:24Z on fec2e2f2).

  • JobCgroup::remove_killed is remove for a cgroup that was killed: at each re-read of cgroup.events that still says populated, from the second read on, it writes cgroup.kill again. A process that entered after the first kill is ended within about a second, before STALE_AFTER makes the node degraded. remove itself is unchanged and never kills.
  • Node::remove_cgroup and discard use it. Every call site kills first: run/end.rs after facts, run/start.rs twice after cg.kill(), run/serve.rs after cg.kill().
  • The window, named in the commit: observe::start returns once the spawn does, and the source server enters the job's cgroup itself after its exec (settle_in); start_blocking reads ended once, before preparing. The launch is left as it is.
  • A worker that re-attaches to a job with ended written classifies it Found::Ended and its end reaches remove_cgroup, so the promoted worker should clear j576-231307 itself. That is what I read after the promote and add here.

Checked: a test with a stand-in cgroup that empties only after a second kill (it fails without the change); t's whole check set on testing, 8 of 8 (r8158ad98af). Production still starts nothing as this is written; nothing was done to it by hand.

2026-11-15 00:08Z: promoted, and the new worker cleared the job by itself

22b5bc22 is on production since 00:06:08Z (t's own run on testing 15 of 15, testing deployed 00:05:24Z, promoted with deploy/promote.sh). Read right after, read-only:

time (Z) what
00:06:05.37 the new server leads, epoch 577
00:06:08.14 worker: "fetched the server's build: running it next", 22b5bc22
00:06:14.596 worker: "re-attached to the jobs on disk jobs=2"
00:06:14.617 worker: "a job ended on its node job=j576-231307", 21 ms later
00:06:14.625 server: "an end taken in job=j576-231307"
00:06:15.005 server: "healthy again node=t-worker-ci-x86-1"

The job's cgroup and its directory are gone. The view says the node is healthy and every queued check waits for room, none for a degraded node. 232 jobs started in the two minutes after, 125 cores busy.

Production started no job from 23:34:30Z to 00:06:15Z, 31 minutes 45 seconds. Nothing was killed or written on the node by hand; the stray process lived until the promoted worker's own kill.

Left as it is: the launch window itself (the source server enters the cgroup after its exec). The repeated kill covers it and any other late arrival. Two kill-then-remove sites that run no job (sandbox::probe, sandbox::end_launch_cgroup) still use the plain remove.

Production (fec2e2f2) has started no job since 23:34:30Z 11-14. Read at 23:36Z to 23:39Z, read-only. A heads-up for the peer: the fix is in node code and restores an invariant `node/observe.rs` states, so I am commissioning it. ## What is seen - The node reports degraded since 23:33:41Z: "job j576-231307's processes are still in its cgroup 10 s after its kill (stuck in uninterruptible I/O), so its end waits for them". The server gives it no jobs. About 4,900 asks wait with kind `degraded`, 11 to 25 of 159 cores are busy, people's checks wait with CI's. - The job's cgroup `t-jobs/ci/s-af63e94c860202a3/j576-231307` holds one process: pid 1675659, `t __observe /var/lib/t/jobs/j576-231307/observed kept …`, the job's observer. It is a child of the worker, in the worker's namespaces, started 23:33:30Z. State S, its main thread in `__futex_wait`, four `fuser-N` threads in `fuse_dev_do_read`, no signal pending. No process on the node is in state D. - The job was launched at 23:33:31Z ("a job launched") and its run was cancelled in the same seconds: from 23:26Z to 23:34Z a caller cancelled 567 head runs of `ci:tilo` through the API, about one a second. ## What it says The observer was never signalled. `cgroup.kill` was written before the observer was in the job's cgroup, and nothing wrote it again. `JobCgroup::remove` then waits for a cgroup that will not empty, `Node::remove_cgroup` raises `Health::stuck` after `STALE_AFTER`, and `Health::still_stuck` asks the cgroup at every read and gets "populated" for good. `node/health.rs` says of this condition "a killed job's processes still in its cgroup end as the kernel empties it" and that "no node waits for a person or a restart to take jobs again". Both hold for a process that was killed. One that entered after the kill lives on, and one cancelled job then keeps the whole node out. `node/observe.rs` says the observer "ends with the job (`cgroup.kill`), never outlives it". ## The missing mechanism A job's cgroup is killed once. What enters it after the kill, a helper of a launch the cancel raced, is never ended. The fix I am commissioning: while a killed job's cgroup is still populated, the kill is written again, so the wait ends in the next round and not never; and a worker that re-attaches to such a job after an upgrade does the same. ## What I did not do No kill and no write on production, no pod deleted, no rollback. The stray process is still there for anyone who wants to read it. ## 2026-11-14 23:57Z: the fix is on main as 22b5bc22; its promote is under way `node: a killed job's cgroup is killed again while it is still populated` (22b5bc22, landed 23:56:24Z on fec2e2f2). - `JobCgroup::remove_killed` is `remove` for a cgroup that was killed: at each re-read of `cgroup.events` that still says populated, from the second read on, it writes `cgroup.kill` again. A process that entered after the first kill is ended within about a second, before `STALE_AFTER` makes the node degraded. `remove` itself is unchanged and never kills. - `Node::remove_cgroup` and `discard` use it. Every call site kills first: `run/end.rs` after `facts`, `run/start.rs` twice after `cg.kill()`, `run/serve.rs` after `cg.kill()`. - The window, named in the commit: `observe::start` returns once the spawn does, and the source server enters the job's cgroup itself after its exec (`settle_in`); `start_blocking` reads `ended` once, before preparing. The launch is left as it is. - A worker that re-attaches to a job with `ended` written classifies it `Found::Ended` and its end reaches `remove_cgroup`, so the promoted worker should clear j576-231307 itself. That is what I read after the promote and add here. Checked: a test with a stand-in cgroup that empties only after a second kill (it fails without the change); t's whole check set on testing, 8 of 8 (r8158ad98af). Production still starts nothing as this is written; nothing was done to it by hand. ## 2026-11-15 00:08Z: promoted, and the new worker cleared the job by itself 22b5bc22 is on production since 00:06:08Z (t's own run on testing 15 of 15, testing deployed 00:05:24Z, promoted with `deploy/promote.sh`). Read right after, read-only: | time (Z) | what | |---|---| | 00:06:05.37 | the new server leads, epoch 577 | | 00:06:08.14 | worker: "fetched the server's build: running it next", 22b5bc22 | | 00:06:14.596 | worker: "re-attached to the jobs on disk jobs=2" | | 00:06:14.617 | worker: "a job ended on its node job=j576-231307", 21 ms later | | 00:06:14.625 | server: "an end taken in job=j576-231307" | | 00:06:15.005 | server: "healthy again node=t-worker-ci-x86-1" | The job's cgroup and its directory are gone. The view says the node is healthy and every queued check waits for room, none for a degraded node. 232 jobs started in the two minutes after, 125 cores busy. Production started no job from 23:34:30Z to 00:06:15Z, 31 minutes 45 seconds. Nothing was killed or written on the node by hand; the stray process lived until the promoted worker's own kill. Left as it is: the launch window itself (the source server enters the cgroup after its exec). The repeated kill covers it and any other late arrival. Two kill-then-remove sites that run no job (`sandbox::probe`, `sandbox::end_launch_cgroup`) still use the plain `remove`.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
tilo/t#77
No description provided.