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

intellisense updating forever issue has resurfaced. (red flame) #1474

Closed
raghavk92 opened this issue Jan 19, 2018 · 56 comments
Closed

intellisense updating forever issue has resurfaced. (red flame) #1474

raghavk92 opened this issue Jan 19, 2018 · 56 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@raghavk92
Copy link

I opened a new window and opened a folder . And i started seeing intellisense updating and it wont stop. ctrl space says loading forever . Then i closed and opened it was ok . Then i saw the c_cpp_properties.json needs to be configured for better intellisense results . So i added WSL paths and saved it. Changed C/C++ configuration on the bottom right of vscode to WSL and again updating intellisense does not stop . cant use intellisense at all.I dont know its because of the above reason but it was present when i was on 1.19.1 version yesterday and also on 1.19.2 version which i updated to today
It started around 30 hours back

I am on 1.19.2 version of vscode. Using wsl as integrated terminal.
vscode_intellisensered
vscode_intellisensered2

@raghavk92
Copy link
Author

one more thing when i was trying to screen record it was happening for longer time and also when one window of visual studio code is open there is not much problem but when two are open this problem comes always. Is this a processor issue. Does this mean i can only open one window at a time? I have a Processor Intel(R) Celeron(R) CPU N2820 @ 2.13GHz, 2129 Mhz, 2 Core(s), 2 Logical Processor(s)
and 8 gb ram.

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jan 19, 2018

What version of cpptools do you have? The version of VS Code itself usually doesn't matter. Yeah, having only 2 logical processor might be an issue, particularly if both windows are using multiple threads at once (we usually test with more processors). You might want to wait until the database icon is finished parsing, which will get reduce the processing.

@raghavk92
Copy link
Author

@sean-mcmanus the version of cpp tools is 0.14.6 .But even when no other active processes are going on . Its just one chrome tab and one window of vscode running still the updating intellisense is indefinite and its there since i opened vscode(5 seconds into opening vscode)

@sean-mcmanus
Copy link
Collaborator

Did you see this for how to set things up correctly? https://github.com/Microsoft/vscode-cpptools/blob/ddcc97ddaa02b7a9d057dc8b0e64b4fc85f866d5/Documentation/LanguageServer/Windows%20Subsystem%20for%20Linux.md

Do you see any errors in the C/C++ output window?

Is the Microsoft.VSCode.Cpp.IntelliSense.Msvc.exe process using CPU or does it appear to be deadlocked? What about the Microsoft.VSCode.Cpp.Extension.exe? What does the database icon in the bottom right say when you hover? Does it repro when you remove the system header #include references? The libraries you're referencing could be breaking stuff.

Does 0.14.4 or 0.14.5 work? We didn't mess with IntelliSense much recently so I wouldn't expect this to regress.

If you can attach a debugger and get a call stacks for the processes or dmp's that would help.

@bobbrow Do you have any other ideas how to diagnose this or see how widespread it is?

@sean-mcmanus sean-mcmanus added bug Language Service more info needed The issue report is not actionable in its current state labels Jan 22, 2018
@bobbrow
Copy link
Member

bobbrow commented Jan 22, 2018

We need to add timeout logic to the IntelliSense requests and kill the runaway process (after capturing and logging the offending stack)

@philippludwig
Copy link

philippludwig commented Jan 24, 2018

I've encountered the same issue since a few days; there are no errors in the C/C++ output window, no CPU usage. The process "Microsoft.VSCode.CPP.Extension.Linux" has a Zombie child process called "Microsoft.VSCod" (that's exactly how it's called).

Using version 0.14.6 of the cpptools, resetting the IntelliSense Database doesn't seem to do anything.

Steps to reproduce:

  1. Create an empty folder.
  2. Open the empty folder in VSCode.
  3. Create a new, empty cpp file. The red flame will stay forever.

@berrg
Copy link

berrg commented Jan 25, 2018

I've also this issue, but do not think I have any empty folder or files unless they exits in mbed/platformIO library.

When it get stuck, indent, peak, goto etc. stops working.

If I compile the project all files get complied even unchanged files.

@sean-mcmanus
Copy link
Collaborator

