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

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

Closed
alok8bb opened this issue Apr 17, 2024 · 10 comments · Fixed by #26868
Closed

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

alok8bb opened this issue Apr 17, 2024 · 10 comments · Fixed by #26868
Assignees
Labels
lsp related to the language server perf performance related

Comments

@alok8bb
Copy link

alok8bb commented Apr 17, 2024

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
Copy link
Member

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

@alok8bb
Copy link
Author

alok8bb commented Apr 18, 2024

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

image

@bartlomieju
Copy link
Member

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.

@nathanwhit nathanwhit added the lsp related to the language server label Apr 18, 2024
@alok8bb
Copy link
Author

alok8bb commented Apr 18, 2024

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
Copy link
Author

alok8bb commented Apr 18, 2024

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

@nayeemrmn
Copy link
Collaborator

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
Copy link
Author

alok8bb commented Apr 18, 2024

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
Copy link
Collaborator

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

@alok8bb
Copy link
Author

alok8bb commented Apr 18, 2024

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
Copy link
Collaborator

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.

@nayeemrmn nayeemrmn self-assigned this Apr 21, 2024
@lucacasonato lucacasonato added the perf performance related label Jun 8, 2024
bartlomieju added a commit that referenced this issue Nov 15, 2024
Instead of using the default 1.4Gb limit (which was meant for browser
tabs) configure V8 to
set the heap limit to the amount of memory available in the system.

Closes #23424
Closes #26435
Closes #21226
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsp related to the language server perf performance related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants