Skip to content

test(core): stabilize spawned-process IPC descriptor counts - #3146

Merged
rwgk merged 1 commit into
NVIDIA:mainfrom
rwgk:rwgk/fix-vmm-ipc-process-fd-baseline
Oct 19, 2026
Merged

rwgk merged 1 commit into
NVIDIA:mainfrom
rwgk:rwgk/fix-vmm-ipc-process-fd-baseline

Conversation

@rwgk

@rwgk rwgk commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Description

When test_process_argument_releases_with_the_process_object is the first test to spawn a process, multiprocessing opens a persistent resource-tracker pipe after the file-descriptor baseline. The extra descriptor can produce an order-dependent false leak failure.

Run a no-op child before taking the baseline, keeping the strict descriptor-count assertion unchanged. Use the buffer context manager so an assertion failure also releases its virtual-memory reservation instead of causing subsequent cleanup failures. Follow-up to #3028.

Validation

  • A CPU-only spawn reproduction confirms that the first child adds one persistent descriptor and a second child leaves the count unchanged (4 -> 5 -> 5).
  • Full pre-commit run --all-files passes locally.
  • GPU test execution is delegated to the requested CI run.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes (test-only fix).

Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
@rwgk rwgk added this to the cuda.core 1.3.0 milestone Oct 17, 2026
@rwgk rwgk added bug Something isn't working test Improvements or additions to tests cuda.core Everything related to the cuda.core module labels Oct 17, 2026
@rwgk rwgk self-assigned this Oct 17, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rwgk

rwgk commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test da0ab5b

@github-actions

Copy link
Copy Markdown
Contributor

@rwgk
rwgk marked this pull request as ready for review October 17, 2026 18:51
@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/cuda-python/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 34655589-3570-4cc2-bf3e-dee6fe9a3fb7
📥 Commits

Reviewing files that changed from the base of the PR and between 576ef68 and da0ab5b.

📒 Files selected for processing: 1
  • cuda_core/tests/memory_ipc/test_vmm_ipc.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Updated process-lifecycle checks for file descriptor cleanup, including a more consistent baseline and automatic buffer closure. Assertions still verify that process exit releases the expected resources.

The IPC file descriptor lifetime test starts a no-op child before measuring open file descriptors. It manages the buffer with a context manager and retains the process cleanup, exit-code, and final descriptor-count checks.

Changes: IPC buffer lifetime test

Layer / File(s) Summary
Descriptor lifetime test
cuda_core/tests/memory_ipc/test_vmm_ipc.py
The test starts a no-op child before taking the descriptor baseline. A context manager closes the buffer, while the process cleanup, exit-code, and final descriptor-count checks remain.

Suggested reviewers: andy-jost

Priority: ⬇️ Low

Change: Other

Merge Risk: ⚪ Minimal · up to da0ab

The test stabilizes its descriptor baseline and checks that process-owned IPC resources are released. No material merge risk is evident.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@rwgk rwgk added the PR review get-together Mark PRs you'd like the team to review at the weekly PR review get-together. label Oct 17, 2026

@brandon-b-miller brandon-b-miller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One nit: There's a function that's used for something similar over in test_leaks.py.

https://github.com/NVIDIA/cuda-python/blob/main/cuda_core/tests/memory_ipc/test_leaks.py#L158-L169

Since we have a growing number of tests that hit this safety issue with multiprocessing it might be time to centralize the logic and put a note in the agent skill to reuse it.

@rwgk

rwgk commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

LGTM. One nit: There's a function that's used for something similar over in test_leaks.py.

https://github.com/NVIDIA/cuda-python/blob/main/cuda_core/tests/memory_ipc/test_leaks.py#L158-L169

Since we have a growing number of tests that hit this safety issue with multiprocessing it might be time to centralize the logic and put a note in the agent skill to reuse it.

Thanks @brandon-b-miller, I'll merge this PR and send a follow-on cleanup. (This change is on ctk-next already, out of necessity; therefore merging + follow-on is easier; no merge conflicts.)

@rwgk
rwgk merged commit 66387f1 into NVIDIA:main Oct 19, 2026
213 of 215 checks passed
@rwgk
rwgk deleted the rwgk/fix-vmm-ipc-process-fd-baseline branch October 19, 2026 15:27
@rwgk rwgk removed the PR review get-together Mark PRs you'd like the team to review at the weekly PR review get-together. label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cuda.core Everything related to the cuda.core module test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants