From 83ca7d1d7533e610e1dec7ecdcf35a0927087041 Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Tue, 10 May 2022 04:50:26 -0700 Subject: [PATCH] Use a timeout of 1s when testing the sandbox on Linux. This is to avoid hanging there forever in case the system is set up incorrectly. 1s should be plenty to run `/bin/true`. Fixes #15373. Closes #15414. PiperOrigin-RevId: 447701951 --- .../devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java index b9fdbf3c69f69a..69a22bcc626629 100644 --- a/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java +++ b/src/main/java/com/google/devtools/build/lib/sandbox/LinuxSandboxedSpawnRunner.java @@ -88,7 +88,9 @@ public static boolean isSupported(final CommandEnvironment cmdEnv) throws Interr private static boolean computeIsSupported(CommandEnvironment cmdEnv, Path linuxSandbox) throws InterruptedException { ImmutableList linuxSandboxArgv = - LinuxSandboxUtil.commandLineBuilder(linuxSandbox, ImmutableList.of("/bin/true")).build(); + LinuxSandboxUtil.commandLineBuilder(linuxSandbox, ImmutableList.of("/bin/true")) + .setTimeout(Duration.ofSeconds(1)) + .build(); ImmutableMap env = ImmutableMap.of(); Path execRoot = cmdEnv.getExecRoot(); File cwd = execRoot.getPathFile();