pwa-kit
pwa-kit copied to clipboard
[BUG] local dev js memory heap issue
Summary
When making multiple changes to pwa kit project i am getting JS heap out of memory issue using Node 18.17 & pwa kit 2.7.3
Steps To Reproduce
Expected result
Describe what should have happened.
Actual result
Describe what actually happened.
System Information (as applicable)
Browser: chrome Node version: 18.17.0 pwa-kit version: 2.7.3 Desktop OS: windows 10 Mobile Device Info:
Additional information
@joeluong-sfcc Can you take this? We need to verify whether this big you fixed here exists prior to v3. I suspect it's always been there. We will need to back port this fix to 2.x and release 2.7.4. I'm going to assign you if you can please discuss with the team and help recommend next steps
https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1391
Sure I can take this, although this may be an unrelated issue. @subashpenneru could you try upgrading your PWA Kit version to v2.7.4-preview.0 and checking to see if you still see this issue? If this does not resolve the issue, would you be able to provide a brief description of the changes you're making or steps to reproduce?
hi @joeluong-sfcc
I didn't find any branch or tags with v2.7.4-preview.0, please share the link.
steps to reproduce - start the application make some code changes (components template / js logic changes) save and check the hot reloading it works for one or two times, but next time if i make code changes and save it throws js heap memory issue. using node 18.17 & pwa kit 2.7.3
observed same issue with node 16 + pwa kit 2.7.0
Desktop OS: Windows 10
if i use node 14.19 with pwa kit 2.7.0 / 2.7.3 it is working fine, no issues with hot reloading or page refresh.
Thank you for sharing more details @subashpenneru. Here's that link: https://www.npmjs.com/package/pwa-kit-dev/v/2.7.4-preview.0
upgraded pwa kit version to v2.7.4-preview.0, still I am getting that heap memory error.
This issue has been linked to a new work item: W-13942827
@subashpenneru Thanks for confirming, we're tracking this bug in our work backlog and we'll follow up whenever we have new information
Just to add that this issue is also happening in the version 3.1.0 of pwa-kit with node 18.12.0 and npm 8.19.2.
cc @joeluong-sfcc
@axciccu seeing the same on our end, we will continue to work on this
Hello
I have the issue with node version 18.16.0 and pwa kit 3.1.1. Is there a workaround ?
We've done a bit of work investigating this issue. Here's a summary of the findings and what we've done:
Reduced Javascript Heap Size Ramp Up #1535
This PR does not fix the heap size issue but helps prevent the issue from occurring as frequently. This PR contains small code snippets that reproduce the memory leak issue. We had a hunch that there existed a memory leak issue existed in node itself. In the PR, we discovered that upgrading to node 20 resolves the memory leak issue that we were seeing where running the sample code snippets would not result in a heap out of memory error. However, after testing a generated project with node 20, we unfortunately discovered that the memory leak still exists somewhere outside of node in an underlying dependency. We've added support for node 20 with this PR: https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1612, so hopefully this should reduce the frequency of crashes.
TL;DR: The memory leak issue still exists, but upgrading to node 20 should help mitigate the issue.
@joeluong-sfcc with the minimal setup this approach fixes completely the memory leak.
I haven't tried yet restoring the deleted files outside the node_modules but if the memory leak returns this means that there is a memory leak also in the basic project setup outside the node modules in some way. But I hope that we are at least at the half of the solution.
Node 20 does absolutely nothing to help with this memory overflow. The dev environment crashes every 5/6 file saves (and relative hot reloads) making it impossible to properly work with PWA Kit.
This should be a critical issue. cc @joeluong-sfcc
Thanks for letting us know @Giuseppetm, it's still on our radar.
@joeluong-sfcc Any updates on this ? I am getting this as well and it's a bit annoying to re-run the dev server as it keeps happening
@ortegarenzy No, there are currently no updates for this item
It's been over 2 years since this issue was reported, still no updates here. I repeat that this should be a critical issue. cc @joeluong-sfcc