From 38c66c9830235b4493ce1cbc06883cf67475db6b Mon Sep 17 00:00:00 2001 From: minh-bq <97180373+minh-bq@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:26:50 +0700 Subject: [PATCH] internal/debug: remove memsize (#30253) (#549) commit https://github.com/ethereum/go-ethereum/commit/e4675771eda550e7eeb63a8884816982c1980644. Removing because memsize will very likely be broken by Go 1.23. See https://github.com/fjl/memsize/issues/4 Co-authored-by: Felix Lange --- cmd/ronin/main.go | 2 -- go.mod | 1 - go.sum | 2 -- internal/debug/flags.go | 4 ---- mobile/geth.go | 5 ++--- 5 files changed, 2 insertions(+), 12 deletions(-) diff --git a/cmd/ronin/main.go b/cmd/ronin/main.go index 6f6fa025ac..90fc55d96c 100644 --- a/cmd/ronin/main.go +++ b/cmd/ronin/main.go @@ -426,8 +426,6 @@ func setupPyroScopeProfiler(ctx *cli.Context) (*pyroscope.Profiler, error) { // it unlocks any requested accounts, and starts the RPC/IPC interfaces and the // miner. func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend) { - debug.Memsize.Add("node", stack) - // Start up the node itself utils.StartNode(ctx, stack) diff --git a/go.mod b/go.mod index 7922be668d..9799c812ae 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,6 @@ require ( github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 github.com/edsrzf/mmap-go v1.1.0 github.com/fatih/color v1.9.0 - github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 github.com/go-stack/stack v1.8.1 github.com/golang/protobuf v1.5.4 diff --git a/go.sum b/go.sum index 43aea7ec81..498c5206a2 100644 --- a/go.sum +++ b/go.sum @@ -238,8 +238,6 @@ github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= diff --git a/internal/debug/flags.go b/internal/debug/flags.go index 21fcefe06f..a80433d5b8 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -27,15 +27,12 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/metrics/exp" - "github.com/fjl/memsize/memsizeui" "github.com/mattn/go-colorable" "github.com/mattn/go-isatty" "github.com/urfave/cli/v2" ) -var Memsize memsizeui.Handler - var ( verbosityFlag = cli.IntFlag{ Name: "verbosity", @@ -191,7 +188,6 @@ func StartPProf(address string, withMetrics bool) { if withMetrics { exp.Exp(metrics.DefaultRegistry) } - http.Handle("/memsize/", http.StripPrefix("/memsize", &Memsize)) log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address)) go func() { if err := http.ListenAndServe(address, nil); err != nil { diff --git a/mobile/geth.go b/mobile/geth.go index d0ad93e469..1d65b2b5c8 100644 --- a/mobile/geth.go +++ b/mobile/geth.go @@ -22,9 +22,10 @@ package geth import ( "encoding/json" "fmt" - "github.com/ethereum/go-ethereum/common" "path/filepath" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/eth/downloader" "github.com/ethereum/go-ethereum/eth/ethconfig" @@ -150,8 +151,6 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) { return nil, err } - debug.Memsize.Add("node", rawStack) - var genesis *core.Genesis if config.EthereumGenesis != "" { // Parse the user supplied genesis spec if not mainnet