v1.47.0: a start that cannot run its job says the kept cap is not set

A code review of the branch followed the final review.

Its first finding does not hold: it read that the cockpit cannot end a
`sudo nvidia-smi` that hangs, and would then wait for it for good. Tried
on the reference box, the cockpit's user ended a `sudo sleep` it had
started: sudo 1.9.15p5 keeps its caller's real user ID.

One finding is fixed. When the job that sets the kept cap again could
not be started at the cockpit's start, nothing said how it had ended,
and the view said "being set" for good. It now says the kept cap is not
set and that its last try failed. The new test fails without the fix.

docs/cockpit.md gains one limit: that start was run from a start of the
cockpit, not from a cold boot of the box.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Hasan BasbunarandClaude Fable 5.2 committed 2026-11-12 07:27:25 +01:00
1 parent 9f7e55ac57
commit 6fd0f5a531
4 files changed
+30 -3

No files matched your search

+8 -1
View File
@@ -81,7 +81,7 @@ once the start's try failed, a lamp live only while the start sets the cap, a ca
keys and its name for a screen reader. `tests/test_gpu_clock_removal.py`: the uninstall lifts the cap before the
sudoers lines go, and the "Remove with" line, run, lifts a cap kept after it was printed.
`dashboard/tests/touch-check.mjs`: nothing overflows at 375 px. Each test of the three new files fails without the
code, checked with 88 broken versions of it, one behavior at a time, all run again after the final review.
code, checked with 89 broken versions of it, one behavior at a time, all run again after the final review.
**The CI.** On 2026-11-11 the step that installs Chrome on GitHub's arm64 runner hung four times in apt-get, on a name
the runner could not resolve (ports.ubuntu.com), until each attempt was cancelled by hand. The fifth passed in 29 s. It
@@ -101,6 +101,13 @@ cap whose try failed at the start stayed lit while the GPU ran at its own clocks
says the kept cap is not set. And the CI's fix above is brought back to what bounds the step: the options it gave apt
were the runner's own. The review added 4 tests and changed 5 others.
**The code review.** A code review of the branch followed. Its first finding, that the cockpit could not end a `sudo
nvidia-smi` that hangs and would wait for it for good, was tried on the reference box and does not hold: sudo 1.9.15p5
keeps its caller's real user ID, and the cockpit's user ended a `sudo sleep` it had started. One finding is fixed: when
the job that sets the kept cap again cannot be started at the cockpit's start, the view said "being set" for good, and
now says the kept cap is not set and that its last try failed. One limit is added to docs/cockpit.md: that start was
run from a start of the cockpit, not from a cold boot of the box. One test is new.
**What an update does.** The cockpit's sudoers file is written again with its four new lines, by the update's own sudo,
checked by `visudo` before it lands, as at every update that installs the cockpit (`--no-cockpit`, `--no-service` and
`--no-start` leave it as it was: a cockpit that runs there anyway says so when sudo refuses, and names
+6 -1
View File
@@ -5533,8 +5533,13 @@ def gpu_clock_at_start():
except Exception as e: # noqa: BLE001 (the cockpit starts whatever happens here: systemd would restart it forever)
code, out = 500, {"error": f"{type(e).__name__}: {e}"}
if code != 202:
why = out.get("message") or out.get("error")
# the job that sets it never ran, so nothing said how it ended: the view kept "being set" for good. Said as
# a try that failed (the code review of v1.47.0, 2026-11-12)
with GPU_CLOCK_LOCK:
GPU_CLOCK.update(tried=cap, error="failed", said=f"the cockpit could not start the job that sets it again: {why}")
add_event("error", f"the GPU clock cap kept by the cockpit ({gpu_clock_mhz(cap)}) could not be set "
f"again at its start: {out.get('message') or out.get('error')}")
f"again at its start: {why}")
return code
+13
View File
@@ -444,6 +444,19 @@ class TheKeptCapIsSetAgainAtTheStart(Base):
st = self.cp.gpu_clock_state(None)
self.assertEqual((st["kept"], st["set"], st["error"]), ("2400", None, "sudo"))
def test_a_start_whose_job_cannot_be_started_reads_as_a_try_that_failed(self):
# the job never ran (start_action refused it), so nothing said how it ended: the view said "being set" for
# good (the code review of v1.47.0)
self.cp.GPU_CLOCK_FILE.write_text('{"cap": "2400"}\n')
real = self.cp.start_action
self.cp.start_action = lambda *a, **k: (409, {"error": "busy", "message": "another job is running"})
self.addCleanup(setattr, self.cp, "start_action", real)
self.assertEqual(self.cp.gpu_clock_at_start(), 409)
st = self.cp.gpu_clock_state(None)
self.assertEqual((st["kept"], st["set"], st["error"]), ("2400", None, "failed"))
self.assertEqual(st["said"], "the cockpit could not start the job that sets it again: another job is running")
self.assertEqual(self.calls(), [], "a call was made")
def test_main_sets_it_again_before_anything_else_can_run(self):
src = (DASH / "cockpit.py").read_text()
body = src[src.index("\ndef main():"):src.index('\nif __name__ == "__main__":')]
+3 -1
View File
@@ -233,7 +233,9 @@ first and last), and the image, video and 27B lanes are not measured. The watts
alone, as nvidia-smi reads them, not the whole box's. nvidia-smi warns, at each cap it sets, that
the persistence mode is disabled: on a box where nothing holds the GPU any more, the driver may
lose the cap, and the view would still say it is set. Not verified: the reference box keeps its
GPU active with its desktop.
GPU active with its desktop. The cap set again at the cockpit's start was run from a start of the
cockpit, not from a cold boot of the box: if nvidia-smi cannot answer yet when the cockpit starts,
that try fails, the view says the kept cap is not set, and a click sets it.
An image model under study, MiniMax-H3-Image, which is not a lane yet, was measured the same day,
one image at a time (10 at 2048x2048 and 3 at 4736x3552 per cap, no cap again at the end): 2,400