diff --git a/crates/pixi_reporters/src/download_verify_reporter.rs b/crates/pixi_reporters/src/download_verify_reporter.rs index d783230c16..a484e26f9a 100644 --- a/crates/pixi_reporters/src/download_verify_reporter.rs +++ b/crates/pixi_reporters/src/download_verify_reporter.rs @@ -119,8 +119,13 @@ impl BuildDownloadVerifyReporter { // Clear all items that have finished processing. entries.retain(|_, item| !item.is_finished()); + // Drop the write lock to the entries. The progress bar also requires access to + // entries so holding on to the write lock might deadlock! + let is_empty = entries.is_empty(); + drop(entries); + // Clear or update the progress bar. - if entries.is_empty() { + if is_empty { // We cannot clear the progress bar and restart it later, so replacing it with a // new hidden one is currently the only option. self.title = Some(self.pb.prefix()); @@ -130,7 +135,6 @@ impl BuildDownloadVerifyReporter { self.pb.finish_and_clear(); self.pb = new_pb; } else { - drop(entries); self.update() } } diff --git a/crates/pixi_reporters/src/main_progress_bar.rs b/crates/pixi_reporters/src/main_progress_bar.rs index 108aad7612..2cab78e920 100644 --- a/crates/pixi_reporters/src/main_progress_bar.rs +++ b/crates/pixi_reporters/src/main_progress_bar.rs @@ -113,8 +113,13 @@ impl State { // Clear all items that have finished processing. trackers.retain(|_, item| item.finished.is_none()); + // Drop the write lock to the trackers. The progress bar also requires access to + // entries so holding on to the write lock might deadlock! + let is_empty = trackers.is_empty(); + drop(trackers); + // Clear or update the progress bar. - if trackers.is_empty() { + if is_empty { // We cannot clear the progress bar and restart it later, so replacing it with a // new hidden one is currently the only option. self.title = Some(self.pb.prefix()); @@ -124,7 +129,6 @@ impl State { self.pb.finish_and_clear(); self.pb = new_pb; } else { - drop(trackers); self.update() } }