forge
Explore
Log in

Don't you dare go Hollow

ec-av1 bitrate gate: drop the per-call wall-clock budget (recv_timeout SLOW panic); owner rule bans wall-clock gates, the blocking recv still reports a worker panic

Browse files at this commit

c245a3144fa6629885693197da757cf3cb606e71Ahmet Kaan GümüşParent: f02e3f9
crates/ec-av1/src/encoder/tests.rsmodified+3 -53
@@ -943,36 +943,6 @@
943 };943 };
944 for pyramid in [None, Some(Pyramid::default())] {944 for pyramid in [None, Some(Pyramid::default())] {
945 let arm = format!("{bits_per_second} bps pyramid {}", pyramid.is_some());945 let arm = format!("{bits_per_second} bps pyramid {}", pyramid.is_some());
946- // lane-av1enchang: a BACKSTOP, not a fix. This gate is NOT
947- // hung and NOT regressed -- it is a ~7 hour test in an
948- // unoptimized build (measured: the whole `ec-av1` lib suite
949- // takes 24341s, and this test is the largest single item in
950- // it), and it PASSES. What it lacked was any way to FAIL: a
951- // future non-terminating encode would wedge the suite for
952- // hours with no diagnostic, which is exactly how wave3j and
953- // wave3h were lost. So the arm runs on a worker thread and
954- // THIS thread watches a per-CALL deadline, purely so that
955- // case reports itself.
956- //
957- // The budget is PER CALL, not per test, and it is valued from
958- // a measured run so it cannot turn a correct-but-slow build
959- // red. Measured on this gate's own workload (48 frames of
960- // 640x384): one `encode_frames` call is 0.78s..1.04s
961- // optimized and 8.6s..12.2s debug on the flat arms. A
962- // PYRAMID call codes a whole mini-GOP at once, so its worst
963- // single call is `Pyramid::default().mini_gop` frames
964- // (~9), i.e. ~110s debug. 1800s is therefore ~16x that
965- // worst honest call: no plausible host trips it, and a real
966- // non-terminating encode is reported in 30 minutes instead
967- // of never. `EC_AV1_ENCODE_CALL_BUDGET_SECS` overrides it,
968- // which is how the backstop is proven to bite.
969- let budget = std::time::Duration::from_secs(
970- std::env::var("EC_AV1_ENCODE_CALL_BUDGET_SECS")
971- .ok()
972- .and_then(|v| v.parse().ok())
973- .unwrap_or(1800),
974- );
975- let total = pictures.len() + 1;
976 // Shared, not cloned: the 48 decoded frames are ~35 MB of946 // Shared, not cloned: the 48 decoded frames are ~35 MB of
977 // `u16` luma+chroma, and all eight arms want the same ones.947 // `u16` luma+chroma, and all eight arms want the same ones.
978 let pictures = std::sync::Arc::clone(&pictures);948 let pictures = std::sync::Arc::clone(&pictures);
@@ -1004,31 +974,11 @@
1004 out.take(enc.flush().unwrap());974 out.take(enc.flush().unwrap());
1005 let _ = tx.send(Some(out));975 let _ = tx.send(Some(out));
1006 });976 });
1007- let started = std::time::Instant::now();
1008- let mut calls = 0usize;
1009 let out = loop {977 let out = loop {
1010- match rx.recv_timeout(budget) {978+ match rx.recv() {
1011- // The result IS the last thing the worker sends, so
1012- // receiving it means every call returned. A worker
1013- // that panicked sends nothing and arrives as
1014- // `Disconnected` below, which re-joins it and
1015- // surfaces the real panic.
1016 Ok(Some(out)) => break out,979 Ok(Some(out)) => break out,
1017- Ok(None) => calls += 1,980+ Ok(None) => {}
1018- Err(std::sync::mpsc::RecvTimeoutError::Timeout) => panic!(981+ Err(_) => {
1019- "AV1 bitrate gate SLOW, NOT HUNG: the {arm} arm's encode did not \
1020- return within {}s (arm elapsed {:.0}s, stuck on call {} of {total} \
1021- -- the call that never came back). This gate is a ~7 hour test in \
1022- an unoptimized build and it PASSES, so a red here is NOT a slow \
1023- host: the budget is per CALL and the worst honest call measured \
1024- is ~1s optimized / ~110s debug on a pyramid arm, so reaching this \
1025- panic means an encode call that is NOT RETURNING. \
1026- EC_AV1_ENCODE_CALL_BUDGET_SECS raises the budget.",
1027- budget.as_secs(),
1028- started.elapsed().as_secs_f64(),
1029- calls + 1,
1030- ),
1031- Err(std::sync::mpsc::RecvTimeoutError::Disconnected) => {
1032 worker.join().expect("encode worker panicked");982 worker.join().expect("encode worker panicked");
1033 panic!("AV1 encode worker for {arm} died without a result");983 panic!("AV1 encode worker for {arm} died without a result");
1034 }984 }