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 #6890

RELNOTES: None
PiperOrigin-RevId: 228138102
  • Loading branch information
meteorcloudy authored and aehlig committed Jan 7, 2019
1 parent deb028e commit f1df03e
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 f1df03e

Please sign in to comment.