Skip to content

Commit

Permalink
Verify gRPC cache downloads after flushing the output.
Browse files Browse the repository at this point in the history
Make sure any internal buffers (especially compression) are flushed before attempting verify the digest of the downloaded file.

Closes bazelbuild#16072.

PiperOrigin-RevId: 468432319
Change-Id: I9d991d563c232113fe29921580f4964c603faf58
  • Loading branch information
benjaminp authored and Copybara-Service committed Aug 18, 2022
1 parent 42ff95a commit a0f4562
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -418,19 +418,21 @@ public void onError(Throwable t) {
@Override
public void onCompleted() {
try {
try {
out.flush();
} finally {
releaseOut();
}
if (digestSupplier != null) {
Utils.verifyBlobContents(digest, digestSupplier.get());
}
out.flush();
future.set(rawOut.getCount());
} catch (IOException e) {
future.setException(e);
} catch (RuntimeException e) {
logger.atWarning().withCause(e).log("Unexpected exception");
future.setException(e);
} finally {
releaseOut();
}
future.set(rawOut.getCount());
}

private void releaseOut() {
Expand Down

0 comments on commit a0f4562

Please sign in to comment.