-
Notifications
You must be signed in to change notification settings - Fork 13.3k
compiletest remove_and_create_dir_all
may need retries
#139230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@rustbot claim |
Hello @jieyouxu, Could you elaborate on the retry mechanism shared between pub fn retry_io<T, F>(func: F) -> io::Result<T>
where
F: Fn() -> io::Result<T>,
{
let mut attempt = 0;
loop {
match func() {
Ok(result) => return Ok(result),
Err(e) if attempt < 5 => {
attempt += 1;
thread::sleep(Duration::from_millis(10));
}
Err(e) => return Err(e),
}
}
} Or is the retry mechanism meant to be specific to pub fn remove_and_create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
let path = path.as_ref();
for attempt in 0..5 {
if fs::remove_dir_all(path).is_ok() || !path.exists() {
return fs::create_dir_all(path);
}
std::thread::sleep(std::time::Duration::from_millis(60)));
}
fs::create_dir_all(path)
} Or both are wrong interpretation? |
See also rust/src/build_helper/src/fs/mod.rs Line 37 in 00095b3
|
…to-remove_and_create_dir_all, r=jieyouxu add retries to remove and create dir all closes: rust-lang#139230 r? `@jieyouxu`
…to-remove_and_create_dir_all, r=jieyouxu add retries to remove and create dir all closes: rust-lang#139230 r? ``@jieyouxu``
Rollup merge of rust-lang#139870 - Shourya742:2025-04-15-add-retries-to-remove_and_create_dir_all, r=jieyouxu add retries to remove and create dir all closes: rust-lang#139230 r? ```@jieyouxu```
cf. #134351. The current impl of
remove_and_create_dir_all
silently ignores theremove_dir_all
failure and tries tocreate_dir_all
, which can fail ifremove_dir_all
fails and a directory already exists.compiletest
cannot paper overcreate_dir_all
failures (esp. if due to the directory already existing) to avoid running tests against outdated/invalid artifacts. So maybe a retry mechanism is needed. However, this should not be spot-fixed, and instead the retry mechanism should be shared between bootstrap/compiletest, preferrably inbuild_helpers
with its own tests.The text was updated successfully, but these errors were encountered: