vscode_deno: Frequent hangs, CPU spikes in LSP
Possibly related to https://github.com/denoland/deno/issues/20136
Recently I’m having frequent CPU spikes and the LSP hangs preventing me from interacting with the editor which is highly frustrating.
Output
Starting Deno language server...
version: 1.37.0 (release, x86_64-unknown-linux-gnu)
executable: /home/chris/.deno/bin/deno
Connected to "Visual Studio Code" 1.82.2
Auto-resolved configuration file: "file:///home/chris/dev/deno/kv-explorer/deno.json"
Setting import map defined in configuration file: "file:///home/chris/dev/deno/kv-explorer/deno.json"
Resolved import map: "file:///home/chris/dev/deno/kv-explorer/deno.json"
Enabling import suggestions for: https://deno.land
Download https://deno.land/.well-known/deno-import-intellisense.json
shutdown request received, shutting down
Starting Deno language server...
version: 1.37.0 (release, x86_64-unknown-linux-gnu)
executable: /home/chris/.deno/bin/deno
Connected to "Visual Studio Code" 1.82.2
Auto-resolved configuration file: "file:///home/chris/dev/deno/kv-explorer/deno.json"
Setting import map defined in configuration file: "file:///home/chris/dev/deno/kv-explorer/deno.json"
Resolved import map: "file:///home/chris/dev/deno/kv-explorer/deno.json"
Enabling import suggestions for: https://deno.land
exit notification received, stopping
Server ready.
client asked to cancel request 11, but no such pending request exists, ignoring
client asked to cancel request 12, but no such pending request exists, ignoring
client asked to cancel request 3, but no such pending request exists, ignoring
client asked to cancel request 4, but no such pending request exists, ignoring
client asked to cancel request 1, but no such pending request exists, ignoring
client asked to cancel request 2, but no such pending request exists, ignoring
successfully cancelled request with ID: 21
successfully cancelled request with ID: 22
client asked to cancel request 19, but no such pending request exists, ignoring
client asked to cancel request 20, but no such pending request exists, ignoring
successfully cancelled request with ID: 23
successfully cancelled request with ID: 24
successfully cancelled request with ID: 27
successfully cancelled request with ID: 28
Unable to send result to client.
Unable to send result to client.
Unable to send result to client.
Unable to send result to client.
Unable to send result to client.
Unable to send result to client.
client asked to cancel request 29, but no such pending request exists, ignoring
client asked to cancel request 30, but no such pending request exists, ignoring
successfully cancelled request with ID: 35
successfully cancelled request with ID: 36
successfully cancelled request with ID: 37
successfully cancelled request with ID: 38
successfully cancelled request with ID: 43
successfully cancelled request with ID: 44
successfully cancelled request with ID: 45
Unable to send result to client.
Unable to send result to client.
Unable to send result to client.
Unable to send result to client.
successfully cancelled request with ID: 42
client asked to cancel request 34, but no such pending request exists, ignoring
successfully cancelled request with ID: 48
Unable to send result to client.
Unable to send result to client.
Unable to send result to client.
Unable to send result to client.
client asked to cancel request 47, but no such pending request exists, ignoring
Unable to send result to client.
successfully cancelled request with ID: 52
Unable to send result to client.
successfully cancelled request with ID: 66
Unable to send result to client.
The editor will hang and eventually spit out a number of output lines, sometimes 2 (“successfully…” and “Unable…”) sometimes more.
Versions
vscode: 1.82.2 deno: 1.37.0 extension: occurs on both the latest 3.24.0 and the previous version (3.23.1?) os: Linux Mint 21
About this issue
- Original URL
- State: open
- Created 9 months ago
- Reactions: 3
- Comments: 75 (10 by maintainers)
Based on the above, I’ve disabled the code lens with the following added to my workspace
settings.json
file:And wow! I can finally navigate quickly with no hangs. Types show up instantly when hovering. Clearly my issue is around the code lens. Very early days, but I’ll leave it disabled for now and report back if it doesn’t fully “fix” my issue. Happy to turn it back on if any additional testing is required.
You can, disabling
dist
folder is an exemplary use case!Same here on Win 11. Renaming or moving a file causes LSP to hang for quite some time, then pops up an error about OOM, and shutting down! I’ve seen the same list of messages as above.
This is an inexpensive HP laptop with non-upgradable 8Gig memory. Started happening when Deno Upgrade to v1.37.0.
Also the laptop fan gets very load when this happens! I’ve never heard the fan on this new machine prior to this.
deno 1.37.0 (release, x86_64-pc-windows-msvc) v8 11.8.172.3 typescript 5.2.2
Thanks @cknight this is really useful. You’re not the first person to described having such a slow down after leaving the editor open for a while. We’ll definitely look into that, starting with adding a way to connect an V8 inspector to a running LSP instance.
Thanks for the updates. Please watch for https://github.com/denoland/deno/pull/21447 as well that should further improve the situation.
Deno Language Server Status
Workspace Settings
Workspace Details
Documents in memory: 542
Performance measures: 1147
Performance
No worries @cknight, thanks for pointing this out. We established that the problematic part is “get_navigation_tree” which is actually called when “codeLens” option is on. We’re still trying to figure out why it is so slow (40 line file takes ~80ms to compute that on beefy M1 Max CPU). Could you share that specific file you opened and tell what’s your CPU?
We’ll keep this thread posted.
https://github.com/denoland/vscode_deno/assets/1248238/72a7090c-171e-4bbc-acee-6e8bfc866850
@bartlomieju It’s a simple vanilla HTML demo app for a POC DB-Cache. On first use, this app loads an IDB with 100k user records from the json file. Deno is only used for my dev-server
Hot
https://github.com/nhrones/BuenoCacheBy the way I never enable
code-lens
, But I could if it would help with testing.I can confirm this fixed the problem for me. I removed the disablePaths settings. Restarted VS Code, then renamed the 8.4b MB json file. I saw a popup for a very short time, and everything was okay. Then, I actually moved the file to another folder, and got another popup for a short while. Again.All was fine. Nice Work! I know you all struggled with this.
On Thu, Nov 30, 2023 at 5:18 PM Bartek Iwańczuk @.***> wrote:
We have developed a potential fix for this problem and are currently investigating it. If we feel confident enough that it alleviates the problem we will cut a hot-fix Deno v1.38.4 release dedicated to this problem.
This fix could also help with https://github.com/denoland/vscode_deno/issues/895.
@cknight After applying “editor.codeLens”: false, everything in VSCode is fast and crisp on my slow laptop. Thanks for this!
For the record I don’t think that’s so many it would cause the problems mentioned in this issue – I wouldn’t put too much stock in my theory above.
The old std version is used by esbuild_deno_loader 0.6.0.
deno info main.ts
will print your dependency tree, including sizes, etc.