Repository navigation
Conversation
The forkserver is a fresh interpreter and children fork from it, so it
is safe after CUDA initialization, and it is the Linux default since
Python 3.14. Its Popen collects file descriptors during pickling and
sends them afterwards, like spawn, so the Process-argument path in
VirtualMemoryBuffer.__reduce__ has to work there too. Add a Process
argument test and a Queue round trip under mp.get_context("forkserver"),
skipped where that start method is unavailable.
Closes NVIDIA#3111
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Priority: ⬇️ Low Change: Other Merge Risk: ⚪ Minimal · up to
|
|
| """The conftest forces ``spawn``; a forkserver context passes descriptors the same way and must work too.""" | ||
|
|
||
| @pytest.mark.agent_authored(model="claude-sonnet-5-5") | ||
| def test_process_argument(self, vmm_ipc_device): |
There was a problem hiding this comment.
Optional: this test checks the data round trip, but not that the parent's file descriptors are released. The spawn counterpart, test_process_argument_releases_with_the_process_object, also checks that the open file descriptor count returns to its baseline once the Process object is released. The same check under forkserver would catch a stash that outlives the Process.
It would need thread_unsafe (it counts process-wide file descriptors) and _settled_open_fds() for the baseline. Start the forkserver before taking the baseline (for example with one throwaway process), because its first start leaves a permanent file descriptor open in the parent.
Summary
The VMM IPC tests from #3028 ran under
spawnonly.forkserveris safe after CUDA initialization because the forkserver is a fresh interpreter and children fork from it, not from the test process, and it is the Linux default start method since Python 3.14. ItsPopencollects file descriptors during pickling and sends them afterwards, likespawn, so theProcess-argument path inVirtualMemoryBuffer.__reduce__has to work there too. This PR adds the tests that confirm it.Changes
tests/memory_ipc/test_vmm_ipc.py: newTestForkserverclass with two tests undermp.get_context("forkserver"): aVirtualMemoryBufferpassed as aProcessargument, and the same buffer sent through aQueue. Each child reads the parent's fill pattern and writes one back. The class skips whereforkserveris unavailable (Windows).Related Work
Closes #3111. Suggested by @juenglin in the #3028 review.
🤖 Generated with Claude Code