Skip to content
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

Child processes are not killed when stopping the debugger #2014

Closed
DonJayamanne opened this issue Jun 20, 2018 · 6 comments
Closed

Child processes are not killed when stopping the debugger #2014

DonJayamanne opened this issue Jun 20, 2018 · 6 comments
Labels
area-debugging bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@DonJayamanne
Copy link

Debug a python program that launches child processes.
Stop debugging, and confirm the child processes are killed.
This works in the old debugger, confirm this works as expected on the experimental debugger as well.

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug needs verification area-debugging labels Jun 20, 2018
@DonJayamanne DonJayamanne added this to the July 2018 milestone Jun 20, 2018
@DonJayamanne
Copy link
Author

Flashing as a bug even though it hasn't been confirmed, hence the needs verification flag.
Either way, it needs to be verified as this need to be looked into.

@DonJayamanne
Copy link
Author

  • Confirmed
  • Debug following code:
import subprocess

p = subprocess.Popen(['python', '-c', 'import time; time.sleep(10000)'])
print(p.pid)
p = subprocess.Popen(['python', '-c', 'import time; time.sleep(10000)'])
print(p.pid)
p = subprocess.Popen(['python', '-c', 'import time; time.sleep(10000)'])
print(p.pid)
p.wait()

@DonJayamanne
Copy link
Author

DonJayamanne commented Jun 20, 2018

Upstream bug microsoft/ptvsd#503

@brettcannon brettcannon removed this from the Jul 2018 milestone Jul 19, 2018
@DonJayamanne DonJayamanne changed the title Confirm child processes are killed when stopping the debugger Child processes are not killed when stopping the debugger Sep 30, 2018
@hjalmarlucius
Copy link

Hi, I still have this issue. It does not occur for every file I run and am not sure how to trigger it but if I do heavy debugging using Pytorch and Visdom as main addins, I eventually run out of memory.

@bersbersbers
Copy link

bersbersbers commented Mar 11, 2019

@DonJayamanne microsoft/ptvsd#503 was fixed and closed in November, but I am still seeing this issue (on Windows).

Interestingly, the above-mentioned fix involves a couple of atexits, such as atexit.register(kill_subprocesses). I myself have noticed that a workaround for killing processes called by subprocess which I came up with, using atexit too, was completely ineffective in VS Code on Windows. In particular, what I have noticed was that atexit works fine when running Python code in a terminal and closing it with Ctrl-C; but apparently, this is not what VS Code (Python) does, as atexit is not triggered when stopping debugging. (I had found the code that kills the Python process, and I believe it involves taskkill - so I am not surprised atexit does not work. I have to take this back, that was in https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/contrib/debug/node/debugAdapter.ts)

So would one solution on Windows be to send a Ctrl-C to the Python process instead of killing it, so that at least a user's workaround to end processes might work?

@gramster
Copy link
Member

gramster commented Sep 3, 2019

Closed on debugger side in March.

@gramster gramster closed this as completed Sep 3, 2019
@ghost ghost removed the needs upstream fix label Sep 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-debugging bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

5 participants