From e307effaf30ecdf48d7bccf5eb2e60f6a13647b2 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Mon, 31 Jul 2023 14:33:10 +0800 Subject: [PATCH 1/3] cmd/geth: disable automaxprocs log Signed-off-by: jsvisa --- cmd/geth/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 0dcb38358f687..93e3a38c988f3 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -39,14 +39,12 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/node" + "go.uber.org/automaxprocs/maxprocs" // Force-load the tracer engines to trigger registration _ "github.com/ethereum/go-ethereum/eth/tracers/js" _ "github.com/ethereum/go-ethereum/eth/tracers/native" - // Automatically set GOMAXPROCS to match Linux container CPU quota. - _ "go.uber.org/automaxprocs" - "github.com/urfave/cli/v2" ) @@ -326,6 +324,9 @@ func geth(ctx *cli.Context) error { return fmt.Errorf("invalid command: %q", args[0]) } + // Automatically set GOMAXPROCS to match Linux container CPU quota. + maxprocs.Set(maxprocs.Logger(func(string, ...interface{}) {})) + prepare(ctx) stack, backend := makeFullNode(ctx) defer stack.Close() From 5314121420524dc3526b45173050bb7caf57ade8 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Mon, 31 Jul 2023 13:13:12 +0000 Subject: [PATCH 2/3] cmd/geth: no logger required --- cmd/geth/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 93e3a38c988f3..df810d5196d1f 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -325,7 +325,7 @@ func geth(ctx *cli.Context) error { } // Automatically set GOMAXPROCS to match Linux container CPU quota. - maxprocs.Set(maxprocs.Logger(func(string, ...interface{}) {})) + maxprocs.Set() prepare(ctx) stack, backend := makeFullNode(ctx) From a9a82e0b6ac3e8c24a98ddc821afd8dbefea6212 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 1 Aug 2023 14:37:49 +0200 Subject: [PATCH 3/3] Update main.go --- cmd/geth/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index df810d5196d1f..568aec4b8b7a8 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -243,6 +243,7 @@ func init() { ) app.Before = func(ctx *cli.Context) error { + maxprocs.Set() // Automatically set GOMAXPROCS to match Linux container CPU quota. flags.MigrateGlobalFlags(ctx) return debug.Setup(ctx) } @@ -324,9 +325,6 @@ func geth(ctx *cli.Context) error { return fmt.Errorf("invalid command: %q", args[0]) } - // Automatically set GOMAXPROCS to match Linux container CPU quota. - maxprocs.Set() - prepare(ctx) stack, backend := makeFullNode(ctx) defer stack.Close()