stimulus-lsp icon indicating copy to clipboard operation
stimulus-lsp copied to clipboard

VS Code: JavaScript heap out of memory

Open shanlalit opened this issue 9 months ago • 6 comments

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" },

shanlalit avatar May 16 '24 05:05 shanlalit

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 avatar May 16 '24 11:05 marcoroth

Thanks for acknowledging, I switched to 0.3 for now.

On Thu, 16 May, 2024, 5:15 pm Marco Roth, @.***> wrote:

Hey @shanlalit https://github.com/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?

— Reply to this email directly, view it on GitHub https://github.com/marcoroth/stimulus-lsp/issues/283#issuecomment-2115009720, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABU5YDGYKZJ3UCPZ6B3KLZCSL3ZAVCNFSM6AAAAABHZPGT42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGAYDSNZSGA . You are receiving this because you were mentioned.Message ID: @.***>

shanlalit avatar May 16 '24 16:05 shanlalit

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

marcoroth avatar May 17 '24 04:05 marcoroth

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

swanson avatar Jun 06 '24 15:06 swanson

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?

joshuap avatar Jun 09 '24 17:06 joshuap

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.

marcoroth avatar Jun 10 '24 16:06 marcoroth

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

anhari avatar Oct 14 '24 13:10 anhari