diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/ior.go | 5 | ||||
| -rw-r--r-- | internal/ior_parquet_sink.go | 5 |
2 files changed, 10 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) diff --git a/internal/ior_parquet_sink.go b/internal/ior_parquet_sink.go index eb187e8..83ca769 100644 --- a/internal/ior_parquet_sink.go +++ b/internal/ior_parquet_sink.go @@ -119,6 +119,11 @@ func runHeadlessParquet(cfg flags.Config) error { 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) el, err := newEventLoop(newEventLoopConfig(cfg)) if err != nil { |
