-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Microsoft.VSCode.CPP.IntelliSense.Msvc.linux at 100% CPU for hours #1137
Comments
Happens to me too, and I think only 0.13.1 has this issue. |
We have gotten reports of crashes at that call site, but nothing we've been able to reproduce in our offices. Do you or any of the "thumbs up" responders have an open source project, or small repro that we can use to investigate this? If the CPU is at 100% forever, then it is likely an infinite loop somewhere in the IntelliSense engine, not a crash though. The only loops in this particular call stack involve an error list that is capped at 1000 entries by default. If you grabbed this call stack shortly after opening or editing a file, it could still be in the process of reporting the error squiggles which is normal behavior. If you leave the VS Code editor alone for a while and grab the call stack again, do you get the same thing? |
My stack was taken once, after more than 17 hours of CPU time. Didn’t take it again after that. Will try to get more data.
… Den 19. okt. 2017 kl. 22.06 skrev Bob Brown ***@***.***>:
We have gotten reports of crashes at that call site, but nothing we've been able to reproduce in our offices. Do you or any of the "thumbs up" responders have an open source project, or small repro that we can use to investigate this?
If the CPU is at 100% forever, then it is likely an infinite loop somewhere in the IntelliSense engine, not a crash though. The only loops in this particular call stack involve an error list that is capped at 1000 entries by default. If you grabbed this call stack shortly after opening or editing a file, it could still be in the process of reporting the error squiggles which is normal behavior. If you leave the VS Code editor alone for a while and grab the call stack again, do you get the same thing?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
One thing, maybe, is that our source tree uses symlinking from one tree to another, and Code/CPP does tend to get a bit confused about that sometimes. (Please note that there is no symlink recursion.)
|
@eskild Your call stack with source_file_for_seq matches a crash we're seeing (somewhere around our 3rd highest hitting crash), but it doesn't directly contain any loops, so I'm not sure how the crash and the infinite processing are connected. |
Status update: I've been running 0.14.0 with VSCode 1.17.2 for a couple days now, and so far the problem I reported has not shown itself. With a little luck, it may have been fixed by the indexer work for 0.14.0. I'll leave this issue open for a few days, and then close it if all remains well. |
I'm also running vscode 1.17.2 with ms-vscode.cpptools 0.14.0 and I still see the same issue. Right now, I'm working in a directory with ~8000 source files and ~9000 headers and I see 2 |
@ihalip, there should only be one instance of Microsoft.VSCode.CPP.Extension.linux running if you only have one instance of VS Code running. Can you close VS Code, kill the lingering processes and try again? I wonder if the old 0.13.1 process didn't get shut down during the update. |
@ihalip You could try and enable logging to see if the indexing progresses. From the cpptools release note:
I use "C_Cpp.loggingLevel": "Information"; it provides some amount of progress info, even if it isn't a) terribly detailed and b) time-stamped (@bobbrow, would be useful :-) It's fair enough that the extension spends some time, maybe a few minutes, busily working, but when we get into two-digit minutes, something starts to smell suspect for common project sizes. Even NetBeans is quicker, then... |
@ihalip 1 minute of high CPU usage on 1 thread is not an indication of a bug. We need to know what it says on the tooltip on the database icon in the bottom right or if there's some error in the files that are being processed (as seen via the logging). |
I enabled the logging and let the process run for some time while I monitored the Output window. It did finish after about a while (around 15 minutes IIRC) and indexed about 59000 files, after which CPU usage dropped completely - so it looks like my issue was only due to the project size. I also have a number of paths added to c_cpp_properties.json which might slow it down. |
Status update: Still no runaway CPU usage on 0.14.0, so that's great. @bobbrow I do have a left-behind process containing a small bunch of threads.
So, the problem I originally reported appears to be fixed, but this lingering process is an indication that all isn't entirely well yet. Please advise whether I should close this bug and create a new one? |
I'll see if I can find the other issue where I talked about this. You can close this one. |
Right-o. Closing. |
Reopening, sorry about that. VSCode 1.18.0, cpptools 0.14.2: Runaway process, same place.
Trying with GDB:
Is there a way to get a symbol table? Maybe I could get at the local variables for you?
Ok, let's try to single-step to see if we're stuck in that func:
(A minute or so passes)
So it appears we're stuck. I also tried 'strace' on the thread, but no system call activity was reported. I'd say the evidence points to an endless loop. |
Same here. Visual Studio Code (linux)
Backtrace:
|
@deepskyblue86 This is caused by a difficult to track down and repro memory corruption that has existed since we introduced the IntelliSense process in April/0.11.0 (#1337). Do you have a repro we can use? I may have a repro with internal code, but I don't know yet. |
@deepskyblue86 I found a repro for a crash that I believe has the same root cause (corrupted il_header). |
From what I've seen so far, this "source_file_for_seq" crash only occurs if headers can't be found and/or there are too many errors (i.e. due to missing headers), so one potential work around is to make sure the includePaths can be found by IntelliSense. However, we still want to fix this crash, since it's our highest hitter, and we have a repro internally (the fixed corrupted il_header bug I mentioned previously turned out to be a different crash). |
@deepskyblue86 @eskild Changing line |
@sean-mcmanus Sounds good, thank you. I really hope it goes away now; I've added the params to msvc.json, and then we'll see. Please forgive me for saying this, because I haven't done the debugging and therefore I'm ignorant, but doesn't this smell a bit more of workaround than fix? I mean, given sufficiently "hostile" input, we might end up with the problem manifesting itself again. Or? |
It's not easy for us to determine if the IntelliSense engine is stuck in an infinite loop or legitimately taking a long time, but we are considering adding logic to terminate and disable it if the QoS is sufficiently bad for a given code file. I think it would be safe to say that if parsing or IntelliSense operations take more than ## seconds/minutes each, then the engine is not serving you in any meaningful way and we should probably use the fuzzy IntelliSense for that file instead. |
@eskild Yeah, it's a workaround to avoid the crash. If we see this is still a problem, we'll investigate fixing the root cause (error limit aborting causes a data structure to be missing expected data, leading to a crash). The buggy code is "owned" by another team in VS so maybe they'll fix the root issue later. It sounds like @bobbrow is talking about a different issue (intelliSense getting stuck). |
@sean-mcmanus Thanks for elaborating, appreciate it! 👍 |
You can try a preview .vsix at https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.15.0-insiders (our final release is planned for next week). We suspect it will solve most of the crashes, but the root cause of the crash when the error limit is exceeded is still being investigated by another team (it repros in VS 2017 too). |
Cool, installed .vsix. I noticed that the --error-limit is set at 25000, so I'll leave it there as opposed to the earlier suggestion of 2^31. Will keep you posted if I encounter anything. |
Yeah, we lowered the error limit to avoid the possibility of an infinite loop of error processing. The previous limit was only 250. |
Hm... I'm seeing runaway CPU on macos right now, 1.20.1, cpptools-0.15.0-insiders. I'm on a somewhat slow, but stable, VPN from home, and was just shutting down vscode for the day. I have several left-over processes, and one run-away from the first startup of vscode earlier today. The other ones appear to come from subsequent startups.
I tried attaching lldb, but I'm really not an expert in debugging on macos, so... But here it is:
Sorry I can't be more helpful, but it appears we're not entirely home free yet. |
Our main process will kill the IntelliSense process when it's shutdown, but it's possible our main process may have crashed beforehand. The IntelliSense process is stuck waiting for another thread to shutdown -- we've added code that aborts the waiting if it takes too long. Are you able to get call stacks for the dangling main processes? I've witnessed some random dangling main processes and crashes on Mac too so we'll try do more investigation on Mac for March. |
@eskild @ihalip @deepskyblue86 0.15.0 fixed the source_file_for_seq crash (at least for most scenarios, an additional fix for remaining scenarios may occur later). The dangling IntelliSense processes should be reduced as well. Can you file a new bug for any additional crashes or dangling processes? We've seen some remaining cases happening randomly that we'll continue to investigate later. |
@sean-mcmanus I'm using the 0.15.0 preview since when you asked us to try it. I'm happy with it, no issue at all. I'll try the official release today! |
(I already posted this in another bug, but was kindly asked to file it differently. I hope this is good; it's my first report re. vscode.)
Ubuntu 14.04. VSCode 1.17.1. C++ extension 0.13.1. Disabling other extensions doesn't seem to affect problem.
I work with a source tree of around 1500 files of mixed C/C++.
Problem: ~/.vscode/extensions/ms-vscode.cpptools-0.13.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux runs at 100% continuously, and IntelliSense barely works.
I've now resorted to a small script that'll kill all such processes. Then it'll run and IntelliSense will be usable for a few minutes, and then we're back at 100%
I finally got annoyed enough to attach gdb to the offending thread and got this trace; maybe it inspires some ideas. It smells like endless looping, perhaps due to wrong error handling in file I/O. I've frequently seen code that doesn't get error handling entirely right when, for example, a file disappears under its feet and where it just keeps looping, trying to read from a file that no longer provides data. Particularly with sub-processes.
In my usecase I compile frequently, and part of our build process generates new C++ files that are then compiled into the final images. I wouldn't be surprised if VSCode got surprised about this "flapping" of files.
All the other threads sit seemingly idle in futex waits. Some of them probably waiting for this one.
The text was updated successfully, but these errors were encountered: