forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
947 stars 405 forks source link

Apex Extension not loading before it can be activated (high CPU usage) #2803

Closed V1JAYENDRA closed 2 years ago

V1JAYENDRA commented 3 years ago

:warning: Make sure to attach this file from your home-directory: :warning:`c:\Users\VRAJEN~1\AppData\Local\Temp\salesforce.salesforcedx-vscode-apex-unresponsive.cpuprofile.txt salesforce.salesforcedx-vscode-apex-unresponsive.cpuprofile.txt salesforce.salesforcedx-vscode-core-unresponsive.cpuprofile.txt

`

Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load

robertStrunk commented 3 years ago

I am also experiencing this issue as of late. The two extensions that are mentioned in the performance notifications are the Apex extension and the Salesforce CLI Integration extension.

VSCode Version: 1.51.1 (system setup) Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f Date: 2020-11-10T23:34:32.027Z Electron: 9.3.3 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Windows_NT x64 10.0.17763

Apex Extension Version 50.7.0 Salesforce CLI Integration Version 50.7.0

smaddox-sf commented 3 years ago

Hi @V1JAYENDRA - Can you attach the file noted in your original issue? We are investigating this and have work in progress (tracked under #2410). Some users experience these issues on some projects, so more information would certainly be helpful. The info here doesn't give us any more to go on. Information like the size of the project (number of files, number of objects, etc) as well as your machine specs would be helpful

hgolov commented 3 years ago

Just experienced the same issue. I tried attaching the log here, but it's 30MB and github rejected it. I'm working on a new org - we have about 10 - 15 ApexClasses, and 4 ApexTriggers. Nothing else in the dx project. I'm on Windows 10, running VSCode. image

pavithraMST commented 3 years ago

When I try to execute SFDX commands it is running for long time and no action is taken place. For example, if I execute sfdx: Authorize an org it is running for long time and no org is authorized. Issue Type: Performance Issue

When I try to execute SFDX commands it is running for long time and no action is taken place. For example, if I execute sfdx: Authorize an org it is running for long time and no org is authorized.

Extension version: 50.8.0 VS Code version: Code 1.52.0 (940b5f4bb5fa47866a54529ed759d95d09ee80be, 2020-12-10T22:45:11.850Z) OS version: Windows_NT x64 10.0.19041

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz (4 x 2195)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|7.92GB (1.46GB free)| |Process Argv|--crash-reporter-id 947b0e1f-28d0-438f-95bf-ec548e2ed63a| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 2 77 15932 code main 1 78 1420 window (Issue Reporter) 0 84 5968 window (undefined) 0 22 8364 crashpad-handler 0 73 12404 shared-process 0 36 13008 utility 3 480 20624 gpu-process 4 129 20712 window (Release Notes: 1.52.0 - trailhead - Visual Studio Code) 0 114 5564 extensionHost 0 62 7548 electron_node eslintServer.js 0 4 14088 C:\WINDOWS\system32\cmd.exe /d /s /c "sfdx ^"force:config:get^" ^"isvDebuggerSid^" ^"isvDebuggerUrl^" ^"--json^" ^"--loglevel^" ^"fatal^"" 0 6 16704 console-window-host (Windows internal process) 0 62 15212 electron_node visualforceServer.js 0 4 16280 C:\WINDOWS\system32\cmd.exe /d /s /c "sfdx ^"force:auth:web:login^" ^"--setalias^" ^"vscodeOrg^" ^"--instanceurl^" ^"https://login.salesforce.com^" ^"--setdefaultusername^"" 0 34 5384 "C:\Users\Praveen Premsagar\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\bin\node.exe" "C:\Users\Praveen Premsagar\AppData\Local\sfdx\client\7.82.0-3d0c527ac6\bin\sfdx.js" "force:auth:web:login" "--setalias" "vscodeOrg" "--instanceurl" "https://login.salesforce.com" "--setdefaultusername" 0 6 9388 console-window-host (Windows internal process) 0 63 16528 electron_node server.js 0 63 16896 "C:\Users\Praveen Premsagar\AppData\Local\Programs\Microsoft VS Code\Code.exe" "c:\Users\Praveen Premsagar\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=5564 0 64 18000 "C:\Users\Praveen Premsagar\AppData\Local\Programs\Microsoft VS Code\Code.exe" "c:\Users\Praveen Premsagar\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\html-language-features\server\dist\node\htmlServerMain" --node-ipc --clientProcessId=5564 0 28 18688 "C:\Program Files\Java\jdk1.8.0_121\bin\java" -cp "c:\Users\Praveen Premsagar\.vscode\extensions\salesforce.salesforcedx-vscode-apex-50.8.0\out\apex-jorje-lsp.jar" -Ddebug.internal.errors=true -Ddebug.semantic.errors=false -Ddebug.completion.statistics=false apex.jorje.lsp.ApexLanguageServerLauncher 0 6 12392 console-window-host (Windows internal process) 0 74 22224 electron_node server.js 0 13 19068 watcherService 0 6 5176 console-window-host (Windows internal process) ```
Workspace Info ``` | Window (Release Notes: 1.52.0 - trailhead - Visual Studio Code) | Folder (trailhead): 64 files | File types: json(11) ts(6) xml(3) html(2) js(2) eslintignore(1) | forceignore(1) gitignore(1) prettierignore(1) | prettierrc(1) | Conf files: launch.json(1) settings.json(1) jsconfig.json(1) | package.json(1) | Launch Configs: apex-replay; ```
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 openlogontheside:30221877 python763:30178808 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 python504:30227505 vswsl492cf:30211402 wsl2prompt:30224612 unusedpromptcf:30224611 folderexplorercf:30224615 openfilemenu:30224647 pythonvsded773cf:30236630 ```
smaddox-sf commented 3 years ago

Hi @hgolov and @pavithraMST - Thank you for providing additional information. When you experience the issue, is it all the time when you using the project? Or only when first opening it?

hgolov commented 3 years ago

I only had it once and it was when I loaded the project/window. Have a great day, Hadassa Golovenshitz

On Tue, Dec 15, 2020 at 6:37 PM smaddox-sf notifications@github.com wrote:

Hi @hgolov https://github.com/hgolov and @pavithraMST https://github.com/pavithraMST - Thank you for providing additional information. When you experience the issue, is it all the time when you using the project? Or only when first opening it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/forcedotcom/salesforcedx-vscode/issues/2803#issuecomment-745411038, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMAV4Q25I7FL2UCGGIT6A3SU6GFFANCNFSM4US6MJ5Q .

pavithraMST commented 3 years ago

I am facing all the time @smaddox-sf

robertStrunk commented 3 years ago

salesforce.salesforcedx-vscode-apex-unresponsive.cpuprofile.txt salesforce.salesforcedx-vscode-core-unresponsive.cpuprofile.txt

manjunathtj commented 3 years ago

Same issue. Takes a hell of lot of time to start and I need to start most times manually.

smaddox-sf commented 3 years ago

Thank you all for the additional details. We have some changes in flight to reduce the size of the extensions and reduce dependencies between them. This should help the start-up scenario in particular. We'll keep you posted as we release changes so you can let us know if it's improved. CC @lcampos

(This also relates to open issue #2410.)

jamessimone commented 3 years ago

@smaddox-sf is there a timeline for those in-flight changes going live?

smaddox-sf commented 3 years ago

HI @jamessimone and all - We released some changes in Dec and have more going out weekly over the next couple months. After some profiling and analysis, we believe the main root cause is the core extension size and some of the dependencies between the extensions. It's not quick to unravel some of this, but we are making progress. We'll post major updates here so you let us know if things are improving. Thanks to all who have shared data & details - extremely helpful!

jamessimone commented 3 years ago

@smaddox-sf thanks so much for the follow up. I appreciate it!

carlouni commented 3 years ago

I'm also having the same issue. My computer becomes unresponsive as a result.

Salesforce extension

v50.14.0

System info

OS: macOS Big Sur 11.1
Model Name: MacBook Pro
Model Identifier:   MacBookPro16,2
Processor Name: Quad-Core Intel Core i7
Processor Speed:    2.3 GHz
Number of Processors:   1
Total Number of Cores:  4
L2 Cache (per Core):    512 KB
L3 Cache:   8 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
PawelWozniak commented 3 years ago

This is still happening. I tried Sun JRE and Azul JRE on both the same issue. High CPU load for very long time. For me it is happening on two computers with the same large project open. Always after opening VSCode with that project.

jonathanwiesel commented 3 years ago

@smaddox-sf just for curiosity, is the speed increased been worked up using the Webpack extension bundling presented in VSCode v1.32?

lcampos commented 3 years ago

Hi @jonathanwiesel, we are doing different things to address the different performance issues with webpack being one of the tools being used but not limited to it. We are currently refactoring the extensions in order to cut down on our dependencies. We are also working on making some of those dependencies significantly smaller.

Some of the issues are related to the language servers and not the extensions themselves, so we are currently working on profiling them and testing new changes to make the code more efficient.

jonathanwiesel commented 3 years ago

Thank you for the detailed insight @lcampos, I can only feel excited about what is to come, seems like big changes that will make a lot of lives easier 😀

cywang16 commented 3 years ago

I probably face the same issue. Is there any work-around? Thanks.

ajw725 commented 3 years ago

also having problems with this on a new computer and trying to launch vs code for a large project. it seems like it's not just the apex extension, though. if i disable the whole extension pack and enable only the CLI integration, it still takes a really long time to load and uses a lot of CPU. sometimes it eventually loads (after maybe 50-60 seconds), but sometimes it doesn't.

i can't get a CPU profile because the "save extension host profile" button never becomes enabled/clickable.

smaddox-sf commented 3 years ago

Hi @ajw725 - Thanks for trying on the CPU profile and for all the project details on #3024. We've been working through changes that are helping with some performance issues. We're next profiling the language servers to find the bottlenecks with large projects to find other improvements we can make.

CRJain commented 3 years ago

salesforce.salesforcedx-vscode-apex-unresponsive.cpuprofile.txt

AissaDev commented 3 years ago

Its Ok for me , i have Remove and Reinstall the salesforceExtensionpack and delete .sfdx and .vscode variables from user folder (pc/c/username/) image

AissaDev commented 3 years ago

step one close vscode step two delete varaibles .sfdx et .vscode step three open vscode and install salesforce extendsion pack step four ctrl shift p (creat projet) ok

smaddox-sf commented 2 years ago

We have taken several steps to better optimize the Apex language server. From our internal testing & benchmarks, we see significant improvement. For large projects running on machines with limited horsepower, you can still see some latency & performance issues. (Documentation forthcoming that should help provide more guidance on what project size is suitable for different machine sizes.) We hope that the improvements have resolved most issues for most users, so I am closing this issue. Please open a new issue with details if you experience further Apex performance issues. Thank you to all who contributed information to help us diagnose the underlying causes!