Skip to content

fix(dcgm): harden Init/Shutdown refcount misuse#121

Merged
rvatkar merged 1 commit into
mainfrom
rvatkar/fix/DCGM-6899-init-shutdown-refcount
May 20, 2026
Merged

fix(dcgm): harden Init/Shutdown refcount misuse#121
rvatkar merged 1 commit into
mainfrom
rvatkar/fix/DCGM-6899-init-shutdown-refcount

Conversation

@rvatkar

@rvatkar rvatkar commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix dcgm.Init so negative init-counter state returns nil, err without mutating the counter or returning cleanup.
  • Fix dcgm.Shutdown so calls before init return an error without decrementing the counter.
  • Add regression coverage for invalid shutdowns, negative init counter state, cleanup after manual shutdown, and concurrent invalid shutdown calls.

Testing

  • go test ./pkg/dcgm -run 'Test(InitWithNegativeCounterReturnsErrorWithoutCleanup|ShutdownBeforeInitDoesNotCorruptCounter|CleanupAfterManualShutdownDoesNotCorruptCounter|
    ConcurrentShutdownBeforeInitDoesNotCorruptCounter)' -count=1 -v
  • go test ./pkg/dcgm -count=1 -v
  • go test ./tests -run TestDeviceCount -count=1 -v
  • go test -race ./tests -run TestDeviceCount -count=1 -v
  • go test -race ./pkg/dcgm -count=1 -v

@rvatkar rvatkar requested a review from nccurry May 18, 2026 17:48
@rvatkar rvatkar merged commit 5f3dbc0 into main May 20, 2026
1 check 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.

2 participants