Release fds and the multicast handle on Buffer construction error paths - #33
Open
yurekami wants to merge 1 commit into
Open
Release fds and the multicast handle on Buffer construction error paths#33yurekami wants to merge 1 commit into
yurekami wants to merge 1 commit into
Conversation
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.
Fixes #17.
Guards the acquire-without-
finallywindows reported there, on all four sites, using only bindings the file already imports:_exchange_ipc_fds: if the recv loop raises (timeout, or the explicit no-fdRuntimeError), fds already duplicated into this process bySCM_RIGHTSare now closed before the exception propagates.sock.close()in the existingfinallynever covered them; they are plain ints with no Python owner._map_nvl_dist_tensor:os.close(local_fd)moved into afinallyaround the exchange, so the exported fd cannot leak when the exchange raises._create_nvl_multicast_view: the window betweennvl_multicast_createand a completed import is now wrapped; on error the root closes its exported fd (finally) and releases the multicast handle via the existingnvl_release_mem_handlebinding (a multicast object handle is aCUmemGenericAllocationHandle, socuMemReleaseapplies). Success-path behavior and timing are unchanged.create_nvl_single_owner_tensor: samefinallytreatment for the owner's exported fd.A leaked exported fd also pins the underlying
cuMemCreateallocation (release only completes when all shareable references are gone), so on the production path this held thehidden_bufchunk, not just an fd table entry — details in #17.Verification: behavior verified by reading against
master@ 2bd860b pluspy_compile; I don't have a multi-GPU NVLink box available, so the error paths were not executed here. Happy to adjust if you'd rather scope the multicast guard differently.