diff options
author | 2017-08-11 16:19:00 +0200 | |
---|---|---|
committer | 2017-08-14 14:05:06 +0200 | |
commit | 2efea9dd309bd12e426b616afd1f7da0c8c390e9 (patch) | |
tree | 53637ea86537089dd57da41bdc1754423db38fed /src/main/java/com/google/devtools/build/lib/remote | |
parent | 2a92c9015b764faa655ff6f27a2ed97089818eaf (diff) |
remote: Provide a clear error message if the remote cache is in an invalid state.
A remote cache must never serve a failed action. However, if it did
Bazel would not detect this and simply fail and display an error message
that's hard to distinquish from a local execution failure.
Bazel now displays a clear error message stating what went wrong.
RELNOTES: None.
PiperOrigin-RevId: 164975631
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/remote')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java index f09d496a31..9fe489a7c4 100644 --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java @@ -118,6 +118,11 @@ class RemoteSpawnRunner implements SpawnRunner { ? remoteCache.getCachedActionResult(actionKey) : null; if (cachedResult != null) { + if (cachedResult.getExitCode() != 0) { + // The remote cache must never serve a failed action. + throw new EnvironmentalExecException("The remote cache is in an invalid state as it" + + " served a failed action. Hash of the action: " + actionKey.getDigest()); + } try { return downloadRemoteResults(cachedResult, policy.getFileOutErr()); } catch (CacheNotFoundException e) { |