From 79441cfed779d8b4ac2e712a5ce8f694b1fc5316 Mon Sep 17 00:00:00 2001 From: hc-github-team-secure-vault-core <82990506+hc-github-team-secure-vault-core@users.noreply.github.com> Date: Thu, 12 Oct 2023 14:49:44 -0400 Subject: [PATCH] backport of commit 7872338ec15b263cf53073e973fa92dfc5b7a506 (#23639) Co-authored-by: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> --- changelog/23636.txt | 3 +++ command/server.go | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 changelog/23636.txt diff --git a/changelog/23636.txt b/changelog/23636.txt new file mode 100644 index 000000000..262556072 --- /dev/null +++ b/changelog/23636.txt @@ -0,0 +1,3 @@ +```release-note:bug +command/server: Fix bug with sigusr2 where pprof files were not closed correctly +``` diff --git a/command/server.go b/command/server.go index b3b36fe01..543706ea9 100644 --- a/command/server.go +++ b/command/server.go @@ -1790,8 +1790,10 @@ func (c *ServerCommand) Run(args []string) int { err = pprof.Lookup(dump).WriteTo(pFile, 0) if err != nil { c.logger.Error("error generating pprof data", "name", dump, "error", err) + pFile.Close() break } + pFile.Close() } c.logger.Info(fmt.Sprintf("Wrote pprof files to: %s", dir))