Skip to content

Commit

Permalink
diskio: Correctly account the release of the final chunk
Browse files Browse the repository at this point in the history
In incremental file processing we need to correctly account for
the final chunk being released, otherwise we end up holding a chunk
for the duration of the rest of the component for every incremental
file in the tarball.  This is what caused the issue surfaced in the
previous commit, and thus this commit fixes #2774

Signed-off-by: Daniel Silverstone <[email protected]>
  • Loading branch information
kinnison authored and rbtcollins committed May 28, 2021
1 parent dc8f2f4 commit 03be992
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/diskio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,11 @@ pub(crate) fn write_file_incremental<P: AsRef<Path>, F: Fn(usize)>(
let len = contents.len();
// Length 0 vector is used for clean EOF signalling.
if len == 0 {
trace_scoped!("EOF_chunk", "name": path_display, "len": len);
drop(contents);
chunk_complete_callback(len);
break;
}
{
} else {
trace_scoped!("write_segment", "name": path_display, "len": len);
f.write_all(&contents)?;
drop(contents);
Expand Down

0 comments on commit 03be992

Please sign in to comment.