Skip to content

node process related to fileWatcher consumes 100% CPU due to latest rust-analyzer #17133

Open
@ati1230

Description

@ati1230

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
From "0.3.1896" and later

rustc version: (eg. output of rustc -V)
rustc 1.72.0 (5680fa18f 2023-08-23)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)
VSCode w/ rust-analyzer version: 0.3.1896-standalone

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)
I am woring on Rust code in Linux machine via Remote Development Extension with VSCode.
(i.e., VSCode is installed on Windows machine but Rust code exists in Linux machine.)

And, I am developing Rust code in Android source code(AOSP).
Because code in AOSP is too HUGE, I am using Multi-root Workspace feature in VSCode.
It means I registered necessary directories for me in VSCode workspace.

repository link (if public, optional): (eg. rust-analyzer)
https://github.com/rust-lang/rust-analyzer

code snippet to reproduce:

// add your code here
n/a

more detailed information of issue:
I can see one node process in Linux machine consumes 100% CPU usage and it never dies even if I closed all VSCode.
This node process is related to fileWatcher and I found that this process is started when I open VSCode workspace which is using rust-analyzer.
Please refer below comment for process information:

I checked VSCode log (w/ verbose log enabled) and I found

  • when rust-analyzer is launched, it registers several directories to fileWatcher.
  • workspace directories are registered and,
  • ALL Android source code directories are also registered to fileWatcher. (as I mentioned, Android source code is really huge)

Also, I found that this issue starts to occur from specific rust-analyzer version.

  • ~ v0.3.1885 : issue is not occuring.
  • v0.3.1896 ~ : confimed that issue is occuring.

I believe this is related to different behavior of fileWatcher registration.

  • ~ v0.3.1885 : ONLY workspace directories are registered.
  • v0.3.1896 ~ : workspace directories and other ALL directories in Android source tree are registered.

Please check why this 100% CPU consumption issue is happening at latest version of rust-analyzer (at least fro v0.3.1896) and give me the fix or guide.
Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-vscodevscode plugin issuesC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions