diff --git a/src/main/java/com/google/devtools/build/lib/dynamic/LocalBranch.java b/src/main/java/com/google/devtools/build/lib/dynamic/LocalBranch.java index d8bc270529660d..0a0da2beeeda75 100644 --- a/src/main/java/com/google/devtools/build/lib/dynamic/LocalBranch.java +++ b/src/main/java/com/google/devtools/build/lib/dynamic/LocalBranch.java @@ -29,7 +29,6 @@ import com.google.devtools.build.lib.actions.Spawn; import com.google.devtools.build.lib.actions.SpawnResult; import com.google.devtools.build.lib.actions.SpawnResult.Status; -import com.google.devtools.build.lib.actions.SpawnStrategy; import com.google.devtools.build.lib.dynamic.DynamicExecutionModule.IgnoreFailureCheck; import com.google.devtools.build.lib.profiler.Profiler; import com.google.devtools.build.lib.profiler.SilentCloseable; @@ -37,7 +36,7 @@ import java.time.Duration; import java.time.Instant; import java.util.Optional; -import java.util.concurrent.Future; +import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; @@ -154,6 +153,17 @@ protected void prepareFuture(RemoteBranch remoteBranch) { if (!future.isCancelled()) { remoteBranch.cancel(); } + if (options.debugSpawnScheduler) { + logger.atInfo().log( + "In listener callback, the future of the local branch is %s", + future.state().name()); + try { + future.get(); + } catch (InterruptedException | ExecutionException e) { + logger.atInfo().withCause(e).log( + "The future of the local branch failed with an exception."); + } + } }, MoreExecutors.directExecutor()); } diff --git a/src/main/java/com/google/devtools/build/lib/dynamic/RemoteBranch.java b/src/main/java/com/google/devtools/build/lib/dynamic/RemoteBranch.java index c6f7bdab079eee..9bd26ea1caf967 100644 --- a/src/main/java/com/google/devtools/build/lib/dynamic/RemoteBranch.java +++ b/src/main/java/com/google/devtools/build/lib/dynamic/RemoteBranch.java @@ -29,10 +29,10 @@ import com.google.devtools.build.lib.actions.SandboxedSpawnStrategy.StopConcurrentSpawns; import com.google.devtools.build.lib.actions.Spawn; import com.google.devtools.build.lib.actions.SpawnResult; -import com.google.devtools.build.lib.actions.SpawnStrategy; import com.google.devtools.build.lib.dynamic.DynamicExecutionModule.IgnoreFailureCheck; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.util.io.FileOutErr; +import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import javax.annotation.Nullable; @@ -122,6 +122,17 @@ public void prepareFuture(LocalBranch localBranch) { if (!future.isCancelled()) { localBranch.cancel(); } + if (options.debugSpawnScheduler) { + logger.atInfo().log( + "In listener callback, the future of the remote branch is %s", + future.state().name()); + try { + future.get(); + } catch (InterruptedException | ExecutionException e) { + logger.atInfo().withCause(e).log( + "The future of the remote branch failed with an exception."); + } + } }, MoreExecutors.directExecutor()); }