gpu-tracker: remove redundant signal handler, simplify locking#110
Merged
sgopinath1 merged 1 commit intoROCm:mainfrom Apr 7, 2026
Merged
gpu-tracker: remove redundant signal handler, simplify locking#110sgopinath1 merged 1 commit intoROCm:mainfrom
sgopinath1 merged 1 commit intoROCm:mainfrom
Conversation
- Remove setupSignalHandler. flock advisory locks are kernel-managed and automatically released when the process exits, making the signal handler redundant. It also leaked a goroutine and channel on every method call. Signal handling is an application-level concern; a library should not call os.Exit or register global signal handlers, as it takes control away from the caller. - Replace manual time.Tick poll loop in acquireLock with flock.TryLockContext, fixing a ticker leak and removing reimplemented retry logic. - Remove defer recover from all 9 public methods. Panics indicate bugs that should crash loudly with a stack trace, not be silently converted to errors. A library should not swallow panics; whether to recover is an application-level policy that belongs in the caller, not the library. - Simplify deferred unlock from a 4-line nil-check closure to defer lock.Unlock, since lock is guaranteed non-nil after a successful acquireLock. - Remove redundant error wrapping on lock failures. The signal handler, panic recovery, and verbose lock boilerplate added around 180 lines of complexity with no correctness benefit. None of these belong in a library as they override decisions that should be made by the application.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The signal handler, panic recovery, and verbose lock boilerplate added around 180 lines of complexity with no correctness benefit. None of these belong in a library as they override decisions that should be made by the application.