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

High CPU usage and exit issue of Jedi-language-server #721

Closed
2 tasks done
Tgist1024 opened this issue May 7, 2023 · 5 comments · Fixed by #724
Closed
2 tasks done

High CPU usage and exit issue of Jedi-language-server #721

Tgist1024 opened this issue May 7, 2023 · 5 comments · Fixed by #724
Labels
bug Something isn't working lsp LSP related issues

Comments

@Tgist1024
Copy link

Tgist1024 commented May 7, 2023

Version confirmation

  • Confirm

Following prerequisites

  • Confirm

Neovim version

NVIM v0.9.0 Build type: Release LuaJIT 2.1.0-beta3 system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"

Operating system/version

Arch Linux 6.3.1-arch1-1

Terminal name/version

kitty 0.28.1

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

Affected language servers

jedi-language-server

How to reproduce the issue

  1. Open a Python file or project.
  2. Wait for lsp works.
  3. Exit.
  4. Repeat several times.
  5. Open process panel tools like top and the problem shows.
    image

Actual behavior

The CPU usage of Jedi language server is extremely high, and it does not automatically exit when exiting neovim. If I repeatedly open and close Python files, multiple instances of Jedi language server will appear, causing significant CPU usage. As this issue affects user experience and computer performance, it is suggested to fix it.

Expected behavior

No response

Support info

:LspInfo

 Language client log: /home/liu/.local/state/nvim/lsp.log
 Detected filetype:   python
 
 3 client(s) attached to this buffer: 
 
 Client: pyright (id: 1, bufnr: [1])
 	filetypes:       python
 	autostart:       true
 	root directory:  Running in single file mode.
 	cmd:             pyright-langserver --stdio
 
 Client: jedi_language_server (id: 2, bufnr: [1])
 	filetypes:       python
 	autostart:       true
 	root directory:  Running in single file mode.
 	cmd:             jedi-language-server
 
 Client: null-ls (id: 3, bufnr: [1])
 	filetypes:       python, cpp, c, css, scss, sh, markdown, javascriptreact, vue, typescript, javascript, typescriptreact, html, yaml, rust, vim, lua, luau
 	autostart:       false
 	root directory:  /home/liu/Documents/code/web/mysite
 	cmd:             <function>
 
 Configured servers list: jedi_language_server, rust_analyzer, lua_ls, dartls, clangd, html, bashls, pyright, jsonls

Logs

No response

Additional information

No response

@Tgist1024 Tgist1024 added bug Something isn't working lsp LSP related issues labels May 7, 2023
@ayamir
Copy link
Owner

ayamir commented May 7, 2023

Does it have to do with the uninstalled pyright?

@Tgist1024
Copy link
Author

Does it have to do with the uninstalled pyright?

I just noticed that the project replaced pyright with jedi-language-server, but after uninstalling pyright by mason, the situation remains the same.

@ayamir
Copy link
Owner

ayamir commented May 8, 2023

Never encountered this, you can remove jedi for yourself and try others like pylsp. Need more issues about it to decide.

@Tgist1024
Copy link
Author

Well... I found that using :wq to save and exit leads to the issue I mentioned while using :q does not.
I think the issue might be caused by code formatting. You can try again and see if it occurs.

@ayamir
Copy link
Owner

ayamir commented May 8, 2023

OK, I captured this and it should be normal because pylsp also have this issue.
It's reasonable that lsp need some time to stop.
image
image
But indeed jedi has abnormal high CPU load about a few seconds.
image
Will fix it with pylsp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp LSP related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants