-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error message if subprocess exits before attach to it completes #303
Comments
I can reproduce this. The error doesn't always happen -- sometimes it works, sometimes it fails in the way described and sometimes it fails with a different error: If I set the Those messages seem to be originated in the following places: And it really seems like they should be ignored (i.e.: subprocesses can be killed before being able to connect to it or even while the connection is being done, which seems like the case here as the multiprocessing Pool is killed sometimes after creating all the processes requested and sometimes earlier, while it's still creating processes). I'm not sure why setting the @int19h since this is all in the adapter (and maybe in the interaction with VSCode itself), would you like to take a look at that? |
The difference with "debugAdapterPath" is probably due to lack of native tracing slowing things down enough that it doesn't happen. I couldn't repro it so far either with or without. The first error ("disconnected unexpectedly") is in the code that handles failures for all message handlers in the adapter, on the basis that most of them involve at least one, and often several, messages sent to the server. It's not easy to get rid of, because the client expects some response at that point, and an error response is really the only one that's generic enough to apply to any request. But, the error response for the "attach" request always produces a visible error message... It looks like the "attach" handler needs to do more specific handling in case of subprocesses - if it runs into either of those errors, it should basically pretend that attach succeeded, but the process then terminated immediately - this would be rather convoluted, because of all the "configurationDone" logic that's shared with launch. But perhaps it can get away with no response, and a "terminated" event. |
Sending "terminated" before responding to "attach" is slightly better - VSCode will still complain, but now it's a pop-up notification ("failed to start debug session") instead of a modal box. Sending a dummy success response to "attach" proved to be easier than I thought, and provides the smoothest UX. |
… it completes When "subProcessId" is specified, but there's no matching subprocess, pretend that attach succeeded, but immediately terminate the session afterward.
I post this from the issue: microsoft/vscode-python#12481 (comment)
Environment data
Actual behavior
After running python debug execution,
Server[6] disconnected unexpectedly
Server[pid=5450] disconnected unexpectedly
appear.(It's after finishing the code, so I can use remote debugging)
Expected behavior
There is no error
Steps to reproduce:
code with multiprocessing
try_multiprocess.py
launch.json
Push the debug execution button on VS Code, and the code itself works properly, but the errors
Server[6] disconnected unexpectedly
Server[pid=5450] disconnected unexpectedly
appear.The text was updated successfully, but these errors were encountered: