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

Closing idle processes #2558

Closed
st-schneider opened this issue Apr 23, 2018 · 4 comments
Closed

Closing idle processes #2558

st-schneider opened this issue Apr 23, 2018 · 4 comments

Comments

@st-schneider
Copy link

st-schneider commented Apr 23, 2018

Issue Type: Performance Issue

There seem to be a lot of zombie processes. Please have a look at the process log. There are a lot of nvim processes.

Extension version: 0.11.5
VS Code version: Code - Insiders 1.23.0-insider (c1cd4378c5e5dc434ed959e13556d05240a8ca18, 2018-04-20T05:10:42.823Z)
OS version: Darwin x64 17.5.0

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz (8 x 2800)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.05GB free)
Process Argv /Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
   28	   115	 61047	code-insiders main
    7	    66	 61048	   gpu-process
    1	    66	 62145	     extensionHost
    0	     0	 63546	       nvim -u NONE -N --embed
    0	     0	 63635	       /Users/stschneider/.vscode-insiders/extensions/ms-vsliveshare.vsliveshare-0.2.399/dotnet_modules/vsls-agent --autoexit --pipe 372caa6bb6a844538c7e46dfcd9e0f83 --service https://insiders.liveshare.vsengsaas.visualstudio.com/
    0	    16	 63651	       electron_node server.js 
    0	     0	 63673	       /usr/bin/php /Users/stschneider/.vscode-insiders/extensions/felixfbecker.php-intellisense-2.3.1/vendor/felixfbecker/language-server/bin/php-language-server.php --tcp=127.0.0.1:51821 --memory-limit=4095M
    0	     0	 64595	       nvim -u NONE -N --embed
    0	    16	 64597	       electron_node server.js 
    0	    16	 64598	       electron_node server.js 
    0	    16	 64599	       electron_node cssServerMain.js 
    0	     0	 64652	       nvim -u NONE -N --embed
    0	    16	 64659	       electron_node htmlServerMain.js 
    0	     0	 64667	       nvim -u NONE -N --embed
    0	     0	 64678	       nvim -u NONE -N --embed
    0	     0	 64963	       nvim -u NONE -N --embed
    0	    16	 64965	       electron_node tslintServer.js 
    0	    16	 64966	       electron_node electronForkStart.js tsserver.js 
    0	    16	 64972	         electron_node typingsInstaller.js tsserver.js typesMap.js 
    0	    16	 64967	       electron_node eslintServer.js 
    0	     0	 65027	       nvim -u NONE -N --embed
    0	     0	 65047	       nvim -u NONE -N --embed
    0	     0	 65404	       nvim -u NONE -N --embed
    0	     0	 65427	       nvim -u NONE -N --embed
    0	     0	 65599	       nvim -u NONE -N --embed
    0	     0	 65745	       nvim -u NONE -N --embed
    0	     0	 65870	       nvim -u NONE -N --embed
    0	     0	 66125	       nvim -u NONE -N --embed
    0	     0	 66381	       nvim -u NONE -N --embed
    0	     0	 66811	       nvim -u NONE -N --embed
    0	     0	 67039	       nvim -u NONE -N --embed
    0	     0	 67063	       nvim -u NONE -N --embed
    0	     0	 67854	       nvim -u NONE -N --embed
    0	    16	 67857	       electron_node server.js 
    0	    16	 67858	       electron_node server.js 
    0	     0	 69691	       nvim -u NONE -N --embed
    0	     0	 70546	       nvim -u NONE -N --embed
    0	     0	 70924	       nvim -u NONE -N --embed
    0	     0	 70947	       nvim -u NONE -N --embed
    0	     0	 70953	       nvim -u NONE -N --embed
    0	     0	 70956	       nvim -u NONE -N --embed
    0	     0	 70975	       nvim -u NONE -N --embed
    0	     0	 71127	       nvim -u NONE -N --embed
    0	     0	 71249	       nvim -u NONE -N --embed
    0	     0	 71259	       nvim -u NONE -N --embed
    0	     0	 71274	       nvim -u NONE -N --embed
    0	     0	 71281	       nvim -u NONE -N --embed
    0	     0	 71288	       nvim -u NONE -N --embed
    0	     0	 71327	       nvim -u NONE -N --embed
    0	     0	 71342	       nvim -u NONE -N --embed
    0	     0	 71525	       nvim -u NONE -N --embed
    0	     0	 71534	       nvim -u NONE -N --embed
    0	     0	 71541	       nvim -u NONE -N --embed
    0	     0	 71559	       nvim -u NONE -N --embed
    0	     0	 74674	       nvim -u NONE -N --embed
    0	     0	 74684	       nvim -u NONE -N --embed
    0	     0	 74788	       nvim -u NONE -N --embed
    0	     0	 74814	       nvim -u NONE -N --embed
    0	     0	 75495	       nvim -u NONE -N --embed
    0	     0	 75508	       nvim -u NONE -N --embed
    0	     0	 75585	       nvim -u NONE -N --embed
    0	     0	 75929	       nvim -u NONE -N --embed
    0	     0	 75947	       nvim -u NONE -N --embed
    0	     0	 76053	       nvim -u NONE -N --embed
    0	     0	 76068	       nvim -u NONE -N --embed
    0	    16	 76070	       electron_node init.js 
    0	    16	 76071	       electron_node server.js 
    0	     0	 76092	       nvim -u NONE -N --embed
    0	     0	 76113	       nvim -u NONE -N --embed
    0	     0	 76132	       nvim -u NONE -N --embed
    0	     0	 76148	       nvim -u NONE -N --embed
    0	     0	 76162	       nvim -u NONE -N --embed
    0	     0	 76167	       nvim -u NONE -N --embed
    0	     0	 76176	       nvim -u NONE -N --embed
    0	     0	 76183	       nvim -u NONE -N --embed
    0	     0	 76187	       nvim -u NONE -N --embed
    0	     0	 76233	       nvim -u NONE -N --embed
    0	     0	 76307	       nvim -u NONE -N --embed
    0	     0	 76338	       nvim -u NONE -N --embed
    0	     0	 76445	       nvim -u NONE -N --embed
    0	     0	 76450	       nvim -u NONE -N --embed
    0	     0	 76456	       nvim -u NONE -N --embed
    0	     0	 76460	       nvim -u NONE -N --embed
    0	     0	 76505	       nvim -u NONE -N --embed
    0	     0	 76603	       nvim -u NONE -N --embed
    0	     0	 76983	       nvim -u NONE -N --embed
    0	     0	 76990	       nvim -u NONE -N --embed
    0	     0	 76996	       nvim -u NONE -N --embed
    0	     0	 77001	       nvim -u NONE -N --embed
    0	     0	 77065	       nvim -u NONE -N --embed
    0	     0	 77098	       nvim -u NONE -N --embed
    0	     0	 77113	       nvim -u NONE -N --embed
    0	     0	 77132	       nvim -u NONE -N --embed
    0	     0	 77147	       nvim -u NONE -N --embed
    0	     0	 78207	       nvim -u NONE -N --embed
    0	     0	 78235	       nvim -u NONE -N --embed
    0	     0	 78243	       nvim -u NONE -N --embed
    0	    16	 62146	     watcherService
    0	    16	 62147	     terminal
    0	     0	 62148	       /bin/zsh -l
    0	     0	 64709	         vagrant ssh
    0	    16	 63620	     searchService
    0	    16	 68160	     terminal
    0	     0	 68161	       /bin/zsh -l
    0	     0	 70991	         vagrant ssh
    0	    16	 71848	     terminal
    0	     0	 71849	       /bin/zsh -l
    0	     0	 73346	         vagrant ssh
   12	    66	 61050	   shared-process
   61	    82	 78638	   shared-process
    0	     0	 78639	   /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
