Skip to content

Commit ca39f76

Browse files
Merge pull request containerd#1798 from stevvooe/shim-gomaxprocs
cmd/containerd-shim: set GOMAXPROCS to 2
2 parents 372cdfa + 5764bf1 commit ca39f76

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/containerd-shim/main_unix.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ func main() {
6060
if debugFlag {
6161
logrus.SetLevel(logrus.DebugLevel)
6262
}
63+
64+
if os.Getenv("GOMAXPROCS") == "" {
65+
// If GOMAXPROCS hasn't been set, we default to a value of 2 to reduce
66+
// the number of Go stacks present in the shim.
67+
runtime.GOMAXPROCS(2)
68+
}
69+
6370
if err := executeShim(); err != nil {
6471
fmt.Fprintf(os.Stderr, "containerd-shim: %s\n", err)
6572
os.Exit(1)

0 commit comments

Comments
 (0)