summaryrefslogtreecommitdiff
path: root/internal/ior.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ior.go')
-rw-r--r--internal/ior.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/ior.go b/internal/ior.go
index ab52299..e6e7233 100644
--- a/internal/ior.go
+++ b/internal/ior.go
@@ -400,6 +400,11 @@ func runTraceWithContext(parentCtx context.Context, cfg flags.Config, started ch
if err != nil {
return err
}
+ // Guarantee the profiling file descriptors (cpu/mem/exec-trace profiles) are
+ // closed even if a later setup step fails before the shutdown watcher is
+ // registered. profiling.stop is idempotent via sync.Once, so double-calling
+ // it from the watcher goroutine and from this defer is safe.
+ defer profiling.stop(logln)
signalTraceStarted(started)