-
Notifications
You must be signed in to change notification settings - Fork 300
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
VSCode leaves several running processes after exit #1626
Comments
Thanks. This may be unavoidable depending upon the machine. VS code gives all extensions 5 seconds to finish shutdown. If we don't get called to close our processes before that 5 seconds is up, they'll stay running. We'll investigate though. We might not be closing the processes in the first place. |
Maybe the VS code OSS version behaves differently, but I'm not reproing this on a windows or a linux box. |
@rchiodo I had a similar problem even when I ran the official version. It left several ipykernel_launcher instances. The LanguageServer is a new addition to the family. I switched to it around the same time I've switched to the oss version. I can try running the official version with LanguageServer enabled to see if I have the same problem. |
Might also be other extensions installed are taking the 5 seconds that we'd normally use for closing processes. Can you try this after disabling all other extensions other than the python extension? |
Disabling other extensions doesn't make a difference (vscode-oss @d5eac26). Will try with the official release next. |
Well, this is pretty rad... So, I've tried the official version of vscode and it was correctly cleaning up all the processes as you said. Next, I went ahead and completely nuked all the directories associated with vscode-oss that I could find. IIRC they were: Then, launched vscode-oss, reinstalled the Python extension and now it seems to work fine... nothing is left behind... 😕 Now, the interesting part is that the @rchiodo if you don't mind, I'd like to keep this issue open for a few more days while I do some more intensive testing. I will come back here and close if all is good. |
Also seeing ipykernel and language server keep running on remote ssh after I exit out of VSCode....not sure if it's intended or not for remote server, but for now I'm rebooting remote machine to free up RAM. Doing "remote ssh - kill vscode server on host" seem to close some processes but not jupyter nor python language server. Tried manually entering "jupyter notebook stop" but that results in timeout error. Right now my option of killing orphan process is just rebooting the machine. |
In my case I am not seeing the languageServer anymore, but after heavy use of Jupyter for several hours (executing and re-executing multiple cells, restarting the kernel several times, clearing all cell output, etc.) I did notice 2 ipykernel processes left behind (one in a zombie state). |
I am also seeing the same issue on the vscode installed through apt from packages.microsoft.com. Just opening a jupyter notebook and exiting vscode leaves behind orphan processes:
Usually 2-3 of these. FWIW: My |
This seems to have gotten worse with later versions of code-insiders as well. I will post some specifics shortly |
Old bug with no new comments for nearly a year. Closing. |
@greazer this was never fixed. I've observed it few weeks ago. Please reopen. |
Thank you @rchiodo. I didn't want to keep bugging ya'll as I know everybody is busy. I am still patiently waiting for this to get fixed. |
I can confirm this behavior of leaving a stale python instance of
And $ code --list-extensions --show-versions | grep jupyter
[email protected] By the way To find details of stuff left behind/not cleaned up by vscode: ps -f -p $(pgrep -f ipykernel_launcher) | more To see exactly which IPython orphans have ended up owned by the user init instance of systemd: ps -f -p $(pgrep -P $(pgrep -u $UID systemd) -f ipykernel_launcher) | more Note To kill/cleanup just the orphaned IPython instances (and reclaim your RAM!): pkill -P $(pgrep -u $UID systemd) -f ipykernel_launcher |
The root cause of this bug is the daemon's we spin up to make kernel's launch faster. I believe you can workaround the problem by eliminating these files here (copy them elsewhere first in case that breaks something else):
|
Thanks @rchiodo So far, removing mkdir /tmp/ipy_buggy_launch
mv ~/.vscode/extensions/ms-toolsai.jupyter-2021.8.1236758218/pythonFiles/lib/python/pyls_jsonrpc /tmp/ipy_buggy_launch Since doing this, haven't yet reproduced orphaned IPython instances after vscode closes. |
Downside is longer startup times for kernels. But that's relative. On some windows machines this can cost you 3-5 seconds for startup. On a linux box, it's a lot less time. |
I'd suggest disabling this as a first step (via setting or code). |
You think there might be cases where it's still necessary? |
Marking this as verified though I don't have an exact repro to test here. Just working with insiders and making sure things are cleaned up after shutdown. And I'm not seeing anything left over. |
Repro case is using linux/wsl, start a notebook kernel, close VS code itself. It used to leave the kernel processes running. |
How does one know if this has landed in the insiders build? I've still experienced this today, but my build was about a week old |
Whoops my mistake. I'm on Mac, didn't notice the WSL / linux specificity. I'll remove my verification. |
@rchiodo I can confirm that this handles the problem. Sorry, dunno how to add verified label... 🤷🏻♂️ |
@rchiodo any idea when this will land in the release build? Or is it safe to stay on pre-release? I am using Jupyter for work and if pre-release is unstable, I'd rather wait |
Next week sometime it will be in stable. Pre-release is certainly less stable. It ships every night after running our tests. |
Does result still depend on I've tried to run code-server with and without i have some kind of "test scenario" but it may be difficult to understand:) UPD: i'll just use systemd to start/stop code-server, this eliminates problem of hanging processes. Though jupyter/runtime folder still gets cluttered with kernel files. |
Seems like we should clean up the runtime folder kernel.json files. That's likely a result of just killing the process. |
Total noob here, but maybe there's something simple to look at in my JSON settings, what I'm observing is closing vscode leaves two conda processes up and running, one of which is zero but the other is consuming ~30% cpu. Basically the entire time I have vscode open there is a conda process at 30% regardless of what I'm doing. Then when I quit vscode and look at task manager it never really quits, those two conda processes are still there, one pegged at ~30%, the other at 0 and a Console Window host also at 0, and vscode is still visible as a running process in task manager, like it just won't quit. Any suggestions? |
@augaug what is the command line for those processes? That might be conda discovery flaking out. |
@rchiodo - how would I find that info? I can provide just not sure what you mean exactly. One thing I noticed that is slightly odd is that I choose my interpreter, it's a conda env, and it says "('arcgispro-py3-clone':conda)" in status bar of vscode which is correct...but then at some point it just switches, has the same interpreter path etc. and everything works, but no longer says (:conda), it says "Python 3,7,11 64-bit (system)" - I found that odd, not sure if it means anything. |
@augaug I created a new issue to discuss your problem. |
Issue Type: Bug
Steps to reproduce:
Expected behavior:
Any processes started by vscode are closed.
Actual behavior:
After launching and closing vscode a few times (and realizing I am starting to run out of memory) I notice this:
Extension version: 2020.5.80290
VS Code version: Code - OSS 1.46.0 (3984852b33bd6897dd83108ac305c567d49e8fda, 2020-05-15T14:46:12.527Z)
OS version: Linux x64 5.4.0-29-generic
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: