Repository navigation
nvml: return ERROR_UNINITIALIZED from Shutdown when nothing was loaded - #206
Merged
Merged
Conversation
lenamonj
force-pushed
the
shutdown-uninitialized
branch
from
September 13, 2026 17:57
9e52146 to
f6feef9
Compare
Contributor
|
/ok-to-test f6feef9 |
lenamonj
force-pushed
the
shutdown-uninitialized
branch
from
September 17, 2026 02:55
f6feef9 to
2abe1fe
Compare
Contributor
Author
|
The commit is now signed and rebased onto current main. The explanatory comments in init.go and the test are dropped; nothing else changed. |
lenamonj
force-pushed
the
shutdown-uninitialized
branch
2 times, most recently
from
September 19, 2026 00:42
42ff3d6 to
31ea91f
Compare
tariq1890
reviewed
Sep 21, 2026
Contributor
|
@lenamonj Please squash the commit history |
Shutdown() called nvmlShutdown() unconditionally. The bindings link with -Wl,--unresolved-symbols=ignore-in-object-files, so that symbol resolves only after Init() has opened libnvidia-ml.so.1; on a host without that library, the Shutdown() a caller pairs with a failed Init() took the process down with a symbol lookup error instead of returning. Shutdown() now returns ERROR_UNINITIALIZED, the return nvml.h documents for a shutdown without a prior initialization, when the library holds no reference. The check, the nvmlShutdown() call and the release of the reference run under the library's lock, so a second Shutdown() cannot reach nvmlShutdown() after the first has closed the library. close() keeps its lock and delegates to closeLocked(), which Shutdown() calls with the lock already held. Signed-off-by: Jeff Lenamon <[email protected]>
lenamonj
force-pushed
the
shutdown-uninitialized
branch
from
October 6, 2026 01:21
4f76c27 to
b8d53c7
Compare
Contributor
Author
|
Squashed to one commit, b8d53c7; same base and tree as before. |
tariq1890
approved these changes
Oct 6, 2026
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.
Shutdown()callednvmlShutdown()unconditionally. On Linux the bindings link with-Wl,--unresolved-symbols=ignore-in-object-files, so that symbol resolves only afterInit()openslibnvidia-ml.so.1; aShutdown()whenInit()was never called, or could not open the library, took the process down withsymbol lookup error: undefined symbol: nvmlShutdown.Shutdown()now returnsERROR_UNINITIALIZED, the returnnvml.hdocuments for a shutdown without a prior initialization, when the library holds no reference. That check,nvmlShutdown()and the release run under the library's lock, so a secondShutdown()cannot reachnvmlShutdown()after the first has closed the library. Two tests cover the never-loaded and failed-Init()paths; each aborts the test binary on main.make buildandmake testpass;gofmtandgo vetare clean.