Skip to content

Commit

Permalink
fix(effects): prevent deadlock in flushing stderr
Browse files Browse the repository at this point in the history
If tracing is installed, the `warn!` call will attempt to write to `ErrorStream`, which seems to cause a deadlock when we are destroying the `ErrorStream`.
  • Loading branch information
arxanas committed Oct 17, 2023
1 parent c4d5536 commit 90f2178
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions git-branchless-lib/src/core/effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,6 @@ trait WriteProgress {
fn drop(&mut self) {
let buffer = self.get_buffer();
if !buffer.is_empty() {
// In practice, we're expecting that every sequence of `write` calls
// will shortly end with a `write` call that ends with a newline, in
// such a way that only full lines are written to the output stream.
// This assumption might be wrong, in which case we should revisit
// this warning and the behavior on `Drop`.
warn!(?buffer, "WriteProgress dropped while buffer was not empty");

// NB: this only flushes completely-written lines, which is not
// correct. We should flush the entire buffer contents, and possibly
// force a newline at the end in the case of a progress meter being
Expand Down

0 comments on commit 90f2178

Please sign in to comment.