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

server.js has high CPU usage on MacOS #638

Closed
BlaineEXE opened this issue Dec 19, 2022 · 11 comments
Closed

server.js has high CPU usage on MacOS #638

BlaineEXE opened this issue Dec 19, 2022 · 11 comments
Labels
bug Something isn't working priority ⭐️ Triaged and deemed a priority question Further information is requested

Comments

@BlaineEXE
Copy link

I'm seeing server.js have very high CPU usage on MacOS. It's reportedly using 2.5 CPU cores on my 6-core i7 processor.

❯ ps aux | grep 9478
blaine            9478 276.8 16.8 82455348 2824148   ??  R     9:35AM   4:41.76 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/blaine/.vscode/extensions/mads-hartmann.bash-ide-vscode-1.23.0/out/server.js --node-ipc --clientProcessId=9334
@skovhus
Copy link
Collaborator

skovhus commented Dec 23, 2022

Thanks for reporting this. I'm puzzled and would love to figure out what is going on. Can you share some output from the extension (View -> Output -> Bash IDE) while this is ongoing?

@skovhus
Copy link
Collaborator

skovhus commented Dec 26, 2022

Is the high CPU usage only when the extension starts, while typing or also when inactive?

And does it change anything if you open a small workspace with few files compared to opening a large workspace (e.g. home directory)?

@skovhus
Copy link
Collaborator

skovhus commented Jan 5, 2023

@BlaineEXE Do you have shellcheck installed?

A new version [email protected] has just been released, introducing a short execution delay and debouncing for ShellCheck tasks.

Let me know if the new version works for you.

@BlaineEXE
Copy link
Author

Just was able to test this, I'm still seeing the issue.

blaine           32515 278.1  5.5 82455396 916404   ??  R    11:59AM   1:12.51 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/blaine/.vscode/extensions/mads-hartmann.bash-ide-vscode-1.25.0/out/server.js --node-ipc --clientProcessId=18651

@skovhus skovhus added the bug Something isn't working label Jan 5, 2023
@skovhus
Copy link
Collaborator

skovhus commented Jan 5, 2023

Thanks. Not sure if you saw the previous questions, but it would be helpful if you have time to answer them: #638 (comment)

Do you have shellcheck installed?

@skovhus skovhus added the priority ⭐️ Triaged and deemed a priority label Jan 5, 2023
@skovhus
Copy link
Collaborator

skovhus commented Jan 5, 2023

I can reproduce high CPU usage if I open a workspace for a sub folder with many files, like my home folder.

@BlaineEXE
Copy link
Author

Thanks. Not sure if you saw the previous questions, but it would be helpful if you have time to answer them: #638 (comment)

Do you have shellcheck installed?

Apologies. I was hasty.

I have shellcheck 0.9.0 installed; the latest.

I have 3 projects with many bash scripts in them. If I close all shell script files in all workspaces, I still see the high CPU usage.

@BlaineEXE
Copy link
Author

[Info  - 9:59:37 AM] BashLanguageServer initializing...
[Info  - 9:59:37 AM] BashLanguageServer initialized
Configuration loaded from client
BackgroundAnalysis: resolving glob "**/*@(.sh|.inc|.bash|.command)" inside "file:///Users/blaine/development/dev-rook-ceph"...
ShellCheck: running "shellcheck --shell=bash --format=json1 --external-sources --source-path=file:///Users/blaine/development/dev-rook-ceph --source-path=/Users/blaine/development/dev-rook-ceph/scripts/cluster"
onDocumentSymbol
onDocumentSymbol
onDocumentSymbol
BackgroundAnalysis: Glob resolved with 500 files after 2.309 seconds
BackgroundAnalysis: Completed after 12.071 seconds.
onDocumentSymbol
onDocumentSymbol

<--- Last few GCs --->

