Repository navigation
Description
The defect
The head-to-head projection (tools/us_head_to_head_projection.py) marks a hole between log streams only where a stream's first record comes after the second the earlier streams reached: _stream_holes compares first > reach. So a restart that loses some of one second's lines, while lines on both sides of the loss share that second, leaves no hole. No damage flag fires either, restart_overlaps included, since the surviving boundary records differ. A slice line lost there reads as a straggler, so the estimate runs late until the parent's receive line shows the gap and log_gap holds WAIT. In that window the projection can give NO-GO to a run that fits its budget.
On a NO-GO like the one in the repro below, the watcher (tools/us_head_to_head_watch.sh) restarts its log stream. It stops the app only if the NO-GO holds a poll (600 s) later and a stream started since that restart shows a scorer line printed after both the poll before and that stream's own start. (Its other stop, after three polls in a row with no usable verdict, needs no NO-GO.) So it can stop a run that fits on such a NO-GO when the false NO-GO lasts longer than a poll, or when the next poll meets the intact log's own NO-GO (below). We haven't searched for either.
scripts/lost_lines.py does not search this case. Its cut search removes stretches of whole seconds, and its boundary arms restart a stream inside one second without losing a line. Since 8ea47a2, PR #1190 says so in the evidence README, the runbook and its description. Before that, they read as if every lost line formed a hole and the search covered it. Two docstrings still read that way, and PR #1190 leaves those passages as they are: the projection's module docstring ("the shape a restarted stream leaves when it does not replay") and lost_lines.py's ("the ways a restart can").
Sol found it in its r7 review of PR #1190 (should-fix 2).
Repro (simulated)
random_pools(3) in scripts/lost_lines.py draws seed 3's pool 7 at index 7. Run it through the pool simulator (test_support.microcosm_build.h2h_pool_sim) with:
run = sim.run(
started_at=1794816000,
workers=11,
incumbent_seconds=[90, 213, 212],
candidate_seconds=[255, 286, 217],
incumbent_slices=7,
candidate_slices=80,
start_cost=[221, 325, 369],
first_slice_extra=183,
)Take the pool's own slice times as the prior. Split run.log(1794816000 + 2400) into log[:15] and log[16:] and read the two as the watcher's streams. That restart falls in the 08:34:57Z second (+2,097 s) and loses one line, the incumbent's chunk 2 slice 3/7; its neighbours, slices 2/7 and 4/7, share that stamp and survive.
- Polled at +2,400 s, the intact log estimates 11,535.2 s and the damaged one 11,718.2 s, with no flag. The last slice plus the 600 s allowance ends at 11,678 s.
- Against an 11,700 s budget the damaged log gives
NO-GOthere and the intact oneGO. The intact log givesNO-GOitself from +2,895 to +3,110 s (up to 11,704.0 s, likely from its uneven start costs; inferred), so this budget mixes two effects. A watcher whose restart replays would stop this run at 34 of the 42 restart times on a 5 s grid, where its next poll meets that stretch (inferred from its rule, given a scorer line printed after the poll before and the new stream's start). - Against 11,710 s, polled every 5 s through the candidate's last slice, the intact log never gives
NO-GO. The damaged log gives it from +2,255 to +2,460 s (205 s); from +2,495 s its receive line shows the gap and the log gap holdsWAIT. The watcher would not stop this run (inferred from its rule).
The evidence README (docs/evidence/us-h2h-speed/README.md, "Not searched: a restart that loses part of one second's lines") gives the same case. PR #1190's review folder holds the scripts (runs/r8-fix/repro/, runs/r8-fix/fix-evidence/pool7_next_poll.py).
What the alternatives cost
Sol costed four changes to how the projection treats a boundary second, on the two d844 shapes with the search's three-poll schedule. The figures count polls, not elapsed delays:
| Alternative | False NO-GOs at fitting budgets | Extra NO-GO→WAIT polls at overrunning budgets |
|---|---|---|
| Same-second uncertainty/equality boundary | 0 | 1,393 (+138 fitting GO→WAIT) |
| Sum counts | 82 | 2,080 (+18 NO-GO→GO) |
| Hold identical overlaps | 0 | 2,198 |
| Require both | 0 | 2,172 |
With summed boundary counts, the projection gives 82 false NO-GOs at budgets that fit. A rule that holds identical receive overlaps, or one that stops only when both the maximum and the summed counts say so, misses this case, since its boundary records differ. A rule that treats a same-second boundary as possibly lossy turns the case above into WAIT. It also moves 1,393 polls at overrunning budgets from NO-GO to WAIT, and 138 at fitting budgets from GO to WAIT. On these costs Sol recommends keeping the maximum counts and handling the boundary second's uncertainty separately. Sol suggests holding the time verdict at such a boundary while the affected slices remain unresolved, and keeping a stream that replays the whole log from its first record reading as intact. Sol also suggests damage cases that drop single lines by index and poll through completion.
Before any number changes
A change to the hole rule moves the estimate. So whoever changes it reruns every section of scripts/lost_lines.py and regenerates lost-lines.txt before the README, runbook or PR description change any searched number. They also add a part-second arm to the search so that it covers the case above. The same change narrows the two docstrings above.
Activity