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

cpu usage 100% #594

Closed
ZiYang-oyxy opened this issue Dec 1, 2022 · 7 comments
Closed

cpu usage 100% #594

ZiYang-oyxy opened this issue Dec 1, 2022 · 7 comments
Labels
bug Something isn't working priority ⭐️ Triaged and deemed a priority

Comments

@ZiYang-oyxy
Copy link

ZiYang-oyxy commented Dec 1, 2022

bash-language-server version: Version is 3.3.1
node version: v18.12.1
mac os version: macOS 13.0.1 (22A400)

ps command output:

$ ps aux | grep node
USER               PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
xxxxxxxxxx    66718  99.1  5.3 420488816 890880   ??  R     9:59PM  12:34.32 node /opt/homebrew/bin/bash-language-server start

mac sample command output:

Analysis of sampling node (pid 66718) every 1 millisecond
Process:         node [66718]
Path:            /usr/local/bin/node
Load Address:    0x1024f0000
Identifier:      node
Version:         0
Code Type:       ARM64
Platform:        macOS
Parent Process:  node [66701]

Date/Time:       2022-12-01 21:59:19.541 +0800
Launch Time:     2022-12-01 21:59:04.006 +0800
OS Version:      macOS 13.0.1 (22A400)
Report Version:  7
Analysis Tool:   /usr/bin/sample

Physical footprint:         879.1M
Physical footprint (peak):  1.2G
Idle exit: untracked
----

Call graph:
    7572 Thread_411750   DispatchQueue_1: com.apple.main-thread  (serial)
    + 7572 start  (in dyld) + 2544  [0x19b683e50]
    +   7572 node::Start(int, char**)  (in node) + 604  [0x102579190]
    +     7572 node::LoadSnapshotDataAndRun(node::SnapshotData const**, node::InitializationResult const*)  (in node) + 368  [0x102578ec8]
    +       7572 node::NodeMainInstance::Run()  (in node) + 192  [0x1025e5128]
    +         7572 node::SpinEventLoop(node::Environment*)  (in node) + 244  [0x1024f56d4]
    +           7572 uv_run  (in node) + 380  [0x102ebc954]
    +             7558 uv__io_poll  (in node) + 1036  [0x102ece210]
    +             ! 7557 uv__async_io  (in node) + 320  [0x102ebc4c4]
    +             ! : 7548 uv__work_done  (in node) + 192  [0x102eb8d28]
    +             ! : | 7548 node::MakeLibuvRequestCallback<uv_fs_s, void (*)(uv_fs_s*)>::Wrapper(uv_fs_s*)  (in node) + 112  [0x1025a67b0]
    +             ! : |   7547 node::fs::AfterNoArgs(uv_fs_s*)  (in node) + 400  [0x1025af0ec]
    +             ! : |   + 7547 node::fs::FSReqCallback::Resolve(v8::Local<v8::Value>)  (in node) + 220  [0x1025aeb34]
    +             ! : |   +   7547 node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*)  (in node) + 204  [0x1025098ec]
    +             ! : |   +     7546 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context)  (in node) + 548  [0x1024f4fc8]
    +             ! : |   +     ! 7546 node::InternalCallbackScope::Close()  (in node) + 248  [0x1024f4c4c]
    +             ! : |   +     !   7546 v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*)  (in node) + 124  [0x1028444b0]
    +             ! : |   +     !     7546 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*)  (in node) + 336  [0x102843c18]
    +             ! : |   +     !       7546 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*)  (in node) + 64  [0x10281d548]
    +             ! : |   +     !         7546 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&)  (in node) + 88  [0x10281d36c]
    +             ! : |   +     !           7546 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&)  (in node) + 2692  [0x10281ce7c]
    +             ! : |   +     !             7546 Builtins_JSRunMicrotasksEntry  (in node) + 164  [0x102eda3a4]
    +             ! : |   +     !               7546 Builtins_RunMicrotasks  (in node) + 588  [0x102effc4c]
    +             ! : |   +     !                 7546 Builtins_PromiseFulfillReactionJob  (in node) + 56  [0x102f9c6f8]
    +             ! : |   +     !                   7546 ???  (in <unknown binary>)  [0x1075f2998]
    +             ! : |   +     !                     7546 Builtins_GeneratorPrototypeNext  (in node) + 144  [0x102f100d0]
    +             ! : |   +     !                       7544 ???  (in <unknown binary>)  [0x1075f6458]
    +             ! : |   +     !                       : 6422 ???  (in <unknown binary>)  [0x1075e7578]
    +             ! : |   +     !                       : | 6166 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + 6143 ???  (in <unknown binary>)  [0x107615684]
    +             ! : |   +     !                       : | + ! 6012 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + ! : 6012 ???  (in <unknown binary>)  [0x107615684]
    +             ! : |   +     !                       : | + ! :   6002 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + ! :   | 6002 ???  (in <unknown binary>)  [0x107615684]
    +             ! : |   +     !                       : | + ! :   |   6001 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + ! :   |   + 6001 ???  (in <unknown binary>)  [0x107615684]
    +             ! : |   +     !                       : | + ! :   |   +   6001 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + ! :   |   +     6001 ???  (in <unknown binary>)  [0x107615684]
    +             ! : |   +     !                       : | + ! :   |   +       6001 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + ! :   |   +         6001 ???  (in <unknown binary>)  [0x107615684]
    +             ! : |   +     !                       : | + ! :   |   +           6001 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + ! :   |   +             6001 ???  (in <unknown binary>)  [0x107615684]
    +             ! : |   +     !                       : | + ! :   |   +               6001 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + ! :   |   +                 6001 ???  (in <unknown binary>)  [0x107615684]
    +             ! : |   +     !                       : | + ! :   |   +                   6001 ???  (in <unknown binary>)  [0x1076129ec]
    +             ! : |   +     !                       : | + ! :   |   +                     6001 ???  (in <unknown binary>)  [0x107615684]