[18862:0x7fd8b0200000]   301580 ms: Scavenge 3880.6 (4087.4) -> 3874.3 (4087.4) MB, 4.6 / 0.0 ms  (average mu = 0.063, current mu = 0.014) task; 
[18862:0x7fd8b0200000]   301606 ms: Scavenge 3880.6 (4087.4) -> 3875.1 (4087.9) MB, 7.2 / 0.0 ms  (average mu = 0.063, current mu = 0.014) task; 
[18862:0x7fd8b0200000]   301629 ms: Scavenge 3881.3 (4087.9) -> 3875.7 (4088.4) MB, 6.3 / 0.0 ms  (average mu = 0.063, current mu = 0.014) task; 


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x11a9ba855 node::FatalException(v8::Isolate*, v8::TryCatch const&) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 2: 0x11a9ba9f9 node::OnFatalError(char const*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 3: 0x11557b093 v8::internal::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 4: 0x11557af6f v8::internal::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 5: 0x11573df45 v8::internal::Heap::StartIncrementalMarking(int, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 6: 0x115742586 v8::internal::Heap::MoveRange(v8::internal::HeapObject, v8::internal::CompressedObjectSlot, v8::internal::CompressedObjectSlot, int, v8::internal::WriteBarrierMode) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 7: 0x11573e5d2 v8::internal::EmbedderStackStateScope::~EmbedderStackStateScope() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 8: 0x11573b2d6 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 9: 0x1157e2d0b v8::internal::GlobalSafepointScope::~GlobalSafepointScope() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x11aa2d276 node::CommonEnvironmentSetup::context() const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
11: 0x11aa2be05 node::CommonEnvironmentSetup::context() const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
12: 0x11444d81f uv_async_send [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
13: 0x11445fc76 uv_free_interface_addresses [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
14: 0x11444dc30 uv_run [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
15: 0x1146166e6 v8::CodeEvent::GetFunctionName() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
16: 0x11446044d ElectronInitializeICUandStartNode [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
17: 0x10ba2052e 
[Info  - 10:04:42 AM] Connection to server got closed. Server will restart.
[Info  - 10:04:43 AM] BashLanguageServer initializing...
[Info  - 10:04:43 AM] BashLanguageServer initialized
Configuration loaded from client
BackgroundAnalysis: resolving glob "**/*@(.sh|.inc|.bash|.command)" inside "file:///Users/blaine/development/dev-rook-ceph"...
onDocumentSymbol
onDocumentSymbol
BackgroundAnalysis: Glob resolved with 500 files after 0.241 seconds
ShellCheck: running "shellcheck --shell=bash --format=json1 --external-sources --source-path=file:///Users/blaine/development/dev-rook-ceph --source-path=/Users/blaine/development/dev-rook-ceph/scripts/cluster"
BackgroundAnalysis: Completed after 1.402 seconds.


# ...

<--- Last few GCs --->

[80684:0x7fbd54600000]   256891 ms: Scavenge 3881.1 (4087.1) -> 3874.9 (4087.1) MB, 4.6 / 0.0 ms  (average mu = 0.204, current mu = 0.075) task; 
[80684:0x7fbd54600000]   256914 ms: Scavenge 3880.7 (4087.1) -> 3875.4 (4087.9) MB, 6.6 / 0.0 ms  (average mu = 0.204, current mu = 0.075) task; 
[80684:0x7fbd54600000]   256939 ms: Scavenge 3881.9 (4087.9) -> 3876.0 (4088.1) MB, 6.4 / 0.0 ms  (average mu = 0.204, current mu = 0.075) task; 


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x11d059855 node::FatalException(v8::Isolate*, v8::TryCatch const&) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 2: 0x11d0599f9 node::OnFatalError(char const*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 3: 0x117c1a093 v8::internal::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 4: 0x117c19f6f v8::internal::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 5: 0x117ddcf45 v8::internal::Heap::StartIncrementalMarking(int, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 6: 0x117de1586 v8::internal::Heap::MoveRange(v8::internal::HeapObject, v8::internal::CompressedObjectSlot, v8::internal::CompressedObjectSlot, int, v8::internal::WriteBarrierMode) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 7: 0x117ddd5d2 v8::internal::EmbedderStackStateScope::~EmbedderStackStateScope() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 8: 0x117dda2d6 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 9: 0x117e81d0b v8::internal::GlobalSafepointScope::~GlobalSafepointScope() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x11d0cc276 node::CommonEnvironmentSetup::context() const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
11: 0x11d0cae05 node::CommonEnvironmentSetup::context() const [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
12: 0x116aec81f uv_async_send [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
13: 0x116afec76 uv_free_interface_addresses [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
14: 0x116aecc30 uv_run [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
15: 0x116cb56e6 v8::CodeEvent::GetFunctionName() [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
16: 0x116aff44d ElectronInitializeICUandStartNode [/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
17: 0x10e0bf52e 
[Info  - 7:35:40 PM] Connection to server got closed. Server will restart.
[Info  - 7:35:40 PM] BashLanguageServer initializing...
[Info  - 7:35:40 PM] BashLanguageServer initialized
Configuration loaded from client
BackgroundAnalysis: resolving glob "**/*@(.sh|.inc|.bash|.command)" inside "file:///Users/blaine/development/dev-rook-ceph"...
BackgroundAnalysis: Glob resolved with 500 files after 0.218 seconds
BackgroundAnalysis: Completed after 2.26 seconds.

@skovhus
Copy link
Collaborator

skovhus commented Jan 7, 2023

We have fixed a bug causing memory leaks and high CPU usage for workspaces with many files – this has been released as [email protected] and the vscode extension 1.26.0. Can you confirm that this solves the issue for now?

@skovhus skovhus closed this as completed Jan 7, 2023
@BlaineEXE
Copy link
Author

Seems to be fixed now. Thanks! 🙏

@skovhus
Copy link
Collaborator

skovhus commented Jan 10, 2023

Thanks for testing this!

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 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants