Skip to content

Commit 3a0a983

Browse files
committed
the launch doctor's test retries the exec - the 7.0 azure kernel denies a just-written file with ETXTBSY where the 6.x kernels never raced
kuma_launch_says_when_there_is_no_terminal died on the runner at the exec of the script this thread wrote and closed: code 26, ExecutableFileBusy, transient within tens of milliseconds. The assertion is about the script's honesty; the retry keeps the kernel's timing out of the verdict.
1 parent 02e05f7 commit 3a0a983

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

‎src/containerfile/mod.rs‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,11 +1463,27 @@ for a in \"$@\"; do printf '%s\\n' \"$a\"; done
14631463
std::fs::write(&launch, KUMA_LAUNCH).unwrap();
14641464
use std::os::unix::fs::PermissionsExt;
14651465
std::fs::set_permissions(&launch, std::fs::Permissions::from_mode(0o755)).unwrap();
1466-
let out = std::process::Command::new(&launch)
1467-
.arg("doctor")
1468-
.env("PATH", empty.to_str().unwrap())
1469-
.output()
1470-
.unwrap();
1466+
// The exec can lose a race with the file's own close on the
1467+
// 20261010 runner image's kernel (7.0.0-1012-azure): "Text file
1468+
// busy" (ETXTBSY, 26) for a file this thread wrote and closed -
1469+
// the 6.x kernels never raced it, and the denial clears within
1470+
// tens of milliseconds. Retry a few times so the test asserts
1471+
// the launch script's honesty instead of the kernel's timing.
1472+
let mut attempt = 0u64;
1473+
let out = loop {
1474+
match std::process::Command::new(&launch)
1475+
.arg("doctor")
1476+
.env("PATH", empty.to_str().unwrap())
1477+
.output()
1478+
{
1479+
Err(e) if e.raw_os_error() == Some(26) && attempt < 10 => {
1480+
std::thread::sleep(std::time::Duration::from_millis(25 + 50 * attempt));
1481+
attempt += 1;
1482+
}
1483+
other => break other,
1484+
}
1485+
}
1486+
.unwrap();
14711487
assert!(!out.status.success());
14721488
assert!(
14731489
String::from_utf8_lossy(&out.stderr).contains("no terminal"),

0 commit comments

Comments
 (0)