Repository navigation
Tests relying on reqwest::Client may fail with "dispatch task is gone: runtime dropped the dispatch task" #3852
Description
Activity
- changed the title
[-]`suite::cli_exact::check_updates_with_update` failed with "dispatch task is gone: runtime dropped the dispatch task"[/-][+]Tests relying on `reqwest::Client` may fail with "dispatch task is gone: runtime dropped the dispatch task"[/+]on Jun 4, 2024 According to the error message format and my IDE searching the current codebase, this is a
RustupError::DownloadingFile. This kind error message can only be emitted from here:Lines 154 to 190 in 6d43761
pub(crate) async fn download_file_with_resume( url: &Url, path: &Path, hasher: Option<&mut Sha256>, resume_from_partial: bool, notify_handler: &dyn Fn(Notification<'_>), ) -> Result<()> { use download::DownloadError as DEK; match download_file_(url, path, hasher, resume_from_partial, notify_handler).await { Ok(_) => Ok(()), Err(e) => { if e.downcast_ref::<std::io::Error>().is_some() { return Err(e); } let is_client_error = match e.downcast_ref::<DEK>() { // Specifically treat the bad partial range error as not our // fault in case it was something odd which happened. Some(DEK::HttpStatus(416)) => false, Some(DEK::HttpStatus(400..=499)) | Some(DEK::FileNotFound) => true, _ => false, }; Err(e).with_context(|| { if is_client_error { RustupError::DownloadNotExists { url: url.clone(), path: path.to_path_buf(), } } else { RustupError::DownloadingFile { url: url.clone(), path: path.to_path_buf(), } } }) } } } Hi @rami3l, I also encountered the same issue with tests, searching for the cause, I came across this thread on the rust-lang forums. We started encountering the problem over at lakekeeper (lakekeeper/lakekeeper#548) after making our clients static with lazy-locks like you are doing here, I think that is the cause for the failures you've been observing.
Reacted by rami3lHi @rami3l, I also encountered the same issue with tests, searching for the cause, I came across this thread on the rust-lang forums. We started encountering the problem over at lakekeeper (lakekeeper/lakekeeper#548) after making our clients static with lazy-locks like you are doing here, I think that is the cause for the failures you've been observing.
@twuebi Thanks a lot for the info! I think your observation is likely relevant as we currently use in-process testing for some commands even if it appears to be out-of-process (#3891).
It could indeed be possible that something like 2261e26 is required for
reqwest::Clientas well.Anyway, I'll find some time to look into this.
Verification
Problem
This is causing irregular failures for different CI platforms:
The error message here is identical (although the exact test that failed might differ):
Notes
Possibly related to hyperium/hyper#2312, Azure/azure-sdk-for-rust#1550 or fussybeaver/bollard#387 (comment).
I'm pretty sure that #3367 has caused this.