Skip to content

fix(data_plane): close a failed spill's fd before publishing the failure - #5108

Closed
ZhiyuLi-Nvidia wants to merge 1 commit into
mainfrom
zhiyul/fix/nixl-spill-fd-close-race
Closed

ZhiyuLi-Nvidia wants to merge 1 commit into
mainfrom
zhiyul/fix/nixl-spill-fd-close-race

Conversation

@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

What

In NixlStorageUnit._spill, close the partial file's fd while still holding the unit lock.

Why

_spill released the lock and then closed the fd. A thread that saw the failed put (_io_jobs back to 0, blob removed) could count open fds in between and find one extra. That made tests/unit/data_plane/nixl/test_ssd_tier.py::test_a_failed_write_fails_the_put_and_frees_the_io_area[bug] fail intermittently in CI (assert 95 == 94, L0_Unit_Tests_Other). The fd was never leaked, only closed a moment late.

Change

nemo_rl/data_plane/nixl_storage_unit.py: move the _close(fd) call inside the with self._mu: block. One line moved, no other behavior change.

Testing

Not run locally (no ray in the authoring environment); syntax-checked only. CI L0_Unit_Tests_Other covers the test.

Note: this commit was briefly pushed to main by mistake and reverted (cef159de0, e568ae411); this PR re-applies it for review.

🤖 Generated with Claude Code

_spill released the unit lock, then closed the partial file's fd. A thread
that saw the failed put (io jobs back to 0, blob gone) could count open fds
in between and find one extra, which made
test_a_failed_write_fails_the_put_and_frees_the_io_area[bug] flaky in CI
(95 == 94). Close the fd while still holding the lock.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Zhiyu Li <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor Author

Superseded by #5150 (commits 0819dc8 and 83c9320): the same fd race, fixed by closing the file outside _mu and uncounting the IO job last, in both _spill and _stage. Closing under the lock would run a block-freeing close() of an unlinked spill file inside the unit lock, which this file's design rule avoids.

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.

1 participant