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

The Microsoft.VSCode.CPP.IntelliSense.Msvc.linux process hangs #912

Closed
Cerh opened this issue Jul 24, 2017 · 15 comments
Closed

The Microsoft.VSCode.CPP.IntelliSense.Msvc.linux process hangs #912

Cerh opened this issue Jul 24, 2017 · 15 comments

Comments

@Cerh
Copy link

Cerh commented Jul 24, 2017

Ubuntu 16.04. C_Cpp.intelliSenseEngine=Default. Tooltips in the editor write "Loading ...", in the status bar "Parsing ...".
s

@Cerh Cerh changed the title High CPU usage by the Microsoft.VSCode.CPP.IntelliSense.Msvc.linux process The Microsoft.VSCode.CPP.IntelliSense.Msvc.linux process hangs Jul 24, 2017
@sean-mcmanus sean-mcmanus added Language Service more info needed The issue report is not actionable in its current state labels Jul 24, 2017
@sean-mcmanus
Copy link
Contributor

How long does it get stuck using lots of CPU? High CPU usage is normal for the process, which does compiling. Can you attach a debugger and/or get a core dmp? Does it hang with a simple workspace with a single C++ file?

@Cerh
Copy link
Author

Cerh commented Jul 25, 2017

How long does it get stuck using lots of CPU? High CPU usage is normal for the process, which does compiling.

Always, until I kill the process.
Thread #3 - 100% cpu usage.

Microsoft.VSCode.CPP.IntelliSense.Msvc.linux [26020] [cores: 0,2,3]	
	Thread #1 [Microsoft.VSCod] 26020 [core: 2] (Suspended : User Request)	
		pthread_cond_wait@@GLIBC_2.3.2() at pthread_cond_wait.S:185 0x7f3745a1f360	
		neosmart::WaitForMultipleEvents() at 0x8aa795	
		microsoft::vc::alertable_event::wait_for_multiple() at 0x8a9aec	
		protobuf_server::wait_for_requests() at 0x515ba9	
		main() at 0x5156c6	
	Thread #2 [Microsoft.VSCod] 26022 [core: 3] (Suspended : Container)	
		pthread_cond_wait@@GLIBC_2.3.2() at pthread_cond_wait.S:185 0x7f3745a1f360	
		neosmart::WaitForMultipleEvents() at 0x8aa795	
		microsoft::vc::alertable_event::wait_for_multiple() at 0x8a9aec	
		microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}::operator()() const at 0x8a6e75	
		void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}> > at 0x8a6dcd	
		start_thread() at pthread_create.c:333 0x7f3745a196ba	
		clone() at clone.S:109 0x7f374574f3dd	
	Thread #3 [Microsoft.VSCod] 26023 [core: 3] (Suspended : Container)	
		source_file_for_seq() at 0x724c1f	
		an_error_ptr_cmp::operator()(an_error* const&, an_error* const&) const at 0x88304d	
		an_error_manager::get_errors() at 0x8845b9	
		edge::scoped_query_manager::get_filtered_errors_for_tu() at 0x52543d	
		edge::an_edge_translation_unit_impl::get_filtered_errors_for_tu() at 0x52d5cd	
		edge_intellisense_server_impl::handle_get_errors() at 0x502dc0	
		work_queue::worker_proc() at 0x51b3bd	
		std::__1::__function::__func<microsoft::vc::thread_pool::enqueue(std::__1::function<void ()>, std::__1::future<void>*)::{lambda()#1}, std::__1::allocator<{lambda()#1}>, void ()>::operator() at 0x517f53	
		microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}::operator()() const at 0x8a6fdd	
		void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}> > at 0x8a6dcd	
		<...more frames...>	
	Thread #4 [Microsoft.VSCod] 26024 [core: 0] (Suspended : Container)	
		pthread_cond_wait@@GLIBC_2.3.2() at pthread_cond_wait.S:185 0x7f3745a1f360	
		neosmart::WaitForMultipleEvents() at 0x8aa795	
		microsoft::vc::alertable_event::wait_for_multiple() at 0x8a9aec	
		microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}::operator()() const at 0x8a6e75	
		void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}> > at 0x8a6dcd	
		start_thread() at pthread_create.c:333 0x7f3745a196ba	
		clone() at clone.S:109 0x7f374574f3dd	
	Thread #5 [Microsoft.VSCod] 26025 [core: 3] (Suspended : Container)	
		pthread_cond_wait@@GLIBC_2.3.2() at pthread_cond_wait.S:185 0x7f3745a1f360	
		neosmart::WaitForMultipleEvents() at 0x8aa795	
		microsoft::vc::alertable_event::wait_for_multiple() at 0x8a9aec	
		microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}::operator()() const at 0x8a6e75	
		void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}> > at 0x8a6dcd	
		start_thread() at pthread_create.c:333 0x7f3745a196ba	
		clone() at clone.S:109 0x7f374574f3dd	
	Thread #6 [Microsoft.VSCod] 26026 [core: 2] (Suspended : Container)	
		read() at syscall-template.S:84 0x7f3745a2251d	
		async_pipe_nix::read_sync_impl() at 0x523b8f	
		async_pipe_nix::read_thread_proc() at 0x523d5e	
		void* std::__1::__thread_proxy<std::__1::tuple<async_pipe_nix::ensure_read_thread()::$_0> > at 0x52477d	
		start_thread() at pthread_create.c:333 0x7f3745a196ba	
		clone() at clone.S:109 0x7f374574f3dd	
	Thread #7 [Microsoft.VSCod] 26058 [core: 2] (Suspended : Container)	
		pthread_cond_wait@@GLIBC_2.3.2() at pthread_cond_wait.S:185 0x7f3745a1f360	
		std::__1::condition_variable::wait() at 0x8b2ba6	
		a_compiler_thread::at_end_of_scout_parse() at 0x52e295	
		end_of_parse_notification() at 0x564271	
		process_translation_unit() at 0x868c19	
		edg_main() at 0x5f2f77	
		edge_compiler_main() at 0x8822b4	
		pre_parse() at 0x5654c7	
		a_compiler_thread::compiler_thread_routine() at 0x52e126	
		void* std::__1::__thread_proxy<std::__1::tuple<void (*)(a_compiler_thread*), a_compiler_thread*> > at 0x55c8ce	
		<...more frames...>	

