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

cpptools taking 100% cpu with kernel source when expected to be idle

Open nikaiw opened this issue 1 year ago • 0 comments

Environment

  • OS and Version: 6.5.0-17-generic #17-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 11 14:01:59 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • VS Code Version: 1.86.2
  • C/C++ Extension Version: 1.3.0

Bug Summary and Steps to Reproduce

Bug Summary: After opening the sources of the linux kernel and installing vscode-cpptools, cpptools started to takes 100%

Steps to reproduce:

  1. git clone latest kernel source
  2. open the source in vscode
  3. click on a c file and install the extension
  4. cpptools stuck taking 100% cpu Expected behavior: cpptools idle

attaching with gdb give the following thread backtrace I believe to be the culprit:

#0  0x00007f8313ea42d6 in code_store::CEncEditScript::FindPos(code_store::CEncParseNode*) ()
#1  0x00007f8313ea44db in code_store::CEncEditScript::ProcessNodeFromTree2(code_store::CEncParseNode*) ()
#2  0x00007f8313ea455f in code_store::CEncEditScript::ProcessTreePreOrder(code_store::CEncParseNode*, std::function<bool ()> const&) [clone .part.0] ()
#3  0x00007f8313ea4956 in code_store::CEncEditScript::Execute(std::function<bool ()> const&) ()
#4  0x00007f8313e63189 in code_store::CEncRudeEditEngine::ComputeParseTreeEdits(std::shared_ptr<code_store::CEncParseTree> const&, std::shared_ptr<code_store::CEncParseTree> const&, std::function<bool ()> const&) ()
#5  0x00007f8313e5f853 in code_store::store_file_il_t::impl::diff_changes(code_store::il_scope_t*, unsigned long&, unsigned long&, std::deque<std::pair<code_store::record_id_t<code_store::item_tag_t>, code_store::code_item_kind_e>, std::allocator<std::pair<code_store::record_id_t<code_store::item_tag_t>, code_store::code_item_kind_e> > >&, code_store::store_event_listener&, std::shared_ptr<std::deque<std::shared_ptr<code_store::CEncEdit>, std::allocator<std::shared_ptr<code_store::CEncEdit> > > >&) ()
#6  0x00007f8313e5acf1 in code_store::store_file_il_t::update_store(long, std::chrono::duration<double, std::ratio<1l, 1l> >, code_store::store_event_listener*) ()
#7  0x00007f8313be719a in parser::update_file_if_needed(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool, bool, bool&, code_store::record_id_t<code_store::file_tag_t>&) ()
#8  0x00007f8313bbdd02 in browse_engine::parse_file(std::shared_ptr<workspace_folder_context> const&, char const*, code_store::record_id_t<code_store::file_tag_t> const&, std::unordered_set<code_store::record_id_t<code_store::file_tag_t>, std::hash<code_store::record_id_t<code_store::file_tag_t> >, std::equal_to<code_store::record_id_t<code_store::file_tag_t> >, std::allocator<code_store::record_id_t<code_store::file_tag_t> > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, parser&, std::function<void (bool)>&&, std::shared_ptr<browse_include_paths> const&, bool) ()
#9  0x00007f8313bc1875 in browse_engine::parse_root() ()
#10 0x00007f8313cb8c87 in cpptools_context::parse_root(bool) ()
#11 0x00007f8313cba162 in cpptools_context::handle_browse_engine_update(cpptools_context::browse_engine_update_action_and_task_token&&) ()
#12 0x00007f8313ceaf83 in std::_Function_handler<void (), thread_pool::enqueue<deque_thread<cpptools_context::browse_engine_update_action_and_task_token, false, 1ul>::defer(cpptools_context::browse_engine_update_action_and_task_token&&, thread_safe<deque_thread<cpptools_context::browse_engine_update_action_and_task_token, false, 1ul>::state, std::mutex>::safe_object<deque_thread<cpptools_context::browse_engine_update_action_and_task_token, false, 1ul>::state> const&)::{lambda()#1}, void>(deque_thread<cpptools_context::browse_engine_update_action_and_task_token, false, 1ul>::defer(cpptools_context::browse_engine_update_action_and_task_token&&, thread_safe<deque_thread<cpptools_context::browse_engine_update_action_and_task_token, false, 1ul>::state, std::mutex>::safe_object<deque_thread<cpptools_context::browse_engine_update_action_and_task_token, false, 1ul>::state> const&)::{lambda()#1}&&, std::future<void>*)::{lambda()#1}>::_M_invoke(std::_Any_data const&) ()
#13 0x00007f8313e4925e in thread_pool::do_work(unsigned long) ()
#14 0x00007f831482b2ef in msvc::thread_helper_t::thread_entry(void*) ()
#15 0x00007f8314853de6 in start ()
#16 0x00007f83134f0b30 in ?? ()
#17 0x0000000000000000 in ?? ()

I didn't dig enough to know the similarity but it seems to looks a lot like past issues marked as closed: #9428 #6454 #4129 #600

Configuration and Logs

I'm running with default configuration, right after installing the extension.

Other Extensions

No response

Additional context

No response

nikaiw avatar Feb 21 '24 01:02 nikaiw