forge
Explore
Log in

Don't you dare go Hollow

lanes: av1pinloud report -- loud self-pins, the28143 non-fatal decision, class sweep

Browse files at this commit

4dcc844a0c50af551e5e878f1c3ef6508871f6d8Ahmet Kaan GümüşParent: f3fd848
lanes/av1pinloud.report.mdadded+112 -0
@@ -0,0 +1,112 @@
1+# lane av1pinloud — loud self-pins in `stream.rs`
2+
3+## Defect
4+
5+Every self-pin site in `crates/ec-av1/src/stream.rs` wrote with
6+
7+```rust
8+let _ = std::fs::write(&pin, &stream);
9+```
10+
11+and then named the path in the very next statement's failure message
12+("stream pinned at {}"). A partial write (`ENOSPC`, `RLIMIT_FSIZE`) therefore left a
13+**truncated stream at exactly the path the reader was told to replay** — the same
14+silent-truncation class that produced two false defect rows on the dump path
15+(`lanes/unwritten-dep.report.md`), one hop downstream. `fs::write`'s `Result` was
16+discarded, so nothing said so.
17+
18+Nine sites: `stream.rs` 14191, 18201, 23170, 23190, 23589, 23611, 27904, 28896,
19+29106 — plus the two `EC_AV1_GATE_DUMP` writes beside 28896/29106
20+(`stream.rs` 28898, 29108), which checked the write but never checked the resulting
21+length.
22+
23+## Change
24+
25+`crates/ec-av1/src/dumpio.rs` gains two wrappers over the existing `LoudDump`, plus a
26+`failure_line` helper so the fatal and reporting shapes cannot drift:
27+
28+- `pin(site, path, bytes)` — fatal. Same shape as `write_planes` for a single blob:
29+ create, `write_all`, then stat the file and compare against `bytes.len()`.
30+ Success path is byte-identical to the old `fs::write`: same bytes, same path,
31+ truncate-then-write.
32+- `pin_reporting(site, path, bytes) -> Result<(), String>` — non-fatal, not silent.
33+ Returns the **same** failure line `pin` would have panicked with
34+ (`ec-av1 dump FAILED [EC_AV1_PIN] <path>: wrote N of M bytes: <why>`).
35+
36+All nine pin sites now call `pin("EC_AV1_PIN", ...)`; both `EC_AV1_GATE_DUMP` writes
37+call `pin("EC_AV1_GATE_DUMP", ...)` (previously `fs::write(...).expect(...)`, loud on a
38+write error but blind to a short file on disk).
39+
40+One more in-crate site of the same shape: `msac.rs:1140` (`EC_AV1_SYMTRACE` flush) had a
41+hand-rolled panic that compared the buffer length but never stat'ed the file. Folded
42+into `pin` so it gets the on-disk check.
43+
44+### `stream.rs:28143` — the warns-by-design site: decision
45+
46+Routed through `pin_reporting`, keeping it non-fatal. The two shapes differ for a
47+stated reason, not by accident:
48+
49+- the nine sites run **inside the arm that is already panicking** — the pin exists to
50+ feed that panic, so dying on a short pin replaces a message with a strictly better
51+ one (same panic, plus the byte counts).
52+- 28143's real failure is the `assert_eq!` three lines below (luma/U/V vs ffmpeg).
53+ Panicking on the write would **mask that assert** with an unrelated filesystem
54+ error — the exact failure its comment refuses. So it must not be fatal.
55+
56+What changed is what it *prints*: the old `could not pin to {path}: {e}` warning
57+became `cdfflake: ec-av1 dump FAILED [EC_AV1_PIN] {path}: wrote N of M bytes: {why}` —
58+same severity (a warning, then the asserts run), now carrying expected-vs-on-disk
59+counts. A truncated pin there was previously indistinguishable from a good one.
60+
61+## Proof
62+
63+`dumpio::tests::a_pin_under_a_file_size_cap_fails_loudly` is the real reproduction: a
64+child under `ulimit -f 8` (8 KiB) pins 32 KiB, leaving a fragment and dying on the
65+counts, not carrying on.
66+
67+```
68+$ EC_AV1_PINLOUD_CHILD=/tmp/pincap2 bash -c 'ulimit -f 8; trap "" XFSZ; exec "$0" "$@"' \
69+ <testbin> --exact dumpio::tests::pin_child_under_cap --nocapture
70+ec-av1 dump FAILED [EC_AV1_PIN] /tmp/pincap2/cap-pinned.obu: wrote 8192 of 32768 bytes:
71+ write failed with 0 bytes confirmed in hand: File too large (os error 27)
72+test dumpio::tests::pin_child_under_cap ... FAILED
73+$ ls -l /tmp/pincap2
74+-rw-r--r-- 1 tahinli tahinli 8192 cap-pinned.obu
75+```
76+
77+8192 B on disk where 32768 B was owed — bytes-expected vs bytes-on-disk, and the
78+reported count is the file's real length, not what `write_all` acknowledged.
79+
80+Also: `pin_success_path_is_byte_identical` (bytes on disk equal the bytes handed in),
81+`pin_to_a_full_device_is_loud`, `pin_reporting_is_loud_but_not_fatal` (the same line,
82+returned rather than panicked, plus a healthy pin returning `Ok`).
83+
84+Scoped runs (`CARGO_TARGET_DIR=/home/user/.cache/tgt/av1pinloud`):
85+
86+```
87+cargo test -p ec-av1 --lib dumpio:: 12 passed; 0 failed
88+cargo test -p ec-av1 --lib -- --exact \
89+ stream::tests::a_444_intra_in_inter_128root_muchroma_pinned_stream_decodes_pixel_exact
90+ 1 passed; 0 failed
91+cargo check -p ec-av1 --tests clean
92+```
93+
94+## Class sweep, other crates
95+
96+`grep` for `let _ = std::fs::write` / `let _ = …write_all` / discarded `fs::write` across
97+every `ec-*` crate:
98+
99+| Site | Shape | Disposition |
100+|---|---|---|
101+| `ec-vorbis/tests/oracle.rs:1447,1452` | `let _ = fs::write` of sweep tables into `lanes/*.txt` | **Reported, not fixed.** Not the same shape: the path is not printed in a failure message, the file is a human-read report rather than a replay artefact, and the asserts that follow (`rows > 0`, `failures.is_empty()`) do not depend on it. Sibling lane material. |
102+| `ec-ac3/examples/ac3dec.rs:89,96` | `let _ = out.write_all(..)` to raw stdout of an example decoder | **Reported, not fixed.** No path is named; a short write there is the encoder of a raw file a downstream `cmp` measures. Different class (unverified output, not a mis-pointed replay path). |
103+| `ec-h264/tests/encode.rs:475,1068`, `ec-h265/tests/encode.rs:289,341` | `std::fs::write(..).ok()?` feeding an `ffmpeg` subprocess | **Reported, not fixed.** `.ok()?` propagates the failure as `None` — the test helper bails rather than decoding a truncated file, so there is no silent-truncation path to close. |
104+
105+No sibling site has the "discard the error, then hand the reader that exact path"
106+shape. Fixed only `ec-av1`.
107+
108+## Notes for the reviewer
109+
110+- Success path is byte-identical; the only behavioural delta is that a short pin is
111+ now fatal (9 sites + 2 gate dumps + the symtrace flush) or loud-with-counts (28143).
112+- The `EC_AV1_PIN` site label is a new failure-line prefix; grep it when triaging.
\ No newline at end of file\ No newline at end of file