Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop in the Intellisense process #1294

Closed
ogrisel opened this issue Nov 29, 2017 · 6 comments
Closed

Infinite loop in the Intellisense process #1294

ogrisel opened this issue Nov 29, 2017 · 6 comments

Comments

@ogrisel
Copy link

ogrisel commented Nov 29, 2017

Steps to reproduce:

  • Install vs code and the official C/C++ extension by Microsoft
  • git clone https://github.com/python/cpython
  • cd cpython
  • code .
  • ctrl-p to open "Modules/_pickle.c"

Problem

The following process runs in the background with 100% CPU usage:

/home/testuser/.vscode/extensions/ms-vscode.cpptools-0.14.3/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux

There is also the following process:

/home/testuser/.vscode/extensions/ms-vscode.cpptools-0.14.3/bin/Microsoft.VSCode.CPP.Extension.linux

All those processes stay alive after exiting VS Code. I have to kill Microsoft.VSCode.CPP.IntelliSense.Msvc.linux manually to terminate it. When I do not kill it seems to run for ever (I waited at least 20 min) and it was still running with 100% CPU.

Environment:

  • Ubuntu Linux 16.04
  • VS Code 1.18.1
  • vscode-cpp-tools 0.14.2

I created a new testuser account and installed no other extension besides vscode-cpp-tools. My settings.json is empty. I tried to use:

"C_Cpp.intelliSenseEngine": "Default"

instead but does not seem to fix the problem.

Here is the output of the log of the C/C++ extension:

IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
File exclude: **/.git
File exclude: **/.svn
File exclude: **/.hg
File exclude: **/CVS
File exclude: **/.DS_Store
File exclude: **/.vscode
Search exclude: **/node_modules
Search exclude: **/bower_components
Search exclude: **/.vscode
Code browsing service initialized
  Folder: /usr/lib/gcc/x86_64-linux-gnu/5/include/ will be indexed
  Folder: /usr/local/include/ will be indexed
  Folder: /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/ will be indexed
  Folder: /usr/include/ will be indexed
  Folder: /home/testuser/code/cpython/ will be indexed
Discovering files...
Checking for syntax errors: file:///home/testuser/code/cpython/Modules/_pickle.c
  Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/5/include/
  Processing folder (recursive): /usr/local/include/
  Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/
  Processing folder (recursive): /usr/include/
  Processing folder (recursive): /home/testuser/code/cpython/
  Indexing: 8689 file(s) processed
  Indexing: 0 file(s) removed from database
Done discovering files.
Parsing open files...
Done parsing open files.
Checking for edits and parsing remaining files...
  Processing folder (recursive): /home/testuser/code/cpython/
  Parsing: 4283 files(s) processed
Done parsing remaining files.
@bobbrow
Copy link
Member

bobbrow commented Nov 29, 2017

Thank you for the report. I am able to duplicate this. The IntelliSense process is stuck in an infinite loop and the Extension process is waiting for the IntelliSense process to respond to a shutdown request (which it won't because it's stuck).

That said, I was able to get it working by adding "__GNUC__=5" and "Py_BUILD_CORE" to the "defines" array and "${workspaceRoot}/Include" to the "includePath" in c_cpp_properties.json.

@ogrisel
Copy link
Author

ogrisel commented Dec 1, 2017

I confirm that this workaround works for me as well.

@bobbrow bobbrow changed the title Excessive CPU usage by the C/C++ Intellisense process Infinite loop in the Intellisense process Dec 1, 2017
@nico87
Copy link

nico87 commented Dec 13, 2017

I have the same issue but the suggested workaround did not work.

@0x00deaf
Copy link

0x00deaf commented Feb 14, 2018

Well, even if this workaround works for this particular code it does not work for my code project.

Is there any other ways to make intellisense from taking 100% cpu for each opened file (each creates its own thread) that totally hangs the operting system ( 4.15.1-2-ARCH # 1 SMP x86_64 GNU/Linux)

The only solution for me and my team-mates was to do run it with 'nice 20 code'. At least I am able to move my mouse when this happens.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Feb 14, 2018

@0x00deaf You can set the intelliSenseEngine to "Tag Parser" to disable the IntelliSense process until we can get the infinite processing fixed. 0.16.0 is going to add a compilerPath option and set the compiler defines correctly (and maybe a language version option) which may fix the issue if it's caused by incorrect flags/defines being passed to our parser. But if it's still not fixed, we may need to find a repro or get a call stack.

@Colengms
Copy link
Collaborator

This appears to have been addressed. Using the repo steps, I see the IntelliSense process complete an initial pass and settle down quickly. On close, everything shuts down.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants