From 091d953c3411b14366756b1d6ef8444af20cfdf2 Mon Sep 17 00:00:00 2001 From: AlexALei Date: Tue, 23 Jun 2026 11:33:22 +0800 Subject: [PATCH] fix(benchmark): close CPU profile file handle after profiling (#10048) Co-authored-by: Contributor --- weed/command/benchmark.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/weed/command/benchmark.go b/weed/command/benchmark.go index de631585c..86d9b358d 100644 --- a/weed/command/benchmark.go +++ b/weed/command/benchmark.go @@ -131,7 +131,10 @@ func runBenchmark(cmd *Command, args []string) bool { glog.Fatal(err) } pprof.StartCPUProfile(f) - defer pprof.StopCPUProfile() + defer func() { + pprof.StopCPUProfile() + f.Close() + }() } // Determine what operations to perform