Skip to content

Regression: multiprocessing "fork" method debugging on macOS #1795

@puremourning

Description

@puremourning

I just upgraded Vimspector from debugpy 1.8.1 to 1.8.11 and had a regression test failure on macOS.

The test verifies the behaviour of "multiple sessions" support, by launching 2 python processes using the 'fork' method of multiprocessing.

In 1.8.1, I am able to break both processes and independently step through them. In 1.8.11, breakpoints are hit, but stepping in the child process does not work correctly (it appears that it effectively "continues" rather than stops on the next line).

Environment data

  • debugpy version: 1.8.11
  • OS and version: macOS Sonoma 14.6.1 ARM64 (also macOS in Github Actions)
  • Python version (& distribution if applicable, e.g. Anaconda):

ben@BenMBP2021 vimspector % python3 --version
Python 3.13.1

  • Using VS Code or Visual Studio: VSCode (repro above), and Vimspector

Reproduction steps

  1. Open this test file in VSCode: https://github.com/puremourning/vimspector/blob/d18da85844b6e70299fc29d729cd6d26e692c7ec/support/test/python/multiprocessing/multiprocessing_test.py
  2. Set a breakpoint on line 6 (in the Priant function
  3. Launch using the default Python File debug configuration
  4. Switch the "focus" to the 2nd process, the child process which should be paused at line 6
  5. Step over the print statement.

Actual behavior

Stepping from the subprocess does not work correctly, Pressing "step over" moves the execution forward, but to the next iteration (i.e. again to the same file/line at the breakpoint)

Expected behavior

Step over should step to Line 12 (The line after the call to Priant in the subprocess's main thread First).

Please excuse the confusing naming in this test file, I'm not sure what I was thinking, but any trivial multiprocessing test on macOS using the 'fork' or 'forkserver' methods will fail similarly I believe.

Workaround

Use the 'spawn' method. The problem with this is that you get another subprocess and it's not defined what order they will be spawned in.

Metadata

Metadata

Assignees

Labels

duplicateThis issue or pull request already existsneeds reproIssue has not been reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions