Bring back the very useful stacktrace printouts on --verbose_failures
TESTED=remote worker
RELNOTES: fixes
// limitations under the License.
package com.google.devtools.build.lib.remote;
+import com.google.common.base.Throwables;
import com.google.common.eventbus.EventBus;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
import com.google.devtools.build.lib.actions.ActionInput;
@@ -25,6 +26,7 @@ import com.google.devtools.build.lib.actions.ExecutionStrategy;
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnActionContext;
import com.google.devtools.build.lib.actions.Spawns;
+import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.exec.SpawnExecException;
import com.google.devtools.build.lib.exec.SpawnInputExpander;
import com.google.devtools.build.lib.exec.SpawnResult;
@@ -143,6 +145,15 @@ final class RemoteSpawnStrategy implements SpawnActionContext {
try {
result = spawnRunner.exec(spawn, policy);
} catch (IOException e) {
+ if (verboseFailures) {
+ actionExecutionContext
+ .getEventHandler()
+ .handle(
+ Event.warn(
+ spawn.getMnemonic()
+ + " remote work failed:\n"
+ + Throwables.getStackTraceAsString(e)));
+ }
throw new EnvironmentalExecException("Unexpected IO error.", e);
}