@philippludwig I'm not able to repro the stuck red flame with your repro steps. However, I've seen dangling processes sometimes on my Linux machine (attempting to attach a debugger failed). I don't know of a repro yet. We'll try to come up with some way to make the IntelliSense process more robust/responsive.

@philippludwig
Copy link

@sean-mcmanus Thank you for taking your time to reply here. I've also investigated the problem further and setup VSCode on another machine, and there everything works as expected. Therefore I guess it is a problem with my setup.
I've looked for debugging logs or something similar, but could not find any. If you don't mind, could you maybe point me into the right direction to acquire more information?

@sean-mcmanus
Copy link
Collaborator

@philippludwig We have the C_Cpp.loggingLevel setting, but we might not log enough info about the IntelliSense process, unless there's connection failure/crash. If you can get a debugger attached or a core dump and a call stack, that could help. We've fixed some crashes for our pending 0.15.0, but normally when there's a crash the process should exit instead of zombie.

@philippludwig
Copy link

I will report back tomorrow with as much information as I can, thanks.

@nadous
Copy link

nadous commented Jan 25, 2018

I've encountered the same issue. It's gone if I remove ccpcheck extension.

@philippludwig
Copy link

Allright, so here is a call stack of the sleeping "Microsoft.VSCode.CPP.Extension.Linux" process:

#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1  0x00007fdd9aea8ab6 in __GI___pthread_mutex_lock (mutex=0xfa7350 <_cs>)
at ../nptl/pthread_mutex_lock.c:115
#2  0x0000000000b5d82a in std::__1::recursive_mutex::lock() ()
#3  0x000000000059a8ee in intellisense_client_factory::clear() ()
#4  0x00000000005bf73c in message_handler::shutdown() ()
#5  0x00000000005bfe5e in    vscode::handler_base<message_handler>::shutdown(vscode::vscode_client_message const&) ()
#6  0x00000000005b87c8 in vscode::handler_base<message_handler>::main_loop() ()
#7  0x00000000005b73bb in main ()

Obviously, I can't attach to the Zombie directly.
If I kill the process, I get this output:

[Error - 9:00:04 AM] Request textDocument/codeAction failed.
Error: Connection got disposed.
at Object.dispose (/home/philipp/.vscode/extensions/ms-vscode.cpptools-0.14.6/node_modules/vscode-jsonrpc/lib/main.js:825:25)
at Object.dispose (/home/philipp/.vscode/extensions/ms-vscode.cpptools-0.14.6/node_modules/vscode-languageclient/lib/client.js:57:35)
at LanguageClient.handleConnectionClosed (/home/philipp/.vscode/extensions/msvscode.cpptools-0.14.6/node_modules/vscode-languageclient/lib/client.js:1864:38)
at LanguageClient.handleConnectionClosed (/home/philipp/.vscode/extensions/msvscode.cpptools-0.14.6/node_modules/vscode-languageclient/lib/main.js:78:15)
at closeHandler (/home/philipp/.vscode/extensions/ms-vscode.cpptools-0.14.6/node_modules/vscode-languageclient/lib/client.js:1852:18)
at CallbackList.invoke (/home/philipp/.vscode/extensions/ms-vscode.cpptools-0.14.6/node_modules/vscode-jsonrpc/lib/events.js:71:39)
at Emitter.fire (/home/philipp/.vscode/extensions/ms-vscode.cpptools-0.14.6/node_modules/vscode-jsonrpc/lib/events.js:135:36)
at closeHandler (/home/philipp/.vscode/extensions/ms-vscode.cpptools-0.14.6/node_modules/vscode-jsonrpc/lib/main.js:221:26)
at CallbackList.invoke (/home/philipp/.vscode/extensions/ms-vscode.cpptools-0.14.6/node_modules/vscode-jsonrpc/lib/events.js:71:39)
at Emitter.fire (/home/philipp/.vscode/extensions/ms-vscode.cpptools-0.14.6/node_modules/vscode-jsonrpc/lib/events.js:135:36)

Before that, strace prints out a lot of lines like this:

recvmsg(22, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(18, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(22, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=18, events=POLLIN}, {fd=19, events=POLLIN}, {fd=22, events=POLLIN}, {fd=30, events=POLLIN}], 4, 0) = 0 (Timeout)

Let me know if I can provide any more information.

@sean-mcmanus
Copy link
Collaborator

