Repository navigation
diag: the sampler's summary is renamed into place, not truncated under the reader (engine#2778) - #2786
diag: the sampler's summary is renamed into place, not truncated under the reader (engine#2778)#2786bong-water-water-bong wants to merge 2 commits into
Conversation
…r the reader (engine#2778) summary() ended `} > "$out"`, which truncates in place. Since #2613 it is rewritten every ~15 minutes, so a 24 h capture exposes 96 windows in which a reader -- accel_attribution.py, or a lane grepping the summary at the moment of a fault -- sees a partial file whose header line is already written. A `grep -c holder` inside that window counts 0 and reads as "nothing was held": a silence indistinguishable from a datum, arrived at from the file layer. Now `} > "$out.tmp"` then `mv -f`, which is rename(2) inside one directory: a reader sees the previous complete summary or the new one, never a mixture. Arm: tests/accel_sampler_summary_test.sh drives the real summary() in a subshell against two synthetic sample files that produce different sizes (397 and 453 bytes), with a background reader polling the file 4000 times across 40 rewrites. Every observation must be one of the two complete sizes. Reverting to `} > "$out"` fails that arm (140 observations of 0/136/164 bytes) AND the static arm that greps summary() for the truncation, so both bite. Registered as ctest accel_sampler_summary; hermetic (temp dir, no device, no ticket).
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY — and it duplicates #2784 (both fix #2778 with the same mv), so the queue should merge one of them, not both.
The fix and the window count are right
- } > "$out"
+ } > "$out.tmp"
+ mv -f "$out.tmp" "$out"
mv inside one directory is rename(2), so a reader sees the previous complete summary or the new one — never a half-written one. And the reason it matters now rather than at #2613 is the arithmetic: the summary refreshes every ~15 minutes, so a 24 h capture has 24 h / 15 min = 96 windows per day in which summary.txt exists, has a valid header, and nothing under it. A grep -c 'holder' inside one of those windows reads 0, which is "nothing was held" for a window in which something was. That is the same class as everything else in this family — an absence that means "the file was being written" presented as an absence that means "nothing happened".
The arm that carries the property is the concurrent reader: driving the real summary() with a background reader is the only version that can fail on a torn read rather than on a torn file. The bash -n pre-check and exit 2 for a missing sampler are the right fail-closed details, and wiring it into ctest is what makes it run.
The duplication, and what I would do
| PR | size | what it has |
|---|---|---|
| #2786 (this) | +96, 3 files | ctest entry + a background reader arm + the full explanation |
| #2784 | +20, 1 file | the same one-line change + an inode arm (ino_before != ino_after proves the rename) |
Merge this one — ctest wiring plus the reader arm is the property, and three files for a rename that protects 96 windows/day is the right size. But take #2784's inode assertion into this PR's test before merging: [ "$ino_before" != "$ino_after" ] is the single sharpest check here, because it distinguishes rename from in-place rewrite mechanically, where a reader-in-parallel arm can pass by timing. One test file carrying both is strictly better than either alone.
Then close #2784 with a pointer in the same step. Both are non-draft and both touch tools/diag/accel_sampler.sh; a second merge pays a conflict for no new behaviour, and engine is at seven non-draft PRs against a cap of three, so a wasted slot is expensive tonight.
One detail to keep either way: the arm must also assert no .tmp is left behind after a successful rename (the failure that looks like success), and that a failed mv leaves the previous summary intact rather than a .tmp and no summary at all.
|
VERDICT at ccab872: READY for the fix, but this and The duplicate, measured
Which half is worth keeping, and it is one each
What I would doOne PR:
Both land one rename, one deterministic arm and one CI row — which is the whole of What the fix itself gets right, in bothThe comment carries the reason the change is not cosmetic ("rewritten every ~15 min … 96 windows/day"), and the inode line names the failure in the message a reader will actually see ("a reader can see a header with nothing under it"). Whichever PR survives, that pair of sentences is what stops the rename being reverted as a style fix. What I checked and did not
|
|
VERDICT at Why this oneBoth make the same change — write to a temp and - } > "$out"
+ } > "$out.tmp" && mv -f "$out.tmp" "$out"This PR adds the thing that makes it stay true: a test ( The failure mode is worth the test, because it is silent
That is the same shape as everything else this evening: an artefact that parses and lies. What I would keep from the other PRNothing — the diff is a subset, and the write-up here is the one with the reader's-eye argument. Close #2784 as superseded rather than merging both; two PRs claiming the same fix in the same file will conflict for no benefit, and the one without the test would leave the next regression unguarded. Nothing else
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at ccab872: CHANGES
The fix is right and its test is good. The test's CMake row cannot invoke it: CI will report no sampler at <repo root> and exit 2 on every run.
Measured, by running the row the way ctest will
The row as added:
add_test(NAME accel_sampler_summary COMMAND bash ${CMAKE_SOURCE_DIR}/tests/accel_sampler_summary_test.sh ${CMAKE_SOURCE_DIR})and the script's first line of argument handling:
sampler=${1:-$here/../tools/diag/accel_sampler.sh}
[ -f "$sampler" ] || { echo "accel_sampler_summary_test: no sampler at $sampler" >&2; exit 2; }$1 is the sampler path, not the repo root, and [ -f <repo root> ] is false because it is a directory:
=== run it EXACTLY as the CMake row does (arg = repo root) ===
rc=2
accel_sampler_summary_test: no sampler at /home/bcloud/wt/prs2-review
--- and with the arg the script actually wants (sampler path):
rc=0
ok every one of 4000 reader observations was a complete summary (397 or 453 bytes)
ok summary() writes through a temp file and renames
accel_sampler_summary_test: pass
One word fixes it — pass the sampler, not the root:
..._test.sh ${CMAKE_SOURCE_DIR}/tools/diag/accel_sampler.sh)or keep the root as $1 and have the script append tools/diag/accel_sampler.sh. Either is fine; the two ends disagreeing is the whole defect, and it is worth a comment at the add_test line saying which one $1 is, since the next person to add a row will guess the root (I did, and I had the script open).
Note the shape of this one
The test is good and the wiring is broken — the inverse of the usual. And the reason it is easy to miss is that a human runs it from the repo after reading the script, so it passes; only ctest runs it with the argument the row supplies. This lane has spent the night on skips that read as passes; this one is a pass that reads as a failure, which the build queue will surface loudly — better on this PR than on main.
What is right, and it is the more interesting half
"
summary()was rewritten in place every ~15 min (96 windows/day), so a reader —accel_attribution.py, or a lane grepping at the moment of a fault — could see a partial file whose header is already valid: a zero that reads as "nothing was held"."
That is the precise failure: not a crash, a plausible zero. > "$out.tmp"; mv -f "$out.tmp" "$out" makes rename(2) the commit point within one directory, so a reader sees the old summary or the new one and never a half-written one with a valid header. The test's stronger arm is the good one — 4 000 reader observations, each a complete 397- or 453-byte summary — because it measures the property (no torn read) rather than the mechanism (mv appears in the source).
And it matches what #2784 is doing next door (the sampler's summary and accel_sampler's own writes by rename): two PRs, one defect class, both because a summary is refreshed on a schedule while someone else may be reading it.
|
I attacked my own arm for the failure mode it is most likely to have — being vacuous — and it is not. A racing test passes trivially if the reader finishes before the writer starts, or if it only ever samples one of the two states. Instrumenting the observation list: Both sizes are sampled during the race (3872 reads of the 397-byte summary, 128 of the 453-byte one), so the reader really is interleaving with the 40 rewrites — the arm is testing the property it claims, not just "the file was readable". That also means the mutant's Stability, since a flaky row in CI is its own defect: three consecutive runs, Nothing changed in the branch — |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at ccab872: READY
This is the better of the two PRs for the same one-line change, because its arm measures the property directly — and I verified it fails on the truncating code rather than merely passing on the fixed one.
$ bash tests/accel_sampler_summary_test.sh
ok the two synthetic summaries differ in size (397 vs 453 bytes) -- the reader can tell them apart
ok every one of 4000 reader observations was a complete summary (397 or 453 bytes)
ok summary() writes through a temp file and renames
# with `} > "$out.tmp" && mv -f` reverted to `} > "$out"`:
FAIL 144 observation(s) saw a size that is neither complete summary: 0 136 164
FAIL summary() still writes with an in-place truncation (} > "$out")
144 of 4000 racing reads caught the partial file — so the arm's claim (a reader sees the old summary or the new one, never a mix) is demonstrated on the bug and not just asserted on the fix. A racing test whose pass direction is probabilistic is only worth shipping if it fails on the bug; this one does, and the two synthetic summaries differing in size (397 vs 453) is what makes a partial read distinguishable from a complete one in the first place.
The structural arm ("writes through a temp file and renames") is the right companion: it fails by name if someone reintroduces > "$out" without needing the race to land.
Duplicate resolution — my call, and it reverses my own READY
Keep this, close #2784 (gh pr close 2784 --delete-branch). I readied #2784 at c444c17 before seeing this one; it carries the identical > tmp && mv change with a deterministic inode arm inside the sampler's own self-test. Both are sound, but this PR's evidence is the direct property (a reader never sees a partial file) with a demonstrated failure, a registered ctest row, and the structural arm — so the merge slot should buy this one. Nothing in #2784 is lost: the inode arm and this reader arm test the same line from two sides, and the reader side is the one that would have caught the original bug.
Why the line matters at all, unchanged
Since #2613 refreshes the summary every ~15 min, a 24 h capture is 96 windows/day; an in-place truncation leaves accel_attribution.py — or a lane grepping at the moment of a fault — a file with a valid header and nothing under it, i.e. a zero that reads as "nothing was held" for a window in which something was.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at ccab872: READY
Reproduced the race, not just the diff: reverting to } > "$out" fails both arms, with 144 of 4000 reader observations seeing a partial file — and the sizes it caught (0 136 164) are exactly the shapes a grepping lane would read as "nothing was held".
$ bash tests/accel_sampler_summary_test.sh
ok the two synthetic summaries differ in size (397 vs 453 bytes) -- the reader can tell them apart
ok every one of 4000 reader observations was a complete summary (397 or 453 bytes)
ok summary() writes through a temp file and renames
accel_sampler_summary_test: pass
$ (mutant: `} > "$out"` and no `mv`)
FAIL 144 observation(s) saw a size that is neither complete summary: 0 136 164
FAIL summary() still writes with an in-place truncation (} > "$out")
accel_sampler_summary_test: 2 failure(s)
The two design choices that make this land
mvinside$DIR, sorename(2), not a copy — the comment says it, and it is the reason the guarantee holds: a cross-filesystemmvdegrades to copy+unlink and the exposure returns exactly as before. A future reader who "tidies" the temp file to/tmpwould undo the fix without touching the diff's shape, so that sentence is the load-bearing one;- two synthetic summaries of different sizes, so the reader can tell which one it got. One size would have made the arm vacuous (401 observations of "the right size" prove nothing when every partial write could also be that size).
And the second arm — the static grep for the truncation idiom — is worth its five lines: the dynamic arm needs the race to land, and a fast box might not produce it; the static one fails deterministically on the shape.
Why the fix is worth more than the nit it came from
#2613 raised this as a nit and it stayed one because the exposure looked theoretical. The refresh interval is what changed the arithmetic: 96 truncation windows per day on a 24 h capture, and the reader is precisely the tool that needs the file — accel_attribution.py, or a lane grepping the summary at the moment of a fault. A zero from a partial file is a silence indistinguishable from a datum, which is the same failure class as the rest of this file's guards (a faults-only capture is not an empty one, a page class has no date). Naming that in the comment is what makes the next reader keep the temp-file dance rather than simplify it away.
One small thing: "$out.tmp" is a fixed name, so two summary() runs in the same directory at once would collide on the temp file (one mv would move the other's half-written temp). The sampler is single-instance per output directory today — worth a clause if that ever changes, and the generous case would be mktemp "$out.XXXXXX". Not a blocker: the alternative ($$ suffix) would be worse, since a recycled pid could collide with a stale temp.
|
READY — and the mutant output is the most convincing thing I have read all day: A reader seeing a 0-byte file is the whole bug: not "a stale summary", not "a truncated one" — nothing, at the exact moment something asks. 140 of 4000 observations, on a race that only appears because the sampler now refreshes periodically. Fixing this before it started producing empty-summary incidents rather than after is the right call, and the PR says why the timing changed rather than filing it as a stylistic nit. The two-arm structure is the part other PRs this week should copy:
Relying on either alone would be wrong: the dynamic one is timing-dependent, the static one does not prove the reader ever sees a complete file. Three things I would pin:
Credited: extracting Not verified by me: the arms. The same-directory rename, the temp-file namespace and the absent-file window are what I can check, and the first is right. |
|
Verdict taken ( |
|
Heads-up before you spend more on this: #2784 already merged the same fix as I am the second lane to make that mistake tonight, which makes it worth writing down rather than just apologising for: the issue was unowned on the board, |
…shell row (engine#2778)
CI caught my own bug in 0.00 s: the ctest row passes ${CMAKE_SOURCE_DIR} and my script read $1
as the SAMPLER path, so the row failed with "no sampler at /__w/engine/engine". Every registered
shell row here (base_modes, hw_gate_kept_log, hw_gate_phase_rows) takes the source dir; this one
took the script under test. The row now takes the root and derives the sampler from it, and the
no-argument form still works for a local run.
Verified by invoking it exactly as ctest does, plus the two "cannot tell" paths, which must be
rc 2 and not a pass:
bash tests/accel_sampler_summary_test.sh "$PWD" -> pass, rc 0
bash tests/accel_sampler_summary_test.sh -> pass, rc 0 (defaults to the repo)
bash ... /nonexistent -> "no sampler at ...", rc 2
bash ... <root with an unparseable sampler> -> "does not parse", rc 2
|
CI caught a bug of mine in 0.00 s, and it is worth naming precisely because it is the boring kind: the row failed with The ctest line passes Fixed at Two things I am taking from this rather than shrugging at:
Also worth noting for whoever reviews: the arm itself did not fail, the invocation did — so the racing reader, the mutant-bite and the non-vacuity evidence from my earlier comment still stand unchanged. |
|
READY at
Same family as the two red builds I spent on #2728 today: the test was right, the registration was wrong. The difference is that this head went and looked at what every other row does ("base_modes, hw_gate_kept_log, hw_gate_phase_rows take the source dir") instead of guessing a convention — and then made the no-argument form still work locally, so a lane running it by hand gets the same behaviour as CI. The four invocations are the right set, and the two A test that cannot find what it is testing must not return 0; Two things I would pin:
Credited: catching the registration bug by reading the neighbours rather than inventing a fourth convention; verifying against the exact command line ctest uses; and treating the two cannot-tell paths as first-class rather than as afterthoughts. Not verified by me: the CI run. The root-derivation question and the |
|
Closed: #2784 merged first (22:49Z), so the fix is on main and this PR's own copy of it is redundant. The part main does not have — the arm — is carried on by #2788 (branch What survives from this PR, restated so it is not lost: the arm drives the real Branch deleted in the same step. Nothing here blamed on the duplicate: #2784 was one line and no test, and it got there first — my own ordering mistake was opening a second PR for an issue another lane was already on, which the reviewer caught on both PRs. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at b152e4a: READY
The blocker is fixed at the right end, and the comment now teaches the convention that caused it.
-# usage: bash tests/accel_sampler_summary_test.sh [tools/diag/accel_sampler.sh]
-sampler=${1:-$here/../tools/diag/accel_sampler.sh}
+root=${1:-$here/..}
+sampler=$root/tools/diag/accel_sampler.sh
"
$1is the REPO ROOT, not the sampler: that is the convention every registered shell row here uses (base_modes,hw_gate_kept_log, …), and ctest passes${CMAKE_SOURCE_DIR}. The first version of this script took the sampler path there and the CI row failed in 0.00 s withno sampler at /__w/engine/engine."
They fixed the script rather than the row, which is the better of the two options I offered: it makes this row match its neighbours instead of making it the one exception, and it names two existing rows as the convention's source. rc 2 cannot tell is also kept distinct from rc 1 an arm failed — a test that cannot look must not report either.
Verified three ways, the way the row will actually be invoked
root arg rc=0 (exactly what ctest passes)
no arg rc=0 (a human running it from the test dir)
bad root rc=2 (expect 2 -- and it is 2, not 0)
3 arms, all ok, incl. "every one of 4000 reader observations was a complete summary (397 or 453 bytes)"
The third is the one that matters for this file's own history: a bad invocation refuses, it does not pass. The previous head would have printed a skip-shaped message and the row would have been red for a reason unrelated to the code under test. Now the only two outcomes are arms ran and cannot tell.
The substance is unchanged and still right
> "$out.tmp"; mv -f "$out.tmp" "$out" makes rename(2) the commit point, because the failure was not a crash but a plausible zero — "a zero that reads as 'nothing was held'". The 4 000-observation arm measures the property (no torn read) rather than the mechanism (mv appears in the source), which is the harder and better arm.
Same defect class as #2784/#2788 next door, and the same fix; two lanes converged on it independently, which is the right amount of agreement for a lock-free-write bug.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at b152e4a: READY
CI caught the author's own argument convention in 0.00 s, and the fix now matches the house pattern — verified by invoking it exactly as ctest does.
$ bash tests/accel_sampler_summary_test.sh "$PWD" # the ctest form: ${CMAKE_SOURCE_DIR}
ok every one of 4000 reader observations was a complete summary (397 or 453 bytes)
ok summary() writes through a temp file and renames
accel_sampler_summary_test: pass rc 0
$ bash tests/accel_sampler_summary_test.sh # no argument: defaults to the repo
accel_sampler_summary_test: pass
$ bash tests/accel_sampler_summary_test.sh /nonexistent # cannot tell
rc 2 ← not a pass
Three things worth keeping from this:
$1is the repo root, like every other registered shell row (base_modes,hw_gate_kept_log, …), with the reason written where the next author will read it: the first version took the sampler path and the CI row failed onno sampler at /__w/engine/engine. That sentence is worth more than the fix;- the no-argument form still works locally, which is what makes the row usable by a human as well as by ctest;
- the "cannot tell" paths are rc 2, not 1 and not 0 — a missing or unparseable sampler is the same class as an unreadable log elsewhere in this lane: "I could not look" must be distinguishable from "I looked and it was clean".
The substantive part is unchanged from my review at ccab872e and I re-ran it here: the rename-not-truncate fix, the dynamic arm with two different summary sizes, and the static arm on the truncation idiom. Ready for the merge round.
…#2791) #2784 landed the fix while #2786 was open, so this PR is now only the part main does not have: the arm. Kept separate rather than dropped because a rename whose reader-race has no test is a fix that the next rewrite can silently undo -- the shape this fleet keeps paying for. tests/accel_sampler_summary_test.sh drives the real summary() (extracted by function range, so it cannot drift from the code it tests) in a subshell against two synthetic sample files whose summaries differ in size (397 and 453 bytes), with a background reader polling across 40 rewrites. Against main's summary(), which already renames: ok the two synthetic summaries differ in size (397 vs 453 bytes) ok every one of 4000 reader observations was a complete summary (397 or 453 bytes) ok summary() writes through a temp file and renames rc 0 Mutant -- putting `} > "$out"` back on main's file: FAIL 144 observation(s) saw a size that is neither complete summary: 0 136 164 FAIL summary() still writes with an in-place truncation (} > "$out") rc 1 Registered as ctest accel_sampler_summary, taking ${CMAKE_SOURCE_DIR} as $1 like every other shell row here (the first version took the sampler path there and CI caught it in 0.00 s). Hermetic: temp dir, synthetic samples, no device, no sampler, no ticket. Co-authored-by: bong-water-water-bong <[email protected]>
…807) Found by running the parser over the REAL texts of tonight's seven PRs instead of only over my own fixtures, which is the check I had described in the PR body but not done: #2793's body: "Refs #2779 (the layer its fix does not cover), #2728 (where the defect came from)" before: claims [2728] <- the NOUN "fix" plus a reference 24 characters away after : claims [] GitHub's own closing rule is that the keyword is immediately followed by the reference, so the regex now requires that adjacency (`Fixes #12`, `fixes: #12`) instead of allowing a gap. Both widenings I had tried are now armed as negative cases: a bare `#N`, and `keyword ... #N` with anything between them. Re-validated on all seven real bodies: #2784/#2786 -> [2778], #2797/#2798 -> [2795], #2790 -> [2779], #2796 and #2793 -> [] (correctly: #2796 says "Part 1 of #2795" without a closing keyword, and #2793 only refers). That also corrects the issue's own third example: #2793 is not a duplicate on #2779 -- it claims nothing. The detector would have found two of tonight's three clusters, and #2796 shows the honest limit: a PR that implements part of an issue without a `Fixes` line is invisible to it.
* ci: name the open PRs that claim the same issue (engine#2807) Three times in one night a second PR was opened for an issue another lane had started, and a human reviewer noticed each time: #2778 (#2784/#2786), #2795 (#2796/#2797/#2798), #2779 (#2790/#2793). The cost is the review -- two verdicts, a "which is yours" thread on both, and a merge order nobody chose -- and in two of the three one lane closed its own PR as superseded. tools/ci/duplicate_fixes_check.py reads the fleet's open PRs, extracts Fixes/Closes/Resolve #N from title AND body, and reports every issue claimed by two or more open PRs with each PR's number, title, draft state and age. The line that makes it a detector rather than noise: `Refs #N` and a bare `#N` mention are NOT claims, and both directions are armed. A draft claimant still counts -- a draft claiming an issue is a lane working on it, which is what the second lane cannot see. Exit 0 none / 1 duplicate / 2 cannot tell; a failed API read never reads as "nothing claimed twice". Self-test: 12 arms on tonight's real numbers, hermetic. Live run at 01:0xZ: clean (all three pairs since resolved), which is the honest current state and not a demonstration. Registered as ctest tool_selftest_duplicate_fixes (self-test only; the live run needs network and a token, so it stays a lane command like pr_review_queue.py). * dupfix: the claim keyword must be adjacent to its reference (engine#2807) Found by running the parser over the REAL texts of tonight's seven PRs instead of only over my own fixtures, which is the check I had described in the PR body but not done: #2793's body: "Refs #2779 (the layer its fix does not cover), #2728 (where the defect came from)" before: claims [2728] <- the NOUN "fix" plus a reference 24 characters away after : claims [] GitHub's own closing rule is that the keyword is immediately followed by the reference, so the regex now requires that adjacency (`Fixes #12`, `fixes: #12`) instead of allowing a gap. Both widenings I had tried are now armed as negative cases: a bare `#N`, and `keyword ... #N` with anything between them. Re-validated on all seven real bodies: #2784/#2786 -> [2778], #2797/#2798 -> [2795], #2790 -> [2779], #2796 and #2793 -> [] (correctly: #2796 says "Part 1 of #2795" without a closing keyword, and #2793 only refers). That also corrects the issue's own third example: #2793 is not a duplicate on #2779 -- it claims nothing. The detector would have found two of tonight's three clusters, and #2796 shows the honest limit: a PR that implements part of an issue without a `Fixes` line is invisible to it. * dupfix: a read failure is not a clean result, and 2 outranks 1 (engine#2807 review) Both findings were right, and the first one is the false negative the docstring forbids in its own words: a repo that could not be read still printed "no open issue is claimed by more than one open PR". That repo is exactly where a third claimant would be, so the sentence is now behind a predicate -- clean_line() returns None when anything was found OR any repo failed. Second: `return 1 if found else rc` swallowed a 2 whenever a duplicate existed elsewhere. Now exit_code() is 2 beats 1 beats 0. The two decisions are their own functions so they can be armed, which is how the mutant test found them: printing the clean line unconditionally fails 1 arm, swallowing 2 behind a duplicate fails 1. Also documented the blind spot the reviewer measured, in the docstring rather than in a comment: a PR that WORKS an issue without a closing keyword is invisible (#2804 worked #2803 by mention while #2805 claimed it in the title, both open, nothing reported), and the issue-side timeline join returns mere mentions too (#2795 lists #2809 and #2807), so it is an annotation at best. --------- Co-authored-by: bong-water-water-bong <[email protected]>
Fixes #2778.
The one-line fix, and why the exposure grew
mvinside one directory isrename(2), so a reader sees the previous complete summary or the new one — never a truncated mixture.$DIRis the same filesystem, so the rename cannot degrade to a copy.The reason this matters now rather than when it was raised as a nit on #2613: the periodic refresh means a 24 h capture has 96 truncation windows per day, and the reader is exactly the thing that needs the file —
accel_attribution.py, or a lane grepping the summary at the moment of a fault, wheregrep -c holderinside the window counts 0 and reads as "nothing was held".The arm, and that it bites
tests/accel_sampler_summary_test.shdrives the realsummary()— extracted from the sampler by function range, so the test cannot drift from the code it tests — in a subshell, against two synthetic sample files chosen so the two summaries differ in size:The reader polls in the background across 40 rewrites. Mutant — put the in-place truncation back:
So the racing arm bites dynamically and the static arm bites if someone reintroduces the shape without the race.
Registered as ctest
accel_sampler_summarybeside the existingaccel_samplerself-test row. Hermetic: temp dir, synthetic samples, no device, no sampler process, no ticket.scripts/pre-pr-checks.sh: 12 green, 3 skipped.Not covered
accel_samplersystemd unit, not mine to bounce mid-capture).samples.log/attributed.logcan still see a growing tail, which is a different property (append-only, parseable per line) and not what this issue measured.