Uh oh!
There was an error while loading. Please reload this page.
Fix premature pytest debug session exit when multiprocessing child process terminates - #1023
Conversation
…inates Agent-Logs-Url: https://github.com/microsoft/vscode-python-debugger/sessions/c5ea3960-ac08-42e5-8c37-fa964ce38c9e Co-authored-by: rchiodo <19672699+rchiodo@users.noreply.github.com>
Rich Chiodo (rchiodo)
commented
May 6, 2026
Copilot, there's a weird error when running the CI tests on windows: Run pipx run nox --session install_bundled_libs Some possibly relevant errors from pip install: I think our nox bundled libs needs to be fixed/updated? |
…with Python 3.9 Agent-Logs-Url: https://github.com/microsoft/vscode-python-debugger/sessions/1508847e-2823-410e-9d66-90889d8fddea Co-authored-by: rchiodo <19672699+rchiodo@users.noreply.github.com>
Fixed in 77d393e. Root cause: The fix bumps the minimum Python from 3.9 → 3.10 in all three CI files ( |
Sebastian Moore (SebMoore)
left a comment
There was a problem hiding this comment.
Wrong issue number in the comments
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Sebastian Moore <74476668+SebMoore@users.noreply.github.com>
Co-authored-by: Sebastian Moore <74476668+SebMoore@users.noreply.github.com>
Co-authored-by: Sebastian Moore <74476668+SebMoore@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
When debugging a pytest test that uses
multiprocessing.Process, the debug session exits prematurely as soon asprocess.join()returns — the test body never completes.Root Cause
debugpy's
notify_of_subprocesscopies the parent session's full config to the child process session, includingpurpose: ['debug-test']. The Python extension's test adapter treats anydebug-testsession termination as the end of the test run. When the child process exits and its debug session ends, the adapter disconnects the parent (pytest) session.Changes
ChildProcessAttachService.attach()— shallow-copydatabefore forwarding todebug.startDebugging()and deletepurposefrom the copy, so the child process session is never tagged as a test session:childProcessAttachService.unit.test.ts— adds two regression tests: one verifyingpurposeis stripped from the child session config, one verifying the originaldataobject is not mutated.src/test/pythonFiles/debugging/test_multiproc.py— pytest test file reproducing the multiprocessing join issue, for use as a manual/future integration regression test.src/test/pythonFiles/debugging/wait_for_file.pyandsrc/test/.vscode/launch.json— missing infrastructure required by the existing adapter integration test suite.