microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.4k stars 1.52k forks source link

Updating IntelliSense never stops, code navigation can't work when it happens #1852

Closed pansila closed 6 years ago

pansila commented 6 years ago

Issue Type: Bug

I'm using Visual Studio Code for my C/C++ project, IntelliSense works well when I just open the project, but after a while with some modifciatons, the updating intellisense icon on the right bottom bar will show up and seems never to stop. It makes the code navigation fail to work (Go to definition - F12). I have to reopen the project to stop the updating, but soon the problem comes back again.

VS Code version: Code 1.22.2 (3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9, 2018-04-12T16:38:45.278Z) OS version: Windows_NT x64 6.1.7601

System Info |Item|Value| |---|---| |CPUs|Intel(R) Pentium(R) CPU G4400 @ 3.30GHz (2 x 3312)| |Memory (System)|7.91GB (3.27GB free)| |Process Argv|C:\Program Files\Microsoft VS Code\Code.exe| |Screen Reader|no| |VM|0%|
Extensions (19) Extension|Author (truncated)|Version ---|---|--- markdown-mermaid|bie|0.1.1 vscode-hexo|cod|1.0.1 vscode-eslint|dba|1.4.8 jupyter|don|1.1.4 gitlens|eam|8.2.1 vscode-npm-script|eg2|0.3.3 docthis|joe|0.6.0 python|ms-|2018.3.1 cpptools|ms-|0.16.1 embrace|myc|1.0.0 vetur|oct|0.11.7 vuehelper|oys|0.1.0 vscode-journal|paj|0.5.0 vscode-code-outline|pat|0.1.0 code-settings-sync|Sha|2.9.0 code-spell-checker|str|1.6.7 rf-intellisense|Tom|2.0.0 vim|vsc|0.11.4 markdown-all-in-one|yzh|1.1.2
bobbrow commented 6 years ago

If you right click on the Microsoft.VSCode.CPP.IntelliSense.Msvc.exe process in Task Manager, there is an option to save a dump file with the stack traces for the process. Would you be able to save that and upload it to this thread so we can investigate? If there are multiple processes open, feel free to upload all of them.

Thanks!

aguirrem commented 6 years ago

I know this specific to Windows but I have seen similar issue on linux. What's the process to get the equivalent to save a "dump file"?

bobbrow commented 6 years ago

This works for me on linux:

sudo gdb -pid=<pid>
thread apply all bt
LuanEduardo47 commented 6 years ago

I've always had this problem too, most of the time I needed to restart the VSCode, but the problem always reappears.

conradoplg commented 6 years ago

I'm having the same issue on Ubuntu 16.04.

There are 10 stuck processes, here is the backtrace of one of them:

Thread 11 (Thread 0x7f66f77fe700 (LWP 20925)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008bee26 in std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) ()
#2  0x000000000054c879 in a_compiler_thread::at_end_of_scout_parse(void*) ()
#3  0x0000000000582002 in end_of_parse_notification ()
#4  0x0000000000873e89 in process_translation_unit ()
#5  0x000000000060a307 in edg_main ()
#6  0x000000000088bc7c in edge_compiler_main(int, char const**) ()
#7  0x0000000000582457 in pre_parse(int, char const**, a_scout_parser_interface&, edge::translation_unit*) ()
#8  0x000000000054c701 in a_compiler_thread::compiler_thread_routine(a_compiler_thread*) ()
#9  0x00000000005798fe in void* std::__1::__thread_proxy<std::__1::tuple<void (*)(a_compiler_thread*), a_compiler_thread*> >(void*) ()
#10 0x00007f6700b3f6ba in start_thread (arg=0x7f66f77fe700) at pthread_create.c:333
#11 0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 10 (Thread 0x7f66f7fff700 (LWP 29104)):
#0  0x00007f6700b4851d in read () at ../sysdeps/unix/syscall-template.S:84
#1  0x00000000008b7933 in async_pipe_nix::read_sync_impl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) ()
#2  0x00000000008b7a69 in async_pipe_nix::read_thread_proc() ()
#3  0x00000000008b841d in void* std::__1::__thread_proxy<std::__1::tuple<async_pipe_nix::ensure_read_thread()::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f66f7fff700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 9 (Thread 0x7f66fc944700 (LWP 29103)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b39ab in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f66fc944700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 8 (Thread 0x7f66fd145700 (LWP 29102)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b39ab in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f66fd145700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 7 (Thread 0x7f66fd946700 (LWP 29101)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b39ab in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f66fd946700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 6 (Thread 0x7f66fe147700 (LWP 29100)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b39ab in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f66fe147700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 5 (Thread 0x7f66fe948700 (LWP 29099)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b39ab in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f66fe948700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 4 (Thread 0x7f66ff149700 (LWP 29098)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b39ab in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f66ff149700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f66ff94a700 (LWP 29097)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b39ab in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f66ff94a700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f670014b700 (LWP 29096)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b39ab in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::$_0> >(void*) ()
#4  0x00007f6700b3f6ba in start_thread (arg=0x7f670014b700) at pthread_create.c:333
#5  0x00007f670087541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f6701261700 (LWP 29094)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b91fd in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008b747a in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x00000000008b1034 in comm_server::wait_for_requests() ()
#4  0x00000000005354fb in main ()
sean-mcmanus commented 6 years ago

@conradoplg There is nothing abnormal with those call stacks -- it's just waiting for work requests. It's possible the main Microsoft.VSCode.CPP.Extension.linux process is stuck waiting for results from another IntelliSense process that is in an error state. Are you able to find a repro with only 1 C/C++ file (i.e. 1 IntelliSense process) or 2, and get the call stacks of the stuck IntelliSense process that is deadlocked doing some sort of work? Maybe we'll need to re-write our threading architecture to be more resilient to stuck IntelliSense processes.

The other thread on this is https://github.com/Microsoft/vscode-cpptools/issues/1246 .

pansila commented 6 years ago

It seems easier to happen when I open multiple vscode windows. When the issue happens, a Microsoft.VSCode.CPP.IntelliSense.Msvc.exe process is left running even after I closed all visual studio code.

sean-mcmanus commented 6 years ago

@pansila That dmp isn't useful -- it just shows the process waiting for requests. Also, you may not want to publically post dmp's if they contain non-OSS source code (the dmp has the potential to contain source code). You can send a private link to dmps to c_cpp_support@microsoft.com or we could make our Windows pdb available and you could attach a debugger and send us the call stacks.

The main extensions process Microsoft.VSCode.CPP.Extension.exe is supposed to kill the IntelliSense processes on shutdown and it's supposed to die on its own when the communication pipe is closed. Is there also a dangling Microsoft.VSCode.CPP.Extension.exe process? VS Code is supposed to kill that process after 5 seconds after it closes if it doesn't close on its own.

pansila commented 6 years ago

@sean-mcmanus Thanks for the reminder. The dangling process is still there even after 5 seconds.

pansila commented 6 years ago

@sean-mcmanus Here is another issue dump. This time only one project is opened. I don't know how to check out the call stack trace, so I put them all here. It happens frequently which is really annoying, could you kindly help to see what's going wrong? Thanks

bobbrow commented 6 years ago

Thanks for the link. I did get your email yesterday, but haven't had a chance to look at it yet. I will today.

sean-mcmanus commented 6 years ago

@bobbrow Do you remember if this bug was same interprocess deadlock that got fixed?

bobbrow commented 6 years ago

Yes, this is the one I was talking about.

sean-mcmanus commented 6 years ago

This deadlock issue should be fixed now with 0.17.1.

Zephor5 commented 4 years ago

hey, i have the same issue that the code navigation fail to work after i started vscode for a while, and restart fix this. except that I didn't notice any updating intellisense icon on the status bar.

Version: 1.42.1
Commit: c47d83b293181d9be64f27ff093689e8e7aed054
Date: 2020-02-11T14:44:27.652Z
Electron: 6.1.6
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 18.7.0