aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ola Rozenfeld <olaola@google.com>2016-12-12 21:19:31 +0000
committerGravatar John Cater <jcater@google.com>2016-12-13 16:30:25 +0000
commit4fb3a43192f4b7bc2e61f51dc4d39a0bb68daabd (patch)
treed751b06150b600abc717ec33f1f7eceebd105f85
parent5a84ac8c643f1180d5a41118a2fa4514cc345726 (diff)
Printing the stack trace of remote failures on --verbose_failures.
Helps debugging. -- PiperOrigin-RevId: 141802189 MOS_MIGRATED_REVID=141802189
-rw-r--r--src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java
index a4dcf80829..69508fa6d1 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnStrategy.java
@@ -16,6 +16,7 @@ package com.google.devtools.build.lib.remote;
import static java.nio.charset.StandardCharsets.UTF_8;
+import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
@@ -64,6 +65,7 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
private final StandaloneSpawnStrategy standaloneStrategy;
private final RemoteActionCache remoteActionCache;
private final RemoteWorkExecutor remoteWorkExecutor;
+ private final boolean verboseFailures;
RemoteSpawnStrategy(
Map<String, String> clientEnv,
@@ -75,6 +77,7 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
String productName) {
this.execRoot = execRoot;
this.standaloneStrategy = new StandaloneSpawnStrategy(execRoot, verboseFailures, productName);
+ this.verboseFailures = verboseFailures;
this.remoteActionCache = actionCache;
this.remoteWorkExecutor = workExecutor;
}
@@ -247,7 +250,11 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
Thread.currentThread().interrupt();
throw e;
} catch (StatusRuntimeException e) {
- eventHandler.handle(Event.warn(mnemonic + " remote work failed (" + e + ")"));
+ String stackTrace = "";
+ if (verboseFailures) {
+ stackTrace = "\n" + Throwables.getStackTraceAsString(e);
+ }
+ eventHandler.handle(Event.warn(mnemonic + " remote work failed (" + e + ")" + stackTrace));
execLocally(spawn, actionExecutionContext, actionKey);
} catch (CacheNotFoundException e) {
eventHandler.handle(Event.warn(mnemonic + " remote work results cache miss (" + e + ")"));