@philippludwig Another IntelliSense thread is blocking the shutdown request. We'll try to just kill the IntelliSense process.

@sean-mcmanus sean-mcmanus self-assigned this Jan 26, 2018
@sean-mcmanus sean-mcmanus removed the more info needed The issue report is not actionable in its current state label Jan 26, 2018
@sean-mcmanus sean-mcmanus added this to the February 2018 milestone Jan 26, 2018
@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jan 27, 2018

@philippludwig How did you get that call stack for Microsoft.VSCode.CPP.Extension.Linux? When VS Code is closed, it's supposed to kill that process in 5 seconds. Did you do something to prevent that? Is that process dangling for you too?

@philippludwig
Copy link

This process is indeed dangling, it is the parent process of the zombie process. After some time I have several of those; when I close VSCode, these processes continue to run.

Therefore I can just gdb attach to them, without doing anything special.

@philippludwig
Copy link

After renaming the .vscode and ~/.config/Code folders, the problem disappeared.

@sean-mcmanus
Copy link
Collaborator

@philippludwig Rename the .vscode folder will cause our c_cpp_properties.json to disappear and the default to be used, but it will get recreated after doing an Edit Configurations command. Removing ~/.config/Code folder seems like it could be break your VS Code installation (unless the folder is recreated), but it would also have the side effect of doing a Reset IntelliSense Database since the default database location is under there. We have a potential fix for the dangling IntelliSense process in our pending 0.15.0-insiders.

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Feb 6, 2018
@sean-mcmanus
Copy link
Collaborator

We implemented a potential fix in our 0.15.0-insiders build at https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.15.0-insiders (the final release is planned for next week). Let us know if it's still not fixed.

@philippludwig
Copy link

I've tried the 0.15.0 insiders build, indeed the problem is fixed. Thank you for your work!

@sean-mcmanus
Copy link
Collaborator

@raghavk92 Has your issue been fixed with 0.15.0? We fixed the issues the other users added to the issue, but I'm not sure if they're the same.

@graysonwebster
Copy link

I'm having this issue on 0.15.0

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Mar 30, 2018

@GreatDanton @fantasist85 We just identified a race condition on Linux/Mac that can cause our main process to deadlock. Disabling logging (i.e. loggingLevel "Error") should reduce the probability of hitting it as a temporary work around. If that doesn't work, then the root cause is a different bug.

@mthenault
Copy link

Same issue for me on Ubuntu 18.04, vscode 1.23.1, C/C++ 0.17.3 : Red flame, nothing shown in "Problems".
C_Cpp.loggingLevel is already to "Error".
Reloading the window seems to be a workaround.

@joostmeulenbeld
Copy link

joostmeulenbeld commented May 30, 2018

Same issue. Ubuntu 16.04, vscode 1.23.1, C/C++ 0.17.3. Red flame, hovering over it tells me "Updating intellisense...". In Ubuntu System Monitor, the process "Microsoft.VSCode.CPP.Extension.linux" is using 100% of a single core. Reloading the windows solves the problem for a couple of minutes, I don't yet see a correlation between actions I'm performing and intellisense failing. loggingLevel is on "Error"

@bobbrow
Copy link
Member

bobbrow commented May 30, 2018

