Archived
dashboard: statsdump exits cleanly when its handle is dead; sparkline comment told a third wrong story
Judge ringer 4 on the final tree (3 slices, Tasmania, independent questions). Slice A PASS-WITH-CAVEATS, slice B PASS-WITH-CAVEATS, slice C FAIL. Both findings were real and both are fixed here. statsdump (slice B, R1 + R2): the rotation fix deferred the death instead of removing it. If the best-effort reopen inside rotate() itself fails, out stays CLOSED, the re-raised OSError is swallowed by the cap check's handler, and the next poll's write raises ValueError -- which no handler in the file catches (they all catch OSError). Slice B found the unpatched twin in the write-failure handler: close succeeds, reopen fails (EMFILE/ENOENT/EACCES/EIO -- not ENOSPC, which append-open survives), and the cap check's out.tell() dies on the closed handle two statements later. Both paths now raise a dedicated RecorderDead, caught at the loop: the recorder exits loudly with its exit summary, because a handle that cannot be reopened means recording cannot continue. Deferring a traceback by one iteration was the wrong ambition; exiting with the count is the honest terminal state. Canaries reproduce both geometries (reopen fails after rotation shift fails; reopen fails after write fails): pre-fix dies 'ValueError: I/O operation on closed file' with no summary in both; post-fix exits rc=0/rc=1 with the summary printed in both. dashboard.cpp (slice C, FAIL): my previous commit replaced one wrong sparkline comment with another. The truth, verified against the call sites: setMetric samples EVERY poll for every tile (idle polls push 0), so the accept sparkline spans the same 60 s as the others; the only difference is the dash case -- no draft head, no value, a gap that stretches the line over more wall-clock. The original comment claimed 10 s drafting windows; my rewrite claimed drafting-only sampling, conflating the sparkline (setMetric/hist) with the triple's recent window (noteSample, win=false). Two lies in one comment block, both caught by review rather than by me. Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
This commit is contained in:
1 parent
b2e0ef7911
commit
459529638e
2 files changed
+21
-8
No files matched your search
@@ -2041,9 +2041,11 @@ function update(s, dt) {
|
|||||||
* reads as a live measurement of a lane that drafted nothing. The lifetime ratio stays on
|
* reads as a live measurement of a lane that drafted nothing. The lifetime ratio stays on
|
||||||
* /stats and /metrics; what the tile answers is "what is it accepting now", and now, idle,
|
* /stats and /metrics; what the tile answers is "what is it accepting now", and now, idle,
|
||||||
* it is accepting nothing.
|
* it is accepting nothing.
|
||||||
* THE SPARKLINE'S SCALE DIFFERS from the other tiles: it samples only polls that DRAFTED (the
|
* THE SPARKLINE'S SCALE IS THE SAME as the other tiles -- 120 samples at the 500 ms poll, 60 s
|
||||||
* others sample every poll), so its 120 samples span 60 s of continuous drafting at the 500 ms
|
* -- because setMetric samples every poll, idle polls included (0 is a value; see above). The
|
||||||
* poll -- and more wall-clock than that when drafting is intermittent. */
|
* one difference is the dash case: with no draft head there is no value to push, so those polls
|
||||||
|
* leave a gap and the line stretches over more wall-clock than 60 s. (Judge slice 4C: this
|
||||||
|
* comment claimed a 10 s window, then a drafting-only window; neither sampling scheme exists.) */
|
||||||
if (!(s.draft_positions && s.draft_positions.length)) setMetric("accept", null, DASH);
|
if (!(s.draft_positions && s.draft_positions.length)) setMetric("accept", null, DASH);
|
||||||
else if (awR != null) setMetric("accept", 100 * awR, pctn(awR, 0));
|
else if (awR != null) setMetric("accept", 100 * awR, pctn(awR, 0));
|
||||||
else setMetric("accept", 0, pctn(0, 0)); /* drafted nothing this poll -> 0, the idle figure */
|
else setMetric("accept", 0, pctn(0, 0)); /* drafted nothing this poll -> 0, the idle figure */
|
||||||
|
|||||||
+16
-5
@@ -30,6 +30,15 @@
|
|||||||
# for a quiet hour.
|
# for a quiet hour.
|
||||||
import argparse, json, os, sys, time, urllib.error, urllib.request
|
import argparse, json, os, sys, time, urllib.error, urllib.request
|
||||||
|
|
||||||
|
class RecorderDead(Exception):
|
||||||
|
"""The output handle could not be reopened; recording cannot continue.
|
||||||
|
|
||||||
|
A closed handle raises ValueError on the next write/tell, which the OSError
|
||||||
|
handlers do not catch -- the poller would die with a traceback and no exit
|
||||||
|
summary (judge-4 slices B R1/R2). Dying HERE, loudly, with the summary, is
|
||||||
|
the honest terminal state: the recorder cannot record."""
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
ap = argparse.ArgumentParser(add_help=True)
|
ap = argparse.ArgumentParser(add_help=True)
|
||||||
ap.add_argument("--port", type=int, default=8800)
|
ap.add_argument("--port", type=int, default=8800)
|
||||||
@@ -79,9 +88,9 @@ def main():
|
|||||||
# this succeeds even on a full disk, and the poller keeps counting losses.
|
# this succeeds even on a full disk, and the poller keeps counting losses.
|
||||||
try:
|
try:
|
||||||
out = open(a.out, "a")
|
out = open(a.out, "a")
|
||||||
except OSError:
|
except OSError as reopen_err:
|
||||||
pass
|
raise RecorderDead("reopen after failed rotation: %s" % reopen_err) from None
|
||||||
raise
|
raise # reopen succeeded: the ORIGINAL error is now safe to swallow upstream
|
||||||
sys.stderr.write("statsdump: %s/stats every %.1fs -> %s\n" % (base, a.every, a.out))
|
sys.stderr.write("statsdump: %s/stats every %.1fs -> %s\n" % (base, a.every, a.out))
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
@@ -126,8 +135,8 @@ def main():
|
|||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
out = open(a.out, "a")
|
out = open(a.out, "a")
|
||||||
except OSError:
|
except OSError as reopen_err:
|
||||||
pass
|
raise RecorderDead("reopen after failed write: %s" % reopen_err) from None
|
||||||
if a.max_mib > 0:
|
if a.max_mib > 0:
|
||||||
try:
|
try:
|
||||||
if out.tell() >= a.max_mib * 1024 * 1024:
|
if out.tell() >= a.max_mib * 1024 * 1024:
|
||||||
@@ -142,6 +151,8 @@ def main():
|
|||||||
time.sleep(left)
|
time.sleep(left)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
sys.stderr.write("statsdump: interrupted\n")
|
sys.stderr.write("statsdump: interrupted\n")
|
||||||
|
except RecorderDead as e:
|
||||||
|
sys.stderr.write("statsdump: DEAD (%s) -- exiting with summary\n" % e)
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
out.close()
|
out.close()
|
||||||
|
|||||||
Reference in new issue
Block a user