Handle CancellationExceptions in BES module instead of crashing.
Each BEP transport has a close future that we wrap with a Futures.withTimeout in order to handle timeouts. TiemoutFutures sometimes (1/100) throw CancellationException when the timeout is reached so we're currently crashing when that happens causing flakiness in our tests. With this change the flakiness due to this problem is removed.
Catching CancellationException seems weird to me since it's an unchecked exception but after spending quite a bit of time debugging this I couldn't quite figure out why Futures.withTimeout doesn't consistently throw a TimeoutException when timing out so I went with this solution.
PiperOrigin-RevId: 246537642
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceUploader.java b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceUploader.java
index e3c8e80..66ce615 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceUploader.java
+++ b/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceUploader.java
@@ -739,3 +739,4 @@
}
}
}
+