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

VS Code: JavaScript heap out of memory #283

Open
shanlalit opened this issue May 16, 2024 · 7 comments
Open

VS Code: JavaScript heap out of memory #283

shanlalit opened this issue May 16, 2024 · 7 comments
Labels
bug Something isn't working vscode Issue that is specific to VSCode

Comments

@shanlalit
Copy link

Hi,

I have installed the latest version 1.0.1.

After installation, I open the stimulus controller and then the associated HTML.erb view of that controller. After a minute it the StimulusLSP server crash and gives below log in the output panel.

I have tried to increase the export NODE_OPTIONS="--max-old-space-size=5120", still it crash. I do have lot of Javascript files (legacy code with JQuery etc.) . Assuming it is parsing them all, can we set the specific folder(s) like javascript/controllers/ for StimulusLSP extension?

Here is the log from Output Panel:

<--- Last few GCs --->

[187504:0x2390002fc000] 83267 ms: Scavenge (reduce) 3935.0 (4064.7) -> 3934.5 (4064.9) MB, 10.87 / 0.00 ms (average mu = 0.492, current mu = 0.226) allocation failure;
[187504:0x2390002fc000] 84124 ms: Scavenge (reduce) 3935.5 (4065.2) -> 3935.1 (4065.2) MB, 849.67 / 0.00 ms (average mu = 0.492, current mu = 0.226) allocation failure;

<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
[Error - 10:55:51 AM] Server process exited with signal SIGABRT.
[Error - 10:55:51 AM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 10:55:51 AM] Connection to server got closed. Server will restart.
true
[Error - 10:55:51 AM] Stimulus LSP client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 10:55:51 AM] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
[Trace - 10:55:51 AM] Sending request 'initialize - (0)'.
Params: {
"processId": 186735,
"clientInfo": {
"name": "Visual Studio Code",
"version": "1.89.1"
},

@marcoroth
Copy link
Owner

Hey @shanlalit, thanks for reporting! I guess I have to somehow optimize when and how we analyze source files. I changed this behavior between 0.3.0 and 1.0.0 to be able to more accurately analyze the codebase, but I guess we need to be smarter about it.

Is there any way for you to downgrade to 0.3.0 in the meantime?

@marcoroth marcoroth added the bug Something isn't working label May 16, 2024
@shanlalit
Copy link
Author

shanlalit commented May 16, 2024 via email

@marcoroth
Copy link
Owner

Thanks for confirming, @shanlalit and sorry for the inconvenience!

@marcoroth marcoroth added the vscode Issue that is specific to VSCode label May 22, 2024
@swanson
Copy link

swanson commented Jun 6, 2024

Having the same issue (downgrading worked fine). We have ~150 controllers in the app

@joshuap
Copy link

joshuap commented Jun 9, 2024

Having the same issue (downgrading worked fine). We have ~150 controllers in the app

Also having this issue

Edit: not sure how to downgrade to 0.3.0 using nvim-lspconfig, since the NPM packages appear to be different?

@marcoroth
Copy link
Owner

Thanks for the feedback, and sorry for the trouble caused, friends! I guess I have to rework the way we are analyzing the codebase. I'll need to check out how other LSPs do the indexing, and if there's any way we can write some cache files to the disk to help with what we need to keep in memory.

@anhari
Copy link

anhari commented Oct 14, 2024

For those using neovim and Mason to install this, you can run :MasonInstall [email protected] to get up and running in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vscode Issue that is specific to VSCode
Projects
None yet
Development

No branches or pull requests

5 participants