It looks like nested dead loops from the call trace

@ZiYang-oyxy
Copy link
Author

ZiYang-oyxy commented Dec 1, 2022

Update:

  1. I try both dense-analysis/ale and neoclide/coc.nvim will cause this issue
  2. This bug will disappear if I put the same shell source file to home path

@Shane-XB-Qian
Copy link
Contributor

1, is it possible to share that simple source file, let me try?
2, though i am using linux, do you have idea what cmd can do simliar thing like you mentioned sample cmd in linux?

// or let me do a guess, was that src file put in a symlink folder?

@BlaineEXE
Copy link

I'm also seeing high CPU usage from this plugin the past few days.

@skovhus skovhus added bug Something isn't working priority ⭐️ Triaged and deemed a priority labels Dec 3, 2022
@skovhus
Copy link
Collaborator

skovhus commented Dec 5, 2022

@ZiYang-oyxy @BlaineEXE sorry to hear but thank you for reporting this. I'm very curious what is causing this.

Can you try upgrading to the latest extension (1.19.0) and see if you can reproduce this? If you can, are you able to change the bashIde setting backgroundAnalysisMaxFiles to 0 instead of 500 and see if this improves the performance? Changing this means that we don't parse any files in the background. Does this reduce the CPU usage?

@ZiYang-oyxy
Copy link
Author

The bug is fixed after I upgrade to from 3.3.1 to 4.0.1.
In addition I didn't change the backgroundAnalysisMaxFiles

I'll watch for a few days to make sure the bug is fixed.

@skovhus
Copy link
Collaborator

skovhus commented Dec 9, 2022

Thanks! I'll close this for now, please reopen if you experience issues related to high CPU usage.

@skovhus
Copy link
Collaborator

skovhus commented Jan 7, 2023

Note that we have fixed a bug causing memory leaks and high CPU usage for workspaces with many files – this has been released as bash-language-server@4.2.5 and the vscode extension 1.26.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority ⭐️ Triaged and deemed a priority
Projects
None yet
Development

No branches or pull requests

4 participants