Skip to content

Commit

Permalink
Use local_termination_grace_seconds when testing LinuxSandbox availab…
Browse files Browse the repository at this point in the history
…ility (#18568)

A 1s timeout was introduced in checking whether LinuxSandbox is available, to prevent a complete hangup on broken systems. However, it turned out that it occasionally results in misjudging that linux-sandbox being not available.
`local_termination_grace_seconds` defaults to 15s, which hopefully gives more headroom and configurability in various setups.

Fixes #18071

Closes #18151.

PiperOrigin-RevId: 536953768
Change-Id: I5d344ee5bf06cb9b13a2cba9d077f0981f4430a3

Co-authored-by: Takeo Sawada <myc.monad@gmail.com>
  • Loading branch information
iancha1992 and tsawada authored Jun 6, 2023
1 parent 111a53a commit c455929
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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;
Expand Down Expand Up @@ -94,10 +95,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<String> linuxSandboxArgv =
LinuxSandboxCommandLineBuilder.commandLineBuilder(
linuxSandbox, ImmutableList.of("/bin/true"))
.setTimeout(Duration.ofSeconds(1))
.setTimeout(options.getLocalSigkillGraceSeconds())
.build();
ImmutableMap<String, String> env = ImmutableMap.of();
Path execRoot = cmdEnv.getExecRoot();
Expand Down

0 comments on commit c455929

Please sign in to comment.