-
Notifications
You must be signed in to change notification settings - Fork 67
Multiprocessing via debug adapter #1706
Comments
Any updates? Excited for general release to see if I can use VSCode to debug my Pyramid app. |
@calebickler @rickstaa This is done, the python extension is rolling it out in waves. Currently about 20% of the users get the new debugger that supports multiprocessing. If you want to try this out here is what you can do:
If everything is setup right, when you debug you should see |
/cc @fabioz The above instructions might be helpful to you too :). Along with this you can add |
@karthiknadig Thanks a lot for the new debugger it is amazing. Appears to be working with processes spawned by the subprocess and multiprocess modules. Is it also supposed to work with processes spawned by the module and Qthread modules? I tried it out in one of my Pyqt5 scripts and it is not hitting the breakpoints. I will reopen the issue below if the new debugger still is supposed to work with Q threads. |
@karthiknadig thanks for the update. I've been waiting for this update to debug my scripts that use the sh library which uses os.fork internally. I just tried out the new debugger (on Ubuntu 19.10, latest insiders code and insiders python extension, experiments opted in). With no arguments to the subprocess, I'm able to step past the sh forks successfully. However with arguments to the subprocess it seems there is a failure in the forked process.
|
Related to that error, on Python 3 the arguments to subprocess must be i.e.: the code below fails in Python 3.7 due to passing bytes to the subprocess (with or without the debugger).
Error without the debugger:
|
On a 2nd thought, maybe there's some other function from the You can change the logging call in the method
|
@fabioz Indeed. The sh library is using os.fork and os.execv to launch subprocesses. It doesn't use the subprocess library.
|
I'll take a look at that (right after I finish the issue I'm currently working on). |
@rickstaa, it is supposed to work for Qt specifically. @fabioz, perhaps there's a regression in the monkey-patching code for PyQt? Or are we not setting pydevd up correctly for that anymore? In the meantime - and for libraries other than PyQt that start their own threads - you can call |
hmm, I tried it with my pyramid app, I can debug |
@calebickler Can you please file a separate issue for it, and add debugger logs there? |
Does the version I downloaded have new bugs? Like I cannot set a specific file to run when I call the debugger (see stack overflow Q: https://stackoverflow.com/questions/60215436/how-to-correctly-set-specific-module-to-debug-in-vs-code). Is that related to the error mentioned by @rADikal8e7 ? |
@brando90 I don't think it's related to the issue that we're discussing, but it sounds like a bug, and possibly a regression - please file a separate issue. and include your launch.json debug configuration. |
@karthiknadig @int19h I installed the Insiders version of the extension, put the experiments into the VS Code |
is the debugger that supports multiprocessing done/finished? I want to update all my vs code stuff without having to worry things break (e.g. my jupyter notebook stopped working and unsure how to fix it and thought updating vs code might be a good starting point but Im scared dubugger will break: https://github.com/microsoft/vscode-python/issues/10168 ) |
@int19h After a recent auto update the extension can no longer access the new_ptvsd path. So i keep hitting the error where it accesses the old ptvsd path. I have tried to restore to a dev branch and make sure i opt into the experimental version mentioned in the post above #1706 (comment) with no luck. Reloaded vs-code insiders a bunch of times. Am i missing something basic? Extension version: ms-python.python-2020.4.67210-dev remote json settings:
Error:
|
@rADikal8e7 Can you look at Python output panel? It kind of gives you an idea if the setting was picked up. |
@karthiknadig Hmm.. i dont see those in the output. I have pretty minimalistic settings in the remote settings.json file. Nothing shows up in the console output with regards to the exp group. This was taken after a reload. |
@karthiknadig That did the trick. Earlier telemetry was turned off in the user settings and enabled in the remote settings. I guess it needs to be enabled in both the settings for it to function as intended. Anyways thanks for the help. |
This is done. |
I want to have a version of the debugger that always works with pytorch (it's multitrheading thing). How do I do that? |
where is this? How do I get into this window? |
How does one reload? Your comments need to have more details for non developers to have them be useful. |
Where is this new path thing that should be printed out? Can you be more precise? Is it in the terminal? Debug console, output problems....? |
For now this works but I do not want to have to change settings of vscode. I want vscode to work and not have me think about the editor at all. Current solution:
|
@cpvandehey First and foremost, you need to switch to https://github.com/microsoft/debugpy. If that still happens after doing so, please file a bug report in that repo. |
@int19hl, how come -- It did fix my issue (thanks) and I am now trying to push this update downstream to different projects e.g. I opened up a skaffold issue |
There's an open PR to mark it deprecated, but we're holding off on that until we ship a version of vscode-python that no longer includes ptvsd. The most recent version has both in an A/B experiment, although it's at 100% now (i.e. you get debugpy unless you explicitly opt out). The next stable release of vscode-python will only have debugpy with no way to opt out, and the version that ships with it will be debugpy 1.0.0. For now, we keep it in beta to allow us to iterate rapidly, while making sure that |
The conclusion of the investigation in #1703 is that to deliver the best, most reliable implementation of multiprocessing, we need to switch from the existing design in which the debug server in the root process manages the child processes, to the design in which the debug adapter manages all processes.
In the new design, there is always a single adapter in a multiproc debug session. Debug servers in all processes - both the main process and subprocesses - all connect to that adapter, treating it as a DAP client. On the other side, the IDE establishes multiple connections to the debug adapter, each connection representing a separate process being debugged (at most one of these connections is over stdio, and that only in the "launch" scenario; the rest will be over sockets, using the DebugAdapterServer API in VSCode).
The text was updated successfully, but these errors were encountered: