From 5cac33f3f5d8591a971ce3b6400832279c798a17 Mon Sep 17 00:00:00 2001 From: Takeo Sawada Date: Thu, 20 Apr 2023 10:23:52 +0900 Subject: [PATCH] use local_termination_grace_seconds for LinuxSandbox timeout --- .../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 733fccd3f8fdd3..5987b98af8da91 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 @@ -37,6 +37,7 @@ import com.google.devtools.build.lib.events.Reporter; import com.google.devtools.build.lib.exec.TreeDeleter; import com.google.devtools.build.lib.exec.local.LocalEnvProvider; +import com.google.devtools.build.lib.exec.local.LocalExecutionOptions; import com.google.devtools.build.lib.exec.local.PosixLocalEnvProvider; import com.google.devtools.build.lib.profiler.Profiler; import com.google.devtools.build.lib.profiler.SilentCloseable; @@ -103,10 +104,11 @@ public static boolean isSupported(final CommandEnvironment cmdEnv) throws Interr private static boolean computeIsSupported(CommandEnvironment cmdEnv, Path linuxSandbox) throws InterruptedException { + LocalExecutionOptions options = cmdEnv.getOptions().getOptions(LocalExecutionOptions.class); ImmutableList linuxSandboxArgv = LinuxSandboxCommandLineBuilder.commandLineBuilder( linuxSandbox, ImmutableList.of("/bin/true")) - .setTimeout(Duration.ofSeconds(1)) + .setTimeout(options.getLocalSigkillGraceSeconds()) .build(); ImmutableMap env = ImmutableMap.of(); Path execRoot = cmdEnv.getExecRoot();