Skip to content

fix(cleanup): replace signal goroutine with signal.NotifyContext#649

Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/cleanup-signal-goroutine
Feb 13, 2026
Merged

fix(cleanup): replace signal goroutine with signal.NotifyContext#649
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:fix/cleanup-signal-goroutine

Conversation

@ArangoGutierrez
Copy link
Collaborator

Summary

  • Replace manual signal goroutine with signal.NotifyContext to prevent goroutine leak after run() returns
  • The signal handler goroutine (go func() { <-sigChan ... }) never exited when cleanup completed normally

Audit Finding

  • Ghaction #28 (LOW): Signal goroutine leak in cmd/cli/cleanup/cleanup.go

Changes

  • cmd/cli/cleanup/cleanup.go: Replace context.WithCancel + signal.Notify + goroutine pattern with signal.NotifyContext

Test plan

  • gofmt — no formatting issues
  • go build -o bin/holodeck cmd/cli/main.go — compiles
  • go test ./pkg/... — all tests pass

The signal handler goroutine never exited after run() returned.
signal.NotifyContext handles cleanup automatically and avoids the
goroutine leak.

Audit finding NVIDIA#28 (LOW).

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Copilot AI review requested due to automatic review settings February 12, 2026 19:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the holodeck cleanup CLI command to use signal.NotifyContext instead of a manual signal.Notify + goroutine pattern, eliminating a signal-handler goroutine that could outlive run() and leak.

Changes:

  • Replace context.WithCancel + signal.Notify + goroutine with signal.NotifyContext.
  • Ensure signal handling is properly stopped via the returned stop() function (defer stop()).

@coveralls
Copy link

Pull Request Test Coverage Report for Build 21961989439

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 47.501%

Totals Coverage Status
Change from base Build 21955389842: 0.0%
Covered Lines: 2500
Relevant Lines: 5263

💛 - Coveralls

@ArangoGutierrez ArangoGutierrez merged commit 8230a25 into NVIDIA:main Feb 13, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants