microsoft / microsoft/vscode-cpptools

100% CPU usage when there's a symlink to a different disk drive on Linux

Open
#7,218 53 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service more info needed
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

I am experiencing this exact same issue.
What I have also noticed is that when I run htop, I see a single thread of the C/C++ extension constantly at 100% cpu usage. This happens anytime I compile the code and lasts until I close VSCode.

SW Versions:

  • Manjaro 5.10.7
  • VSCode 1.54.3
  • C/C++ 1.2.2

The output window only has a single 'instance' for the C/C++ extension: "C/C++ Configuration Warnings". In this window it seems to be switching between IntelliSense modes willy-nilly. A small excerpt of the logs (in reality it is quite lengthy, but a lot of them are duplicate entries):

[3/23/2021, 3:06:10 PM] For C source files, IntelliSenseMode was changed from "linux-clang-x64" to "linux-gcc-x64" based on compiler args and querying compilerPath: "/usr/bin/gcc"
[3/23/2021, 3:06:10 PM] For C++ source files, IntelliSenseMode was changed from "linux-clang-x64" to "linux-gcc-x64" based on compiler args and querying compilerPath: "/usr/bin/gcc"
[3/23/2021, 3:06:14 PM] For C source files, IntelliSenseMode was changed from "linux-clang-x64" to "linux-gcc-arm" based on compiler args and querying compilerPath: "/usr/bin/arm-none-eabi-gcc"
[3/23/2021, 3:06:14 PM] For C++ source files, IntelliSenseMode was changed from "linux-clang-x64" to "linux-gcc-x64" based on compiler args and querying compilerPath: "/usr/bin/gcc"

If I manually specify for it to use any of these compilerPaths, it will warn about changing to clang (effectively printing the same, but reversed). This doesn't fix the issue however.

Originally posted by @dimitry-boersma in https://github.com/microsoft/vscode-cpptools/issues/7197#issuecomment-804973395

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

Start by reproducing the Linux case with a symlink to another disk, compiling the project while watching htop and the C/C++ Configuration Warnings output. Trace the repeated IntelliSenseMode changes involving compilerPath values such as /usr/bin/gcc and /usr/bin/arm-none-eabi-gcc. Done means the mode no longer oscillates and the extension thread does not remain at 100% CPU after compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
developer-experience, operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.