From 375aaf8fbc896797478d35de29985a1a27c6f603 Mon Sep 17 00:00:00 2001 From: Seebs Date: Thu, 20 Jan 2022 16:49:20 -0600 Subject: [PATCH] don't hardcode local port for backup and restore pprof service If we hardcode a port, we can't run on a crowded machine, like in CI. If we use :0, we can print the value actually picked. --- ctl/backup.go | 2 +- ctl/restore.go | 2 +- ctl/util.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ctl/backup.go b/ctl/backup.go index 302041dfe..519a604fd 100644 --- a/ctl/backup.go +++ b/ctl/backup.go @@ -60,7 +60,7 @@ func NewBackupCommand(stdin io.Reader, stdout, stderr io.Writer) *BackupCommand CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), Concurrency: 1, RetryPeriod: time.Minute, - Pprof: "localhost:43809", + Pprof: "localhost:0", } } diff --git a/ctl/restore.go b/ctl/restore.go index 9c12434f8..6cbf700b0 100644 --- a/ctl/restore.go +++ b/ctl/restore.go @@ -56,7 +56,7 @@ func NewRestoreCommand(stdin io.Reader, stdout, stderr io.Writer) *RestoreComman CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), RetryPeriod: time.Second * 30, Concurrency: 1, - Pprof: "localhost:43809", + Pprof: "localhost:0", } } diff --git a/ctl/util.go b/ctl/util.go index 60ac082c9..2a5611df6 100644 --- a/ctl/util.go +++ b/ctl/util.go @@ -40,7 +40,7 @@ func startProfilingServer(addr string, logger logger.Logger) (close func() error return nil, err } go func() { - logger.Printf("Listening for /debug/pprof/ and /debug/fgprof on '%s'", addr) + logger.Printf("Listening for /debug/pprof/ and /debug/fgprof on '%s'", ln.Addr().String()) logger.Printf("%v", s.Serve(ln)) }()