diff --git a/runsc/container/container.go b/runsc/container/container.go index 86c07b9300..efc8f1a86d 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -24,6 +24,7 @@ import ( "os/exec" "path" "regexp" + "slices" "strconv" "strings" "syscall" @@ -1309,6 +1310,10 @@ func (c *Container) createGoferProcess(conf *config.Config, mountHints *boot.Pod // Start with the general config flags. cmd := exec.Command(specutils.ExePath, conf.ToFlags()...) + // Don't forward GOMAXPROCS defaults that apply to this process (in + // particular, containerd-shim-runsc-v1 passes GOMAXPROCS=2 in + // v1.service.newCommand()). + cmd.Env = slices.DeleteFunc(os.Environ(), func(env string) bool { return strings.HasPrefix(env, "GOMAXPROCS=") }) cmd.SysProcAttr = &unix.SysProcAttr{ // Detach from session. Otherwise, signals sent to the foreground process // will also be forwarded by this process, resulting in duplicate signals.