From a4939362c38a8c5b35d77d1cde9aee61c6f36b96 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Mon, 18 Nov 2024 09:29:40 -0800 Subject: [PATCH] feat(zetaclient): enable pprof http server --- cmd/zetaclientd/start.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index 46d204fa34..39ff979452 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -5,6 +5,9 @@ import ( "encoding/json" "fmt" "io" + "net/http" + // #nosec G108 -- pprof enablement is intentional + _ "net/http/pprof" "os" "os/signal" "path/filepath" @@ -253,6 +256,15 @@ func Start(_ *cobra.Command, _ []string) error { time.Sleep(30 * time.Second) } }() + // pprof http server + // zetacored/cometbft is already listening for pprof on 6060 (by default) + go func() { + // #nosec G114 -- timeouts uneeded + err := http.ListenAndServe("localhost:6061", nil) + if err != nil { + log.Error().Err(err).Msg("pprof http server error") + } + }() // Generate a new TSS if keygen is set and add it into the tss server // If TSS has already been generated, and keygen was successful ; we use the existing TSS