Skip to content

Commit

Permalink
Fix a race condition in remote cache
Browse files Browse the repository at this point in the history
Previously, outerF.setExeception was set before closing the output stream of the download file when download fails. This was causing a permission error when trying to delete the file on Windows.

Fixes bazelbuild#6890

RELNOTES: None
PiperOrigin-RevId: 228138102
  • Loading branch information
meteorcloudy authored and Copybara-Service committed Jan 7, 2019
1 parent 9511099 commit a3a5975
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,13 @@ public void onSuccess(Void result) {

@Override
public void onFailure(Throwable t) {
outerF.setException(t);
try {
out.close();
} catch (IOException e) {
// Intentionally left empty. The download already failed, so we can ignore
// the error on close().
} finally {
outerF.setException(t);
}
}
},
Expand Down

0 comments on commit a3a5975

Please sign in to comment.