Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cmd/containerd-stargz-grpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"os/exec"
"os/signal"
"path/filepath"
"runtime/debug"
"time"

snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1"
Expand Down Expand Up @@ -87,6 +88,9 @@ type snapshotterConfig struct {

// FuseManagerConfig is configuration for fusemanager
FuseManagerConfig `toml:"fuse_manager" json:"fuse_manager"`

// MaxThreads sets Go runtime thread limit. 0 keeps the default limit.
MaxThreads int `toml:"max_threads" json:"max_threads"`
}

type FuseManagerConfig struct {
Expand Down Expand Up @@ -131,6 +135,11 @@ func main() {
log.G(ctx).WithError(err).Fatalf("failed to unmarshal config file %q", *configPath)
}

if config.MaxThreads > 0 {
previous := debug.SetMaxThreads(config.MaxThreads)
log.G(ctx).Infof("set Go max threads to %d (previous %d)", config.MaxThreads, previous)
}

if err := service.Supported(*rootDir); err != nil {
log.G(ctx).WithError(err).Fatalf("snapshotter is not supported")
}
Expand Down
Loading