denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.16k stars 5.4k forks source link

Deno LSP crashing/freezing on a specific project on versions after 1.41.3 #23424

Closed alok8bb closed 2 weeks ago

alok8bb commented 7 months ago

Version: Deno 1.42.0 or higher

Hello! I have a Deno project, more specifically a telegram bot written with @grammyjs, where the LSP works fine with Deno v1.41.3 or earlier, but with version 1.42.0 or later, the LSP freezes. It crashed once, but mostly on LSP restart, it times out.

On start it takes too long at this message on the screen. Loads up after few seconds but with the auto-completion either not working or being very slow. image

The one time it crashed, I managed to get a screenshot of the logs: image Since the crash was an OOM, I think it might be a memory leak of some sorts

In other project using the same library, LSP works fine with even the newer versions. Unfortunately the project source is private, but I'm open to suggestions about what I can do to narrow down the source of the problem to help create a minimal reproduction.

Here's the output of deno info for the main file: https://gist.github.com/alok8bb/895db8e90857dc3a7bc5eeaa93d3b88f

bartlomieju commented 7 months ago

Do you have many files in your project? Can you show the output of Deno: Language Server Status tab in VScode?

alok8bb commented 7 months ago

Project contains around 13 Typescript files, output upon clicking the Deno button on bottom right of the screen after opening the project:

image

bartlomieju commented 7 months ago

Do you have many dependencies? Running into OOM error suggests that you might have a lot of dependencies that are too much to handle. You can tweak "deno.maxTsServerMemory" setting to a greater value (eg. 4096) to try and prevent the error.

alok8bb commented 7 months ago

Its a fairly simple project, I don't think it has enough dependencies to overwhelm the LSP and since LSP works perfectly fine on the older versions of Deno so surely issue is somewhere else.

I tried tweaking "deno.maxTsServerMemory" that didn't help.

And the dependencies are listed here with deno info: https://gist.github.com/alok8bb/895db8e90857dc3a7bc5eeaa93d3b88f

alok8bb commented 7 months ago

Also OOM crash happened only once and I couldn't reproduce it but the LSP is freezing for versions after 1.41.3

nayeemrmn commented 7 months ago

The timeout on restart happens often when you try to restart while the server is initiailzing.

On the latest version, try restarting the VSCode window and waiting till it says Server ready in the output window. Does it work after that? Does it take longer to initialize than previous versions?

alok8bb commented 7 months ago

On the latest Deno version, after restarting the VSCode window it instantly starts and says Server ready, same with the previous versions.. but with the latest version after Server ready the auto-complete suggestions still take around 5-7 seconds to load and overall LSP is just slow.

nayeemrmn commented 7 months ago

Can you try on deno upgrade --canary to test against latest lsp patches?

alok8bb commented 7 months ago

Tried canary version, seems same.

I'm attaching a video showcasing the issue, sorry its a bit lengthy but canary, latest and working versions shown here. https://www.youtube.com/watch?v=s4uoJ9ZOJn0

nayeemrmn commented 7 months ago

I'm attaching a video showcasing the issue, sorry its a bit lengthy but canary, latest and working versions shown here. https://www.youtube.com/watch?v=s4uoJ9ZOJn0

In your video, it didn't say Server ready before you tried to restart. Though we can clearly see 1.41.3 finished initializing much faster... it might be because the client was late dealing with the last server.