Ask questionsUnable to debug using ptvsd - Mixed mode debugging

Environment data

  • PTVSD version: The version that comes with VS Code Installation.
  • OS and version: Mac OS Mojave 10.14.3
  • Python version (& distribution if applicable, e.g. Anaconda): Python 2.7.15
  • Using VS Code or Visual Studio: VS Code 1.32.3

Actual behavior

I am trying to debug Python/C++ code using these instructions ,however when I launch the Python debugger which walks through the python code having the statement manager = multiprocessing.Manager() it breaks there and here is the error trace i see :

E-0000.454: Exception escaped from start_client
            Traceback (most recent call last):
              File "/Users/sujithshivaprakash/.vscode/extensions/ms-python.python-2019.3.6139/pythonFiles/lib/python/ptvsd/", line 110, in g
                return f(*args, **kwargs)
              File "/Users/sujithshivaprakash/.vscode/extensions/ms-python.python-2019.3.6139/pythonFiles/lib/python/ptvsd/", line 74, in start_client
                sock, start_session = daemon.start_client((host, port))
              File "/Users/sujithshivaprakash/.vscode/extensions/ms-python.python-2019.3.6139/pythonFiles/lib/python/ptvsd/", line 214, in start_client
                with self.started():
              File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 17, in __enter__
              File "/Users/sujithshivaprakash/.vscode/extensions/ms-python.python-2019.3.6139/pythonFiles/lib/python/ptvsd/", line 110, in started
              File "/Users/sujithshivaprakash/.vscode/extensions/ms-python.python-2019.3.6139/pythonFiles/lib/python/ptvsd/", line 145, in start
                raise RuntimeError('already started')
            RuntimeError: already started

Exception occured while processing the plan: Exception occured while processing the plan:  
--- [START] Exception Traceback ---
Traceback (most recent call last):
  File "/Users/sujithshivaprakash/Documents/GitHub/voxsupFrontend2/server/TVAnalytics/fourctv/plan_generation/", line 1833, in run_media_plan_generation
    df_plan_main = optimizer.optimize()
  File "/Users/sujithshivaprakash/Documents/GitHub/voxsupFrontend2/server/TVAnalytics/fourctv/plan_generation/", line 364, in optimize
  File "/Users/sujithshivaprakash/Documents/GitHub/voxsupFrontend2/server/TVAnalytics/fourctv/plan_generation/", line 274, in run_optimizer
  File "/Users/sujithshivaprakash/Documents/GitHub/voxsupFrontend2/server/TVAnalytics/fourctv/plan_generation/", line 338, in optimizer_GA_multiprocess
    manager = mp.Manager()
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/", line 99, in Manager
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/", line 528, in start
    self._address = reader.recv()

NOTE : Just running the python code without debugger runs perfectly fine.

Expected behavior

Debugger steps trhough the break-points without crashing.

Steps to reproduce:

Not sure about this.

After having going over articles for sometime now, I dont understand what s going wrong. Any help appreaciated. Thanks


Answer questions omartin2010

I had the same issue using the Remote extension, trying to debug a PyTorch training (which uses multiprocessing for the data loaders) and adding these lines :

import multiprocessing
multiprocessing.set_start_method('spawn', True)

solved it. Thanks!! :) Looking forward for the fix. I'm running VSCode on Win10 and I remote to a notebook VM in Azure.

Version: 1.37.0-insider (user setup)
Commit: 310cb67b0e5df5b0644f42df93ada186130dcd1b
Date: 2019-08-02T11:11:48.598Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362

And I can repro anytime, feel free to ping me on Teams if that helps to see the repro.

Github User Rank List