Log long NestedSet expansions in case they are interrupted.
PiperOrigin-RevId: 296245062
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
index 75f2681..009d49a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
@@ -623,7 +623,19 @@
private static ImmutableList<? extends Artifact> modulesToListInterruptibly(
NestedSet<? extends Artifact> nestedSet) throws InterruptedException {
Stopwatch blockedStopwatch = Stopwatch.createStarted();
- ImmutableList<? extends Artifact> modules = nestedSet.toListInterruptibly();
+ ImmutableList<? extends Artifact> modules;
+ try {
+ modules = nestedSet.toListInterruptibly();
+ } catch (InterruptedException e) {
+ Duration blockedDuration = blockedStopwatch.elapsed();
+ if (BLOCKED_NESTED_SET_EXPANSION_THRESHOLD.compareTo(blockedDuration) < 0) {
+ logger.info(
+ String.format(
+ "Spent %d milliseconds doing nested set expansion, interrupted",
+ blockedDuration.toMillis()));
+ }
+ throw e;
+ }
Duration blockedDuration = blockedStopwatch.elapsed();
if (BLOCKED_NESTED_SET_EXPANSION_THRESHOLD.compareTo(blockedDuration) < 0) {
logger.info(