Ask questionsUnable to debug using ptvsd - Mixed mode debugging
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
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/log.py", line 110, in g return f(*args, **kwargs) File "/Users/sujithshivaprakash/.vscode/extensions/ms-python.python-2019.3.6139/pythonFiles/lib/python/ptvsd/pydevd_hooks.py", 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/daemon.py", 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/contextlib.py", line 17, in __enter__ return self.gen.next() File "/Users/sujithshivaprakash/.vscode/extensions/ms-python.python-2019.3.6139/pythonFiles/lib/python/ptvsd/daemon.py", line 110, in started self.start() File "/Users/sujithshivaprakash/.vscode/extensions/ms-python.python-2019.3.6139/pythonFiles/lib/python/ptvsd/daemon.py", 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/generate_media_plan.py", line 1833, in run_media_plan_generation df_plan_main = optimizer.optimize() File "/Users/sujithshivaprakash/Documents/GitHub/voxsupFrontend2/server/TVAnalytics/fourctv/plan_generation/run_optimizers.py", line 364, in optimize allow_excess_goal=allow_excess_goal) File "/Users/sujithshivaprakash/Documents/GitHub/voxsupFrontend2/server/TVAnalytics/fourctv/plan_generation/run_optimizers.py", line 274, in run_optimizer campaign_constraint_priority=self.campaign_constraint_priority, File "/Users/sujithshivaprakash/Documents/GitHub/voxsupFrontend2/server/TVAnalytics/fourctv/plan_generation/plan_optimizers.py", 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/__init__.py", line 99, in Manager m.start() File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/managers.py", line 528, in start self._address = reader.recv() EOFError
NOTE : Just running the python code without debugger runs perfectly fine.
Debugger steps trhough the break-points without crashing.
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.