@jpoon
Copy link
Member

jpoon commented Apr 24, 2018

Weird, I thought we fixed this #2038. You should have as many nvim processes as you have files/tabs open, but this is clearly way too many unless you have 30+ tabs open.

Edit: So the neovim obj (which maps to a nvim process) is held in vimState. So long as vimState is disposed it should also delete the nvim process. Question is, when is vimState actually disposed?

@langolf
Copy link

langolf commented Apr 24, 2018

I see the same (mac, stable vscode). I'm not using tabs so all files that are opened in background are enabling nvim process. Even if I close file the process is staying.

BinaryKhaos added a commit to BinaryKhaos/Vim that referenced this issue Apr 27, 2018
VSC only automatically disposes resources when an extension is shutdown.
Since every time a new TextEditor is opened, we also instantiate a new
ModeHandler (along other Disposables like neovim processes), those pile
up and will not get properly disposed until we get shutdown one way or
the other.

One issue this is causing is that neovim processes are not being cleaned
up and hang around until our shutdown.

Thus, every time we remove a ModeHandler, we manually dispose it to free
its resources.

Fixes VSCodeVim#2558.
BinaryKhaos added a commit to BinaryKhaos/Vim that referenced this issue Apr 27, 2018
VSC only automatically disposes resources when an extension is shutdown.
Since every time a new TextEditor is opened, we also instantiate a new
ModeHandler (along other Disposables like neovim processes), those pile
up and will not get properly disposed until we get shutdown one way or
the other.

One issue this is causing is that neovim processes are not being cleaned
up and hang around until our shutdown.

Thus, every time we remove a ModeHandler, we manually dispose it to free
its resources.

Fixes VSCodeVim#2558.
@BinaryKhaos
Copy link
Contributor

BinaryKhaos commented Apr 27, 2018

VSC only disposes resources when an extension is shutdown, thus in this example, the ModeHandler we instantiate every time a new TextEditor is created, will not get disposed. Since this also "owns" VimState (which in turn has the neovim object), we get piled up neovim processes.

I have opened a pull requested with a possible fix.

(And sorry for the noise with the unintended older and wrong commit above. Sigh.)

BinaryKhaos added a commit to BinaryKhaos/Vim that referenced this issue Apr 27, 2018
VSC only automatically disposes resources when an extension is shutdown.
Since every time a new TextEditor is opened, we also instantiate a new
ModeHandler (along other Disposables like neovim processes), those pile
up and will not get properly disposed until we get shutdown one way or
the other.

One issue this is causing is that neovim processes are not being cleaned
up and hang around until our shutdown.

Thus, every time we remove a ModeHandler, we manually dispose it to free
its resources.

Fixes VSCodeVim#2558.
@knetworx
Copy link

knetworx commented May 1, 2018

It sounds like you may have already found the culprit, but here's some simple repro steps I came across, in case it helps:

A new nvim process is spawned each time you open a new file, even if you're reusing a tab you were using previously.
Whenever the tab/file is closed, the nvim process does not shut down.
Whenever the entire editor is closed, all zombie nvim processes shut down.

jpoon pushed a commit that referenced this issue May 3, 2018
VSC only automatically disposes resources when an extension is shutdown.
Since every time a new TextEditor is opened, we also instantiate a new
ModeHandler (along other Disposables like neovim processes), those pile
up and will not get properly disposed until we get shutdown one way or
the other.

One issue this is causing is that neovim processes are not being cleaned
up and hang around until our shutdown.

Thus, every time we remove a ModeHandler, we manually dispose it to free
its resources.

Fixes #2558.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants