hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.53k stars 377 forks source link

Memory intensive "node" processes clogging up system resources after closing nvim #1728

Open mar-muel opened 9 months ago

mar-muel commented 9 months ago

FAQ

Announcement

Minimal reproducible full config

if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
cmp.setup {
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body)
    end,
  },

  mapping = {
    ['<CR>'] = cmp.mapping.confirm({ select = true })
  },

  sources = cmp.config.sources({
    { name = "nvim_lsp" },
    { name = "buffer" },
  }),
}
EOF

lua << EOF
local capabilities = require('cmp_nvim_lsp').default_capabilities()

require'lspconfig'.cssls.setup {
  capabilities = capabilities,
}
EOF

Description

When opening multiple buffers the "node" process associated with the pyright lang server seems to not get killed upon quitting nvim (see reproduction).

It could be that this is related to pyright itself. I'm opening this mostly to get some advice on how to debug this further? I'm using a MacBook M2 pro, reproduced both on iterm2 and terminal.app.

Steps to reproduce

  1. Open any Python file
  2. This starts "node" process, as expected (:LspInfo gives "1 client attached")
  3. I quit nvim - "node" process dies, as expected - this works as expected
  4. I open a file again
  5. :vsp
  6. :e some/other/file.py
  7. (maybe open a few more buffers)
  8. :qa!
  9. Process "node" sticks around, hogging a lot of memory (>1GB)
  10. I open a Python file again - starts new process with name "node", therefore now 2 "node" processes each using a lot of memory. Previous one never dies. Parent process is 1, meaning it is forked from the init process.

Expected behavior

I expect all node processes to properly shut down after closing nvim.

Actual behavior

More and more "node" processes are started over time, clogging up my system resources.

Additional context

NVIM v0.9.1 Build type: Release LuaJIT 2.1.0-beta3

pyright 1.1.326