@antismap, @joostmeulenbeld, are either of you using the new recursive includePath feature? (appending /** to any of your include paths). If you are able to share stack traces of the runaway process we should be able to confirm whether you are hitting this problem or not.

@mthenault
Copy link

mthenault commented May 31, 2018

I didnt edit the includePath.
It's a cmake project and I'm letting vscode parse compile_commands.json

@bobbrow
Copy link
Member

bobbrow commented May 31, 2018

@antismap, if the Microsoft.VSCode.CPP.Extension.linux process is not consuming a full core, then it sounds like a different issue. If that is the case, can you open a new issue and give us as much information as you can about your workspace and configuration?

@joostmeulenbeld
Copy link

@bobbrow I didn't change includePath in my settings; how can I get the stack trace? I'd like to help if it is still relevant.

@bobbrow
Copy link
Member

bobbrow commented Jun 1, 2018

We released an update with a fix for the issue, so if you can install 0.17.4 and let us know whether you still see the problem or not, we can go from there.

@gcjyzdd
Copy link

gcjyzdd commented Jun 2, 2018

I had the same problem with 0.17.4. It keeps updating forever unless restart vs code. I solved the problem by excluding the build folder when using CMake.

In c_cpp_properties.json, change

"${workspaceFolder}/**",

to

"${workspaceFolder}/*",

to stop globbing recursively so that intellisense won't pasrse the build folder.

It seems like intellisence cannot handle the build folder with lots of binaries.

@mthenault
Copy link

@bobbrow this fixed it for me, thanks ! Before that, the process was also using 100% cpu on a core.

@joostmeulenbeld
Copy link

@bobbrow I haven't seen the issue since the update, so it seems fixed! 👍

@maroc81
Copy link

maroc81 commented Jun 6, 2018

Version 0.17.4 fixed it for me. Earlier versions would get stuck even after turning logging down to none. I don't have "${workspaceFolder}/**" in my include path so that wasn't a factor in my case.

0.17.4 seems to be much better all around.

@shakthi-prashanth-m
Copy link

shakthi-prashanth-m commented Jun 8, 2018

I have opened Android source project folder. I still face this issue in version 1.23.1.

Version 1.23.1
Commit d0182c3417d225529c6d5ad24b7572815d0de9ac
Date 2018-05-10T16:04:33.747Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

@shakthi-prashanth-m
Copy link

Sorry, I didn't read #1474 (comment) before.

@mmone
Copy link

mmone commented Jun 12, 2018

I had the same problem with 0.17.4. It keeps updating forever unless restart vs code. I solved the problem by excluding the build folder when using CMake.

@gcjyzdd Excluding my build folder also fixed it for me on OSX.

@powertomato
Copy link

I ran into this or a very similar issue on Linux. I was using it to work with the z3-code base (https://github.com/Z3Prover/z3)

Z3 also uses CMake. So @gcjyzdd's fix might work. However the build script of z3 also generates some code which ends up in the build folder so I can't exclude it fully.

Here is my cpp-config:

{
    "configurations": [
        {
            "name": "Linux",
            "browse": {
                "path": [
                    "${workspaceFolder}/src"
                ],
                "limitSymbolsToIncludedHeaders": true
            },
            "includePath": [
                "${workspaceFolder}/src",
                "${workspaceFolder}/build/src",
                "/usr/include",
                "/usr/local/include"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++14",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

I will try without the line: "${workspaceFolder}/build/src"

As for a workaround: is there a way to only scan for specific file-types (.hpp, .h, .cpp in my case)?

cpptools version:
0.17.6

VS Code-Version:
Version 1.24.1
Commit 24f62626b222e9a8313213fb64b10d741a326288
Date 2018-06-13T17:47:35.732Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

@sean-mcmanus
Copy link
Collaborator

@powertomato I don't fully understand what bug you're experiencing or how to repro it. Are you hitting #2169 ? The build folder shouldn't cause any issues (there was a previous issue with recursive includes, but it was fixed, and you're not using recursive includes). You can set files.associations to set more files to be parsed as C/C++, but there's no way to stop scanning/parsing of extensionless files that are #included by other C/C++ files.

@Ankeraout
Copy link

Ankeraout commented Jul 7, 2018

I also get this problem whenever I code with VSCode. I updated this morning to 1.25 version, and I still have the red flame staying forever :
image
I am running Debian 9.4 on x64 PC, with XFCE.
I have the 0.17.6 version of C/C++ extension.
I only use VSCode for editing source code, not for compiling or anything else.
My project is built using Make.

I still do not know how to reproduce this bug, but it seems to happen randomly. When I start coding, Intellisense is updating normally and not freezing, and after typing some code in C it freezes. Sometimes it can take more than one hour, and sometimes the bug happens 5-10 minutes after starting VSCode.

VSCode does not use CPU at all when Intellisense stops working.

@powertomato
Copy link

powertomato commented Jul 9, 2018

@sean-mcmanus It's like @Ankeraout described. After some time, seemingly random, Intellisence just stops working and I get an endless "Loading..." tooltip and the red flame on the bottom right. Sometimes it takes just a few minutes, sometimes it's hours. CPU usage seems normal.

From what I can tell it happens more often with the large Z3 code base, than with smaller projects. In fact I couldn't reproduce it with small projects yet, but that could have been by chance, as I didn't work much with other codebases with this setup.

Excluding the sources from the build folder didn't help, but after your explaination that's no surprise. Was this issue was solely about the recursive includes?

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jul 9, 2018

@Ankeraout Does IntelliSense still work, i.e. is the bug just with the icon getting stuck? I just saw the bug with the red flame getting stuck, but IntelliSense still works -- we've had that bug for a couple months or so, if I can figure out a way to repro it consistently I can fix it...may switching git branches causes it. We're tracking this with #2077 .

@powertomato Is the Microsoft.VSCode.CPP.IntelliSense.Msvc.linux process using CPU when the red flame is stuck? Does killing that process and closing/reopening the file fix the issue? Are you able to attach a debugger to that process and get a call stack? You do not appear to be using recursive includes. Your issue sounds like a new bug -- it's usually better to create a new bug so we don't lose track of it...maybe we'll create a new bug ourselves if you don't want to.

@powertomato
Copy link

powertomato commented Jul 11, 2018

@sean-mcmanus I'm now able to (semi) reliably reproduce the problem I'm having. It seems it is a symptom of #2077. (Semi because I cannot reproduce #2077 itself reliably)

To reproduce it you have to wait for #2077 to occur. Then close and reopen VScode.
For me this leads to stale "Microsoft.VSCode.CPP.IntelliSense.Msvc.linux" and "Microsoft.VSCode.CPP.Extension.linux" processes. They seem to interfere with the newly created ones.
IntelliSense will stop working shortly afterward unless I kill all stale extension processes.

None of the processes seems to do anything at that point, CPU usage on all of them is 0.

There are several "Microsoft.VSCode.CPP.IntelliSense.Msvc.linux" processes even if #2077 has not yet occured and only one VScode instance is running, is that to be expected?

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jul 11, 2018

@powertomato I recall we have a fix for #2077 on Windows, but we're still working on Linux/Mac.
The dangling process issue is #2169 , which is also related. The good news is that we're actively working on a fix for our next release, although I don't think it will make the Insiders release. So I think this will solve the issues you are having.

@Ankeraout
Copy link

Ankeraout commented Jul 12, 2018

@sean-mcmanus I also (just on my screen right now) the bug where I don't have the red flame, but the suggestions keep saying "Loading...".
Also this time, it looks like there are 4 processes running.
Two of them are taking 10% of the CPU, and the remaining ones 30% and 5%.

Two are /usr/share/code/code with no arguments (10% CPU and 5% CPU)
Another one is the same file but with --type=gpu-process --no-sandbox --supports-dual-gpus=false --gpu-driver-bug-workarounds=[...] (10% CPU)
And the last one is the same file again but with --type=renderer --js-flags=--nolazy --no-sandbox --primordial-pipe-token=[...] (30% CPU)

Also I think it is interesting to mention that I have remaining processes this time after closing VSCode :
/home/[username]/.vscode/extensions/ms-vscode.cpptools-0.17.6/bin/Microsoft.VSCode.CPP.Extension.linux
There are a lot of processes (15~20) but they are not using any CPU even if they are not in zombie state.

EDIT : Okay, now I have the red flame stuck but Intellisense still works...

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Jul 13, 2018

@powertomato @Ankeraout We believe https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.17.7-insiders has fixed the issues caused by dangling/stuck processes (although there could be a race condition scenario that could hit the issue, not sure...I haven't hit that yet). Are you still having issues with that? The red flame getting stuck still repros, but maybe less often (I think we fixed some causes of it, but there are more).

@powertomato
Copy link

@sean-mcmanus Thanks, I have installed the pre release. It has been running for several hours without any problems! I will keep it running over the weekend, but it already seems much better now.

@LinAGKar
Copy link

This is still happening in version 0.19.0

@bobbrow
Copy link
Member

bobbrow commented Oct 24, 2018

@LinAGKar, can you open a new issue with additional details on how to reproduce the problem? If you are seeing the Microsoft.VSCode.CPP.IntelliSense.Msvc.exe process running non-stop, it could be an infinite loop and we'd need more details so we can investigate the problem.

@sean-mcmanus sean-mcmanus removed their assignment Apr 22, 2019
@TrueInvestmentsEnt
Copy link

TrueInvestmentsEnt commented May 29, 2020 via email

@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests