LuaLS / LuaLS/lua-language-server

lua-language-server exhausts available inotify resources

Open
#1,709 13 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

How are you using the lua-language-server?

Other

Which OS are you using?

Linux

What is the issue affecting?

Other

Expected Behaviour

Using lua-language-server shouldn't consume all available inotify resources.

Actual Behaviour

After opening a project no other application can use inotify, because recursive inotify can try watching too many files (over 125,000 in my case, but depends on the limit).

Reproduction steps
  1. Create a dummy config file (return {}) and place it somewhere with many files (e.g. in home directory).
  2. Specify path to that config via --configpath like in --configpath=$HOME/lsp.lua.
  3. Open some workspace with that configuration (using lsp.vim in Vim9 here, but client shouldn't matter).
  4. Try using inotifywait some/file and observe Failed to watch some/file; upper limit on inotify watches reached!, which shouldn't happen.
Additional Notes

Watch probably shouldn't be recursive when used in https://github.com/sumneko/lua-language-server/blob/d33debdaa7d8748beef0e0365f0314222006058e/script/provider/provider.lua#L34

Log File

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the exhaustion using the dummy config, a workspace with many files, and inotifywait as described. Then inspect script/provider/provider.lua around line 34, where the watch behavior is identified. Done means opening the workspace no longer consumes all available inotify watches, while the language server still handles the configured workspace.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, lua
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.