Does it hang with a simple workspace with a single C++ file?

No.

@thomashw
Copy link

thomashw commented Jul 25, 2017

I'm having the exact same issue. "Loading" in the editor, "Parsing" in the status bar. Processes sitting at FUTEX_WAIT_PRIVATE. Ubuntu 16.04.2 LTS.

@thomashw
Copy link

thomashw commented Jul 25, 2017

Attached is a core dump. I haven't done that before so let me know if it's what you need.
core.zip

thomashw  5311  5266  5311  0    4 61340  1636   0 07:33 ?        00:00:00 /home/thomashw/.vscode/extensions/ms-vscode.cpptools-0.12.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux 5266 0
thomashw  5311  5266  5313  0    4 61340  1636   0 07:33 ?        00:00:00 /home/thomashw/.vscode/extensions/ms-vscode.cpptools-0.12.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux 5266 0
thomashw  5311  5266  5314  0    4 61340  1636   0 07:33 ?        00:00:00 /home/thomashw/.vscode/extensions/ms-vscode.cpptools-0.12.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux 5266 0
thomashw  5311  5266  5315  0    4 61340  1636   0 07:33 ?        00:00:00 /home/thomashw/.vscode/extensions/ms-vscode.cpptools-0.12.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux 5266 0
thomashw  5433  2431  5433  0    1  3556  2548   0 07:37 pts/17   00:00:00 grep --color=auto -i microsoft.vscode.cpp.intelli
thomashw@ubuntu:~$ sudo gcore 5311
[New LWP 5313]
[New LWP 5314]
[New LWP 5315]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185	../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory.
warning: target file /proc/5311/cmdline contained unexpected null characters
Saved corefile core.5311

