-
Notifications
You must be signed in to change notification settings - Fork 68
Unable to debug using ptvsd - Mixed mode debugging #1283
Comments
@sujiths93 The recommended solution for mixed mode debugging is to use Visual Studio 2017/2019. See here: /cc @qubitron |
Visual studio with python support is unavailable for Mac. |
Judging by "already started" in the output and use of multiprocessing, I think it's not really a mixed-mode debugging issue, but rather another manifestation of #943. @sujiths93, can you please try adding this to your code, making sure that it runs before you use anything else from import multiprocessing
multiprocessing.set_start_method('spawn', True) |
It is pyhton 2.7, that does not support the |
@int19h
|
@aerinkim This is a general issue with In this case, it sounds like you tried passing a lambda across processes? The usual way to handle this is by passing a named global function. If the lambda body uses any variables from the local scope, you'll have to pass them as explicit arguments, and add them to the call on the other side. |
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.
And I can repro anytime, feel free to ping me on Teams if that helps to see the repro. |
This problem should go away once we support fork. |
@omartin2010 where did you put these lines (which file)? After adding these lines to my model.py file (there train() is called) I get similar error as aerinkim...
|
if I recall (it's been a few months) it in the first file that was started. Perhaps it needs to be where you're spawning your threads... are you running Python 3.6 or 3.7? and a recent version of ptvsd? |
@juskuz, the error that you get is because "spawn" has more constraints than "fork" - and, in particular, requires any data shared between the processes to be pickleable. At this point, I'd recommend trying out the new debugger with support for fork. You can opt into it by adding this to your settings.json: "python.experiments.optInto": [
"DebugAdapterFactory - experiment",
"PtvsdWheels37 - experiment"
] then remove |
@omartin2010 Thanks for reply.
Python 3.6.9 @int19h, the new debugger is ptvsd == 5.0.0a11? |
It's been too long, I don't recall what I've used. Likely Python 3.6.x. |
@juskuz Any minor release of ptvsd 5 should work, not necessarily a11. |
ok, I added the
to my to settings.json and removed set_start_method(). Now I'm getting 'RuntimeError: already started' again. and at the end of error messages I get
I used ptvsd 5.0.0a11, it's the newest available version. |
@juskuz Have you restarted after doing that change to the settings? Can you double check that you're using the ptvsd 5 version? -- You can use the code below when running under the debugger to get the version.
|
@juskuz You will need the insiders version of the python extension, you can download it here https://pvsc.blob.core.windows.net/extension-builds/ms-python-insiders.vsix. |
Environment data
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 :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
The text was updated successfully, but these errors were encountered: