vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Forever updating intellisense after building

Open dougaak opened this issue 8 years ago • 20 comments

Issue Type: Performance Issue

This issue just happens recently, so I suspect that it is due to the latest update.

I am using MSYS to build the C++ project. Almost everytime I build the project, VS Code will start to update intellisense and it won't stop, making intellisense completely offline. Sometimes Git oprations that change files may also trigger this.

The CPU usage is not in 100% though. Reloading the window can temporarily fix this problem, but it is still annoying.

Extension version: 0.17.3 VS Code version: Code 1.23.1 (d0182c3417d225529c6d5ad24b7572815d0de9ac, 2018-05-10T17:11:17.614Z) OS version: Windows_NT x64 10.0.16299

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz (8 x 2594)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: enabled
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled
Memory (System) 7.91GB (4.18GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    1	    88	  1532	code main
    0	   185	 11080	   window (mainmenu.cpp - residualvm - Visual Studio Code)
    0	    70	  1456	     extensionHost
   13	    89	  6776	       C:\Users\Douglasdoug\.vscode\extensions\ms-vscode.cpptools-0.17.3\bin\Microsoft.VSCode.CPP.Extension.exe
    0	     6	  3612	         console-window-host (Windows internal process)
    0	    82	  8472	       electron_node server.js 
    0	    14	  6784	     watcherService 
    0	     6	 13340	       console-window-host (Windows internal process)
    0	    13	  8464	     electron-crash-reporter
    0	    67	 14048	   shared-process
    0	    73	 14096	   shared-process
    0	   102	 14184	   gpu-process
Workspace Info
|  Window (mainmenu.cpp - residualvm - Visual Studio Code)
|    Folder (residualvm): 3003 files
|      File types: h(808) cpp(695) o(533) d(532) bmp(38) patchr(33) mk(29)
|                  po(25) png(22) bdf(22)
|      Conf files: sln(4) makefile(4) settings.json(1);

dougaak avatar May 28 '18 02:05 dougaak

I have this too, but it seems like the workaround posted in issue 2039 will stop this from happening.

el-robo avatar May 28 '18 07:05 el-robo

I have exactly same issue too.

meteusteler avatar May 28 '18 08:05 meteusteler

Having same problem. Current workaround is removing all /** from includePath. It's strange that my /** should be irrelevant to my build folders but still causing update, though.

mocabe avatar May 28 '18 11:05 mocabe

I am running into the exact same issue as well, it's really frustrating to have to close and reopen VSCode every time I build

chuggafan avatar May 28 '18 13:05 chuggafan

@chuggafan You don't need to close it every time. Open the Command Palette, there is a command called Reload Window

@el-robo I'll see if the workaround works, but it will be a lot better if this issue can be tackled completely, I believe.

dougaak avatar May 28 '18 13:05 dougaak

@DouglasLiuGamer, can you send us a process dump when you get into this state? The easiest way is to:

  • open Task Manager
  • right click on the Microsoft.VSCode.CPP.Extension.exe process that is spinning out of control
  • choose "Create dump file" from the menu

From there you have two options. You can either email us the dump file (c_cpp_support @ microsoft.com) and we will analyze it, or you can open the dump file in Visual Studio or WinDbg and send us the thread stack traces (@sean-mcmanus, we have symbols online now, right?). The dump file will contain the source code of the files you have open in it, so don't send us a dump file if you are working on a project where sharing the code would violate any NDA you might be under.

bobbrow avatar May 29 '18 17:05 bobbrow

@bobbrow Yeah, symbols are available with 0.17.3. You just need to set "symbolSearchPath": "http://msdl.microsoft.com/download/symbols".

We have a fix pending for a 100% CPU "livelock", but I don't think we've encountered any new deadlocks so a call stack would help.

sean-mcmanus avatar May 29 '18 19:05 sean-mcmanus

@bobbrow I tried to use the Visual Studio but what I could get is only this:

default

I am not sure if I can directly send you the dump file.

BTW, the workaround of removing "/**" from includePath can fix this issue.

dougaak avatar May 30 '18 03:05 dougaak

Thank god it's not just me! Attached a copy of all threads' stacks: cpp_stacks.txt. There seems to be a bunch of threads waiting on what I can only assume to be the same mutex.

duncanhorn avatar May 30 '18 09:05 duncanhorn

My guess is that this is the thread that holds it:

9  Id: 30ac.62f4 Suspend: 1 Teb: 005d7000 Unfrozen
 # ChildEBP RetAddr  
00 0393f788 779532bb ntdll_77b30000!NtDelayExecution+0xc
01 0393f7f0 7795320f KERNELBASE!SleepEx+0x9b
02 0393f800 01515cef KERNELBASE!Sleep+0xf
03 0393f808 01107452 Microsoft_VSCode_CPP_Extension!_Thrd_yield+0x8
04 0393f838 0110e760 Microsoft_VSCode_CPP_Extension!intellisense_client::shutdown+0x83
05 0393f868 0112fb0d Microsoft_VSCode_CPP_Extension!intellisense_client_factory::clear+0x6d
06 0393f894 011167b7 Microsoft_VSCode_CPP_Extension!vscode::message_handler::clear_diagnostics_for_all_open_files+0x54
07 0393f8a0 01129a8c Microsoft_VSCode_CPP_Extension!??$_Call@AAV<lambda_db7277ecf7a624ba15d8115aa2e14806>@@$$V@_Invoker_functor@std@@SAXAAV<lambda_db7277ecf7a624ba15d8115aa2e14806>@@@Z+0xe
08 0393f8a8 0110cda3 Microsoft_VSCode_CPP_Extension!?_Do_call@?$_Func_impl@V<lambda_db7277ecf7a624ba15d8115aa2e14806>@@V?$allocator@H@std@@X$$V@std@@EAEXXZ+0x9
09 0393f8dc 01177957 Microsoft_VSCode_CPP_Extension!<lambda_4df443f537cf37bf52db65427de5ad17>::operator()+0xbd
0a 0393f8e8 01178ed6 Microsoft_VSCode_CPP_Extension!??$_Call@AAV<lambda_cd6ec53400d3f1066a03b3738e08d33d>@@$$V@_Invoker_functor@std@@SAXAAV<lambda_cd6ec53400d3f1066a03b3738e08d33d>@@@Z+0x13
0b 0393f8f0 01179c95 Microsoft_VSCode_CPP_Extension!?_Do_call@?$_Func_impl@V<lambda_cd6ec53400d3f1066a03b3738e08d33d>@@V?$allocator@H@std@@X$$V@std@@EAEXXZ+0x9
0c 0393f9a8 01179599 Microsoft_VSCode_CPP_Extension!microsoft::vc::thread_pool::do_work+0x17f
0d 0393f9c8 01179128 Microsoft_VSCode_CPP_Extension!std::_LaunchPad<std::unique_ptr<std::tuple<<lambda_7a5c86eedba4f728bcdfee14fde4807b> >,std::default_delete<std::tuple<<lambda_7a5c86eedba4f728bcdfee14fde4807b> > > > >::_Run+0x3c
0e 0393f9d0 010ded4b Microsoft_VSCode_CPP_Extension!std::_LaunchPad<std::unique_ptr<std::tuple<<lambda_7a5c86eedba4f728bcdfee14fde4807b> >,std::default_delete<std::tuple<<lambda_7a5c86eedba4f728bcdfee14fde4807b> > > > >::_Go+0x6
0f 0393f9d8 01592285 Microsoft_VSCode_CPP_Extension!std::_Pad::_Call_func+0xa
10 0393fa14 75a18484 Microsoft_VSCode_CPP_Extension!thread_start<unsigned int (__stdcall*)(void *)>+0x58
11 0393fa28 77b92ec0 KERNEL32!BaseThreadInitThunk+0x24
12 0393fa70 77b92e90 ntdll_77b30000!__RtlUserThreadStart+0x2f
13 0393fa80 00000000 ntdll_77b30000!_RtlUserThreadStart+0x1b

Given that the very next thread is blocked inside of the same clear_diagnostics_for_all_open_files waiting on the mutex, but earlier in the function's invocation

duncanhorn avatar May 30 '18 09:05 duncanhorn

@duncanhorn Yeah, that's the "livelock" we've already fixed. We're working on a releasing an Insiders build with the fix: https://github.com/Microsoft/vscode-cpptools/issues/2043 .

sean-mcmanus avatar May 30 '18 18:05 sean-mcmanus

@DouglasLiuGamer You have to expand the blocks in the Threads window to see the call stacks. You may also need to set your Symbol Path correctly.

sean-mcmanus avatar May 30 '18 18:05 sean-mcmanus

@sean-mcmanus What did you mean by "expanding the blocks"? I have set up the Microsoft Symbol Servers, anything else I need to do?

dougaak avatar May 31 '18 03:05 dougaak

You can just double click on one of the threads in the threads window, and that will update the call stack window with the call stack for the selected thread. You might also need to right click in the call stack window and enable "Show external code" so that the [External Code] part is replaced with the actual call stack.

bobbrow avatar May 31 '18 04:05 bobbrow

@bobbrow Thanks. Never used VS debugger before. I have sent the copy of thread call stacks in email. Maybe also attaching one here is better: cpp_call_stack.txt

dougaak avatar May 31 '18 05:05 dougaak

Thanks. Yours also looks like the "livelock" issue. Disabling the recursive includes should work around the issue.

bobbrow avatar May 31 '18 06:05 bobbrow

We released 0.17.4 with a fix for the livelock, so this issue should be resolved now. There are still some performance issues with recursive includes that we are working on, so you might still see some high CPU usage when opening files, but it should eventually catch up. We are going to track performance problems with recursive includes using issue #2068.

bobbrow avatar Jun 01 '18 03:06 bobbrow

Intellisense seems to be working, but the indicator in the bottom right is still persistently a red fire that says "Updating IntelliSense..." when hovered over (but hey, I'll take that)

duncanhorn avatar Jun 01 '18 09:06 duncanhorn

but the indicator in the bottom right is still persistently a red fire that says "Updating IntelliSense..."

Same here.

dougaak avatar Jun 02 '18 03:06 dougaak

It looks like #1917 was tracking both icons and was closed with the update. We know that there's still a problem with the red flame icon. We need to open a new bug for it.

bobbrow avatar Jun 02 '18 05:06 bobbrow