Skip to content

Memory leaks when idle #1117

@and3rson

Description

@and3rson

Describe the bug

When opening a lua file with neovim, lua-language-server starts slowly eating RAM until it takes all 16 GB of my RAM and freezes my machine. It takes around 20-30 minutes. During this time, ~/.cache/nvim/lsp.log and /tmp/lua-language-server.XXX/log/* stay silent. This happens even when I don't interact with my neovim instance at all. Reproducible both with and without --preview.

Another strange thing is that lua-language-server is constantly taking 100% of one of my CPU cores.

This does NOT happen when running lua-language-server outside of neovim with the same command as lspconfig does.

To Reproduce
Steps to reproduce the behavior:

  1. Open lua file
  2. Observe 100% CPU usage for one of the cores.
  3. Wait for 15 minutes
  4. Machine is out of RAM

Expected behavior
RAM should not be exhausted like that. Also, CPU usage should not max out at all times.

Environment (please complete the following information):

  • Arch Linux
  • Client: neovim

Provide logs

service.log [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:65]: Lua Lsp startup, root: /usr/lib/lua-language-server [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:66]: ROOT: /usr/lib/lua-language-server [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:67]: LOGPATH: /tmp/lua-language-server.eKB6/log [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:68]: METAPATH: /tmp/lua-language-server.eKB6/meta [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:69]: VERSION: [01:15:33.199][info] [#0:script/service/service.lua:141]: ========= Medical Examination Report ========= --------------- Memory --------------- Total: 1.432 MB # 00 : 1.432 MB # 01 : 0.000 MB # 02 : 0.000 MB # 03 : 0.000 MB # 04 : 0.000 MB --------------- Coroutine --------------- Total: 0 Running: 0 Suspended: 0 Normal: 0 Dead: 0 --------------- Cache --------------- Total: 1 Dead: 0 --------------- RPC --------------- Holdon: 0 Waiting: 0 ============================================== [01:15:33.307][info] [#0:script/language.lua:137]: VSC language: nil [01:15:33.307][info] [#0:script/language.lua:138]: LS language: en-us [01:15:33.307][info] [#0:script/workspace/workspace.lua:38]: Workspace init root: file:///home/anderson [01:15:33.308][info] [#0:script/workspace/workspace.lua:42]: Log path: /tmp/lua-language-server.eKB6/log/file_home_anderson.log
file_home_anderson.log [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:65]: Lua Lsp startup, root: /usr/lib/lua-language-server [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:66]: ROOT: /usr/lib/lua-language-server [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:67]: LOGPATH: /tmp/lua-language-server.eKB6/log [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:68]: METAPATH: /tmp/lua-language-server.eKB6/meta [01:15:33.157][info] [#0:/usr/lib/lua-language-server/main.lua:69]: VERSION: [01:15:33.199][info] [#0:script/service/service.lua:141]: ========= Medical Examination Report ========= --------------- Memory --------------- Total: 1.432 MB # 00 : 1.432 MB # 01 : 0.000 MB # 02 : 0.000 MB # 03 : 0.000 MB # 04 : 0.000 MB --------------- Coroutine --------------- Total: 0 Running: 0 Suspended: 0 Normal: 0 Dead: 0 --------------- Cache --------------- Total: 1 Dead: 0 --------------- RPC --------------- Holdon: 0 Waiting: 0 ============================================== [01:15:33.307][info] [#0:script/language.lua:137]: VSC language: nil [01:15:33.307][info] [#0:script/language.lua:138]: LS language: en-us [01:15:33.307][info] [#0:script/workspace/workspace.lua:38]: Workspace init root: file:///home/anderson [01:15:33.308][info] [#0:script/workspace/workspace.lua:42]: Log path: /tmp/lua-language-server.eKB6/log/file_home_anderson.log [01:15:33.308][info] [#0:script/workspace/workspace.lua:48]: Workspace create: file:///home/anderson [01:15:33.416][info] [#0:script/provider/provider.lua:40]: Load config from client file:///home/anderson [01:15:33.416][info] [#0:script/provider/provider.lua:47]: Load config from .luarc.json/.luarc.jsonc file:///home/anderson [01:15:33.416][info] [#0:script/provider/provider.lua:40]: Load config from client file:///home/anderson [01:15:33.416][info] [#0:script/provider/provider.lua:47]: Load config from .luarc.json/.luarc.jsonc file:///home/anderson [01:15:33.417][info] [#0:script/provider/provider.lua:55]: Load config from client fallback [01:15:33.417][info] [#0:script/library.lua:207]: Init builtin library at: nil [01:15:33.422][info] [#0:script/library.lua:207]: Init builtin library at: file:///home/anderson [01:15:33.430][info] [#0:script/plugin.lua:80]: plugin path: nil [01:15:33.430][info] [#0:script/plugin.lua:80]: plugin path: nil [01:15:33.430][info] [#0:script/provider/provider.lua:55]: Load config from client fallback [01:15:33.430][info] [#0:script/workspace/workspace.lua:279]: Preload start: file:///home/anderson [01:15:33.431][info] [#0:script/workspace/workspace.lua:285]: Scan files at: file:///home/anderson [01:15:33.431][info] [#0:script/workspace/workspace.lua:295]: Scan library at: file:///tmp/lua-language-server.eKB6/meta/LuaJIT%20en-us%20utf8 [01:15:33.431][info] [#0:script/workspace/workspace.lua:279]: Preload start: [01:15:33.431][info] [#0:script/workspace/workspace.lua:295]: Scan library at: file:///tmp/lua-language-server.eKB6/meta/LuaJIT%20en-us%20utf8 [01:15:35.228][info] [#0:script/workspace/workspace.lua:309]: Found 13 files at: file:///home/anderson [01:15:35.228][info] [#0:script/workspace/loading.lua:152]: Load files from disk: file:///home/anderson [01:15:35.228][info] [#0:script/workspace/workspace.lua:309]: Found 13 files at: [01:15:35.228][info] [#0:script/workspace/loading.lua:152]: Load files from disk: [01:15:35.273][info] [#0:script/workspace/loading.lua:164]: Loaded files takes [0.089] sec: file:///home/anderson [01:15:35.273][info] [#0:script/workspace/loading.lua:173]: Compile files takes [0.000] sec: file:///home/anderson [01:15:35.273][info] [#0:script/workspace/loading.lua:174]: Loaded finish: file:///home/anderson [01:15:35.273][info] [#0:script/workspace/workspace.lua:311]: Preload finish at: file:///home/anderson [01:15:35.273][info] [#0:script/workspace/loading.lua:164]: Loaded files takes [0.089] sec: [01:15:35.273][info] [#0:script/workspace/loading.lua:173]: Compile files takes [0.003] sec: [01:15:35.273][info] [#0:script/workspace/loading.lua:174]: Loaded finish: [01:15:35.273][info] [#0:script/workspace/workspace.lua:311]: Preload finish at: [01:15:35.273][info] [#0:script/provider/diagnostic.lua:387]: Diagnostics scope [], files count:[14] [01:15:35.288][info] [#0:script/provider/diagnostic.lua:404]: Diagnostics scope [] finished, takes [0.028] sec. [01:15:37.228][info] [#0:script/provider/diagnostic.lua:387]: Diagnostics scope [file:///home/anderson], files count:[14] [01:15:37.235][info] [#0:script/provider/diagnostic.lua:404]: Diagnostics scope [file:///home/anderson] finished, takes [0.013] sec.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions