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

100% CPU usage because of c/c++ intellisense extension #1351

Closed
claudio-incomedia opened this issue Dec 15, 2017 · 22 comments
Closed

100% CPU usage because of c/c++ intellisense extension #1351

claudio-incomedia opened this issue Dec 15, 2017 · 22 comments
Labels
Language Service more info needed The issue report is not actionable in its current state

Comments

@claudio-incomedia
Copy link

  • Extension Name: cpptools
  • Extension Version: 0.14.4
  • OS Version: Linux x64 4.4.0-103-generic
  • VSCode version: 1.19.0
{
	"activationTimes": {
		"startup": false,
		"codeLoadingTime": 102,
		"activateCallTime": 5,
		"activateResolvedTime": 0,
		"activationEvent": "onLanguage:cpp"
	}
}

After opening a cpp file, the extension uses 100% CPU until PC locks.

@sean-mcmanus
Copy link
Collaborator

It should be 100% CPU on one core, which is normal, but what do you mean by "until PC locks"? Also, when you hover over flame and/or database icons in the bottom right what does it say? Does this repro with a simple file with no header? What if you do an Edit Configuration and clear out the includePath and/or browse.path settings?

@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state labels Dec 15, 2017
@claudio-incomedia
Copy link
Author

Thanks fo your reply

but what do you mean by "until PC locks"?

I mean that after a while the pc starts swapping due to the high cpu and memory usage and the, once swap is full, it just hangs. Other times compiz crashes before swap starts (I'm on Ubuntu).

Also, when you hover over flame and/or database icons in the bottom right what does it say?

It says "Discovering files" but I'm unsure. It does not happen with every file. It seems that something in a specific source is actually triggering the issue.

Does this repro with a simple file with no header?

Nope

What if you do an Edit Configuration and clear out the includePath and/or browse.path settings?

Seems like the problem is still here.
I'm going to try the fix suggested in #1294
I'll let you know.

@sean-mcmanus
Copy link
Collaborator

How many cores and memory do you have? How much memory is released from your system when our extension is disabled? "Discovering files" should go away in a matter of seconds (I was seeing about 1500 files per second processed). We've had parser bugs that could lead to infinite loops, but they were fixed....oh wait, looks like #1294 is a not fixed infinite loop I didn't realize we had.

@claudio-incomedia
Copy link
Author

claudio-incomedia commented Dec 15, 2017

I have 8 cores and 16GB of memory.
Is it ok that it indexes all the files every time I open the editor? Shouldn't it save the data to a DB?
Actually, it is much slower than that in indexing. I takes about 6/7 seconds to index 700 files.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Dec 15, 2017

I assume we're only using 1 core though, right? 16 GB should be enough. I don't know how we could be using up so much memory. I'm seeing the "Discovering files" phase process at a rate of 1500 files per second and the "Parsing files" phase go at 50 files/second when it actually does parsing and 75 files/second when there is no parsing, which appears to be too slow due to unnecessary #include file traversals -- we're working on a fix for that now.

@claudio-incomedia
Copy link
Author

Yes, it uses a single core.
I don't want to smile too early but it seems that the fix proposed for #1294 is working for me :-)
Thank you!

@sean-mcmanus
Copy link
Collaborator

Oh, I didn't realize you were having 100% CPU usage on the IntelliSense process (I thought it was the main process for some reason...the intellisense process has nothing to do with the messages shown on the database icon).

@Jackson-soft
Copy link

same issue

@vasa-chi
Copy link

On current macOS ~/.vscode/extensions/ms-vscode.cpptools-0.14.5/bin/Microsoft.VSCode.CPP.Extension.darwin starts hogging 100% of one CPU core as soon as I open a .c file.

@sean-mcmanus
Copy link
Collaborator

@Jackson-soft What do you mean by "same" issue? Do you mean issue #1294 ? Did the workaround work?

@vasa-chi Your issue is different. Microsoft.VSCode.CPP.Extension.darwin is not the IntelliSense process and it's supposed to be using 100% of one CPU core because it's parsing for symbols (or looking for files to parse). You can use the Pause Parsing command to temporarily stop this or set the browse.path setting in c_cpp_properties to be empty (or include less folders) to eliminate the CPU processing. We are working to reduce the length of time the CPU is used.

@vasa-chi
Copy link

@sean-mcmanus umm, should it use 100% all the time? I've opened VSCode on one file for half an hour and got some tea, and it was still running at 100% when I got back to my macbook.

@sean-mcmanus
Copy link
Collaborator

@vasa-chi What does the progress show when hovering over the database icon in the bottom right?

@vasa-chi
Copy link

@sean-mcmanus "Parsing files 456 / 38292".

I got it, though. I've disabled limitSymbolsToIncludedHeaders in my config, and plugin started parsing everything in possible includes. As soon as I enabled this option, everything returned to normal.

Or, at least, it seems to.

Thanks for help, and sorry for late answer.

@bobbrow
Copy link
Member

bobbrow commented Jan 2, 2018

@Jackson-soft if you can elaborate on what your issue is, we can help you. It looks like @vasa-chi's issue is resolved and @claudio-incomedia's issue is the same as #1294, so we will close this issue if yours is also the same. Thanks.

@jamie-pate
Copy link

jamie-pate commented Feb 23, 2018

image

The IO usage is killing my system.

Unfortunately I have spinning rust and I think it's becoming a bottleneck when one core is run at full tilt.

parsing 19790/30690 (66%) (the number is slowly moving up)

@bobbrow
Copy link
Member

bobbrow commented Feb 23, 2018

@jamie-pate, we index your entire workspace by default. If our extension is causing an I/O bottleneck for you, you have some options:

  • lower the priority of the indexing service by clicking the database icon and choosing something other than "highest"
  • Run the "Edit Configurations..." command and change the "browse.path" array to reduce the number of folders that we index. More information here

@jamie-pate
Copy link

Clicking the database icon only presents Pause Parsing from the quicklist

@bobbrow
Copy link
Member

bobbrow commented Feb 23, 2018

@sean-mcmanus, did we not add the option to change the parsing priority from the icon?
@jamie-pate, you can change the setting manually. It is "C_Cpp.workspaceParsingPriority"

@sean-mcmanus
Copy link
Collaborator

Yeah, I never added that option...it was never even spec'd out. Maybe a Change Priority option could be added that triggers a 2nd dropdown with the list of available options.

@bobbrow bobbrow added this to Needs Info in 0.26.2 Milestone Aug 15, 2018
@bobbrow
Copy link
Member

bobbrow commented Feb 4, 2019

I'm closing old issues marked "more info needed". If you are still having issues with the extension, please ensure you have installed the latest version and open a new issue with the issue details.

@bobbrow bobbrow closed this as completed Feb 4, 2019
@Manouchehri
Copy link

Could there be a "pause" button on indexing? This isn't a great UX, I ended up disabling the extension because I have work to get done and a lagging UI is pretty frustrating.

@sean-mcmanus
Copy link
Collaborator

@Manouchehri If you click the database icon in the status bar you can select the "Pause Parsing" button, but it only works for background parsing, and not parsing caused by opening a file and parsing its include dependencies. But that doesn't affect the red flame (IntelliSense parsing) which happens in a different process.

@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.
Labels
Language Service more info needed The issue report is not actionable in its current state
Projects
None yet
Development

No branches or pull requests

7 participants