@sean-mcmanus sean-mcmanus added bug and removed more info needed The issue report is not actionable in its current state labels Jul 25, 2017
@sean-mcmanus
Copy link
Contributor

@Cerh It looks like the parser might be in an infinite loop in Thread 3 -- the call stack is cut off for that thread, so can you include a full one? Also can you provide additional thread call stack for that thread (i.e. a thread that isn't blocked on a wait) so I can compare them, i.e. to help narrow down which function is infinite looping. If you can provide a repro project that exhibits this infinite loop that would be great too. We have never seen this infinite looping before in the IntelliSense process.

@sean-mcmanus
Copy link
Contributor

@thomashw Your issue appears different (not an infinite processing loop). Can you get a core dmp to show all the thread call stacks? I don't appear to be able to get any call stacks from the core dmp using gdb with bt.

@Cerh
Copy link
Author

Cerh commented Jul 26, 2017

I can add only the сore dump of this process.

@thomashw
Copy link

Let me know if you need anything else.

thomashw@ubuntu:~$ ps -efL | grep -iE 'intelli|UID'
UID        PID  PPID   LWP  C NLWP STIME TTY          TIME CMD
thomashw 20808 20800 20808  0    4 08:19 ?        00:00:00 /home/thomashw/.vscode/extensions/ms-vscode.cpptools-0.12.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux 20800 0
thomashw 20808 20800 20810  0    4 08:19 ?        00:00:00 /home/thomashw/.vscode/extensions/ms-vscode.cpptools-0.12.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux 20800 0
thomashw 20808 20800 20811  0    4 08:19 ?        00:00:00 /home/thomashw/.vscode/extensions/ms-vscode.cpptools-0.12.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux 20800 0
thomashw 20808 20800 20817  0    4 08:19 ?        00:00:00 /home/thomashw/.vscode/extensions/ms-vscode.cpptools-0.12.1/bin/Microsoft.VSCode.CPP.IntelliSense.Msvc.linux 20800 0
thomashw@ubuntu:~$ sudo strace -p 20808
strace: Process 20808 attached
futex(0x22d7abc, FUTEX_WAIT_PRIVATE, 1, NULL

thomashw@ubuntu:~$ sudo strace -p 20810
strace: Process 20810 attached
futex(0x7fc80c004744, FUTEX_WAIT_PRIVATE, 1, NULL

thomashw@ubuntu:~$ sudo strace -p 20811
strace: Process 20811 attached
read(3,

thomashw@ubuntu:~$ sudo strace -p 20817
strace: Process 20817 attached
open("/tmp/pipe_client_response_20800_0", O_RDONLY
thomashw@ubuntu:~$ sudo gdb -batch -ex bt -p 20808
[New LWP 20810]
[New LWP 20811]
[New LWP 20817]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185	../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory.
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008aa795 in neosmart::WaitForMultipleEvents(neosmart::neosmart_event_t_**, int, bool, unsigned long, int&) ()
#2  0x00000000008a9aec in microsoft::vc::alertable_event::wait_for_multiple(microsoft::vc::alertable_event**, unsigned long, bool, unsigned int) ()
#3  0x0000000000515ba9 in protobuf_server::wait_for_requests() ()
#4  0x00000000005156c6 in main ()

thomashw@ubuntu:~$ sudo gdb -batch -ex bt -p 20810
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185	../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory.
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000008b2ba6 in std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) ()
#2  0x000000000052cbc4 in a_compiler_thread::start(edge::query_action_data&) ()
#3  0x000000000052c8d2 in edge::an_edge_translation_unit_impl::reinitialize_without_fallback(bool, edge::snapshot_session const*, edge::file_position const&, edge::query_action_data&) ()
#4  0x000000000052e951 in edge::translation_unit::translation_unit(int, char const**, char const*, char const*, char const*, edge::snapshot_session const*, edge::query_action_data&) ()
#5  0x0000000000508ace in edge_intellisense_server_impl::create_translation_unit() ()
#6  0x0000000000502c50 in edge_intellisense_server_impl::handle_get_errors(microsoft::cpp::intellisense::GetErrorsRequest const&) ()
#7  0x000000000051b3bd in work_queue::worker_proc() ()
#8  0x0000000000517f53 in std::__1::__function::__func<microsoft::vc::thread_pool::enqueue(std::__1::function<void ()>, std::__1::future<void>*)::{lambda()#1}, std::__1::allocator<{lambda()#1}>, void ()>::operator()() ()
#9  0x00000000008a6fdd in microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}::operator()() const ()
#10 0x00000000008a6dcd in void* std::__1::__thread_proxy<std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}> >(std::__1::tuple<microsoft::vc::thread_pool::thread_pool(int)::{lambda()#1}>) ()
#11 0x00007fc81537c6ba in start_thread (arg=0x7fc814988700) at pthread_create.c:333
#12 0x00007fc8150b23dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

thomashw@ubuntu:~$ sudo gdb -batch -ex bt -p 20811
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fc81538551d in read () at ../sysdeps/unix/syscall-template.S:84
84	../sysdeps/unix/syscall-template.S: No such file or directory.
#0  0x00007fc81538551d in read () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000000000523b8f in async_pipe_nix::read_sync_impl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) ()
#2  0x0000000000523d5e in async_pipe_nix::read_thread_proc() ()
#3  0x000000000052477d in void* std::__1::__thread_proxy<std::__1::tuple<async_pipe_nix::ensure_read_thread()::$_0> >(void*) ()
#4  0x00007fc81537c6ba in start_thread (arg=0x7fc814187700) at pthread_create.c:333
#5  0x00007fc8150b23dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

thomashw@ubuntu:~$ sudo gdb -batch -ex bt -p 20817
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fc815385c7d in open64 () at ../sysdeps/unix/syscall-template.S:84
84	../sysdeps/unix/syscall-template.S: No such file or directory.
#0  0x00007fc815385c7d in open64 () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000000000523b05 in async_pipe_nix::read_sync_impl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) ()
#2  0x0000000000504143 in async_pipe::read_sync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) ()
#3  0x0000000000503e61 in bool protobuf_client::send_request<microsoft::cpp::intellisense::GetSourceRequest, microsoft::cpp::intellisense::GetSourceResponse>(microsoft::cpp::intellisense::GetSourceRequest&, microsoft::cpp::intellisense::GetSourceResponse&) ()
#4  0x00000000005038b7 in edge_intellisense_server_impl::edge_intellisense_server_impl(char const*, char const*, char const*, char const*)::{lambda(char const*)#1}::operator()(char const*) const ()
#5  0x00000000005037d0 in std::__1::__function::__func<edge_intellisense_server_impl::edge_intellisense_server_impl(char const*, char const*, char const*, char const*)::{lambda(char const*)#1}, std::__1::allocator<{lambda(char const*)#1}>, std::__1::tuple<std::__1::basic_string<char, std::__1::char_traits<char>, edge_intellisense_server_impl::edge_intellisense_server_impl(char const*, char const*, char const*, char const*)::{lambda(char const*)#1}<char> >, int, int> (char const*)>::operator()(char const*&&) ()
#6  0x00000000008ac9f6 in edge_host::find_or_create_file_buffer(wchar_t const*, edge::snapshot_session const*, edge::buffer_kind) ()
#7  0x000000000052f1aa in edge::file_buffer::open(char const*, edge::snapshot_session const*, edge::buffer_kind, a_canonicalized_file_name*) ()
#8  0x000000000058775d in a_file_buffer::a_file_buffer(char const*, a_canonicalized_file_name*, edge::buffer_kind) ()
#9  0x00000000005ddcb1 in a_file_buffer_stream::a_file_buffer_stream(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) ()
#10 0x0000000000887510 in open_input_stream ()
#11 0x0000000000721506 in open_input_stream_with_result ()
#12 0x00000000007216fa in open_source_file ()
#13 0x00000000006a1efa in open_source_file_with_error_handling ()
#14 0x000000000078d94f in search_for_input_file ()
#15 0x000000000078d034 in open_file_for_input_full ()
#16 0x000000000078cc15 in open_file_and_push_input_stack ()
#17 0x000000000070b085 in open_primary_source_file ()
#18 0x000000000070b148 in fe_init_part_2 ()
#19 0x0000000000868bce in process_translation_unit ()
#20 0x00000000005f2f77 in edg_main ()
#21 0x00000000008822b4 in edge_compiler_main(int, char const**) ()
#22 0x00000000005654c7 in pre_parse(int, char const**, a_scout_parser_interface&, edge::translation_unit*) ()
#23 0x000000000052e126 in a_compiler_thread::compiler_thread_routine(a_compiler_thread*) ()
#24 0x000000000055c8ce in void* std::__1::__thread_proxy<std::__1::tuple<void (*)(a_compiler_thread*), a_compiler_thread*> >(void*) ()
#25 0x00007fc81537c6ba in start_thread (arg=0x7fc813986700) at pthread_create.c:333
#26 0x00007fc8150b23dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

thomashw@ubuntu:~$ sudo gdb -batch -ex bt -p 20800
[New LWP 20801]
[New LWP 20802]
[New LWP 20803]
[New LWP 20804]
[New LWP 20805]
[New LWP 20809]
[New LWP 20818]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007ff590e0524d in read () at ../sysdeps/unix/syscall-template.S:84
84	../sysdeps/unix/syscall-template.S: No such file or directory.
#0  0x00007ff590e0524d in read () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007ff590d885e8 in _IO_new_file_underflow (fp=0x7ff5910d28e0 <_IO_2_1_stdin_>) at fileops.c:592
#2  0x00007ff590d8960e in __GI__IO_default_uflow (fp=0x7ff5910d28e0 <_IO_2_1_stdin_>) at genops.c:413
#3  0x00007ff590d84108 in _IO_getc (fp=0x7ff5910d28e0 <_IO_2_1_stdin_>) at getc.c:38
#4  0x0000000000ad98b5 in std::__1::__stdinbuf<char>::__getchar(bool) ()
#5  0x00000000005b2209 in std::__1::basic_istream<char, std::__1::char_traits<char> >& std::__1::getline<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_istream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, char) ()
#6  0x000000000055b11e in vscode::handler_base<message_handler>::main_loop() ()
#7  0x0000000000559e7d in main ()

@anribras
Copy link

Same issue on Ubuntu 16.04

@etem
Copy link

etem commented Sep 13, 2017

I can confirm the same issue on Fedora 26

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Sep 13, 2017

The high CPU issue could be a known infinite loop that can occur when parsing certain code(#981 ). For the deadlock, the call stacks and dmps have so far not been helpful. Can anyone provide an actual repro with some open source project and/or with the actions that triggers it and/or attaching some logs or sending them to [email protected] (see https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/Enabling%20logging.md ).

@squashmode
Copy link

I see this too, the processes don't die after closing VSCode, so they build up until I kill them.

OS: Ubuntu 16.04.

About VSCode:
Version 1.17.1
Commit 1e9d36539b0ae51ac09b9d4673ebea4e447e5353
Date 2017-10-10T14:21:18.489Z
Shell 1.7.7
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

Unfortunately I am working with a proprietary codebase.

@bobbrow
Copy link
Member

bobbrow commented Oct 17, 2017

I was able to discover a cause of lingering processes on linux/mac and we'll release an update this week with that fix. I haven't solved all of the "futex_wait" issues, but the yet-to-be-released version of the extension is running much more reliably for me on Ubuntu right now.

@sean-mcmanus
Copy link
Contributor

Our preview .vsix might fix this -- instead of sending a shutdown request on exit, we just terminate the IntelliSense processes: https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.15.0-insiders (the final release is planned for next week). We fixed the crash with source_file_for_seq too.

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Feb 16, 2018

@Cerh @thomashw We believe this is fixed (for the most part) in 0.15.0. Let us know if there's still an issue.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants