microsoft / microsoft/vscode-cpptools

macOS: High CPU Usage (looping `update_file_if_needed`)

オープン
#8,124 コメント 3 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug Language Service performance symlinks
主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

説明

Bug type: Language Service

Describe the bug

  • OS and Version:
    Screen Shot 2021-09-09 at 11 00 41 am
  • VS Code Version:
    Screen Shot 2021-09-09 at 11 00 56 am
  • C/C++ Extension Version:
    v1.6.0

Sometime after starting vscode, the cpptools process will jump to 100% CPU usage and stay there until the windows is reloaded.
The project is for embedded devices, and is therefore using a cross-compiler (arm-none-eabi-gcc). Intellisense configuration is through an autogenerated compile_commands.json. The project is based on Zephyr RTOS (https://github.com/zephyrproject-rtos/zephyr). The root folder (ignoring compiler headers) is approximately 40k files.

Code sample and logs

  • Configurations in c_cpp_properties.json
{
    "configurations": [
        {
            "name": "Zephyr",
            "cStandard": "c99",
            "compilerPath": "/Users/<user>/code/gcc-arm-none-eabi/bin/arm-none-eabi-gcc",
            "intelliSenseMode": "gcc-x64",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json",
            "includePath": [
                "zephyr/include",
                "${workspaceFolder}/build/zephyr/include/generated"
            ]
        }
    ],
    "version": 4
}
  • Logs from running C/C++: Log Diagnostics from the VS Code command palette
    "C_Cpp.loggingLevel": "7",
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/x86/arch.h
  Same time stamp: 1630475297
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/arm64/arch.h
  Same time stamp: 1630475297
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/arm/aarch32/arch.h
  Same time stamp: 1630475297
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/arc/arch.h
  Same time stamp: 1630475297
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/nios2/arch.h
  Same time stamp: 1630475297
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/riscv/arch.h
  Same time stamp: 1630475297
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/xtensa/arch.h
  Same time stamp: 1630475297
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/posix/arch.h
  Same time stamp: 1630475297
update_file_if_needed: /Users/<user>/zephyr/zephyr/include/arch/sparc/arch.h
  Same time stamp: 1630475297

Over a minute or so of just watching the logs, there were approximately 400 thousand lines like the above.
Not all files were being checked. Files that were checked were checked about 80 times each.

Additional context

Call stack of cpptools process.

Screen Shot 2021-09-09 at 11 01 50 am

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

cpptools プロセスのコールスタックと、C/C++: Log Diagnostics に出力される update_file_if_needed の繰り返し診断から始めます。Zephyr ワークスペース、arm-none-eabi-gcc、自動生成された compile_commands.json を使用して macOS 上で再現します。繰り返されるファイルチェックが停止し、cpptools が CPU 使用率 100% を維持しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
devtools, performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。