ruff: Ruff server pegs CPU and blocks VSCode when changing many files

In our large mostly-python monorepo, when using the VSCode ruff extension + ruff server, if I update to a commit has many changed files, ruff server will consume lots of CPU (up to 1000% in some cases), and I cannot save in VSCode because it is blocked on “Getting code actions (…, “Ruff”)”.

image

Sample of debug logs:

2024-10-08 14:39:50.935 [info] Falling back to bundled executable: /Users/adamh/.vscode/extensions/charliermarsh.ruff-2024.50.0-darwin-arm64/bundled/libs/bin/ruff
2024-10-08 14:39:50.955 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-10-08 14:39:50.955 [info] Found Ruff 0.6.6 at /Users/adamh/.vscode/extensions/charliermarsh.ruff-2024.50.0-darwin-arm64/bundled/libs/bin/ruff
...
2024-10-08 17:00:20.165 [info] [Trace - 5:00:20 PM]    0.427054875s DEBUG ThreadId(06) ruff_server::session::index::ruff_settings: Ignored path via `exclude`: ...
2024-10-08 17:00:20.241 [info] [Trace - 5:00:20 PM] Sending notification '$/cancelRequest'.
2024-10-08 17:00:20.241 [info] [Trace - 5:00:20 PM] Sending request 'textDocument/codeAction - (6)'.
...

024-10-08 17:10:03.895 [info] [Trace - 5:10:03 PM]  584.158088958s DEBUG ThreadId(57) ruff_server::session::index::ruff_settings: Ignored path via `exclude`:
...

There are lots and lots of the “ignored”, which isn’t surprising since I run with a config that excludes most paths in the repo.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (16 by maintainers)

Commits related to this issue

Most upvoted comments

@dhruvmanila I’ve tried to repro and haven’t seen it with the new version. We’re re-enabling the native server and I’ll ping this thread if we get any reports. Thanks!

Thanks, that’s very useful. I think we’ve narrowed down the problem and will be working towards a fix for it.

I think it’s been better! I would tentatively close this issue. Thanks for fixing!

This is still on our mind. I’m planning to pick it up either next or the following week.

@hauntsaninja said I should tag @dhruvmanila since you’ve been talking about this.