From ad181455c9bceba02cd7764d89f2f5970dee9b55 Mon Sep 17 00:00:00 2001 From: arostovtsev Date: Thu, 29 Oct 2020 09:40:34 -0700 Subject: [PATCH] Do not check the return value of Future.cancel() Future.cancel() is expected to return false if the future is done or had been cancelled previously, and there doesn't seem to be a way to check whether or not that is the case without a race condition. RELNOTES: None. PiperOrigin-RevId: 339686101 --- .../devtools/build/lib/dynamic/DynamicSpawnStrategy.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/dynamic/DynamicSpawnStrategy.java b/src/main/java/com/google/devtools/build/lib/dynamic/DynamicSpawnStrategy.java index 596cd3df654579..41437273c5a355 100644 --- a/src/main/java/com/google/devtools/build/lib/dynamic/DynamicSpawnStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/dynamic/DynamicSpawnStrategy.java @@ -138,8 +138,7 @@ private static void stopBranch( // reference to its own identifier wins and is allowed to issue the cancellation; the other // branch just has to give up execution. if (strategyThatCancelled.compareAndSet(null, cancellingStrategy)) { - boolean cancelled = branch.cancel(true); - checkState(cancelled, "Failed to cancel other branch from %s", cancellingStrategy); + branch.cancel(true); branchDone.acquire(); } else { throw new DynamicInterruptedException(