vuestorefront / vsf-capybara

Capybara is a Storefront UI based theme for Vue Storefront. Always Open Source, MIT license. Made with :green_heart: by Vue Storefront.
https://capybara.storefrontcloud.io/
MIT License
154 stars 84 forks source link

Memory increases after each page reload. #419

Open one1note opened 4 years ago

one1note commented 4 years ago

Current behavior

Memory is never released and thus memory usage keeps increasing after each page reload. In the default VSF theme the template imports are tagged with webpackChunkName and thus dynamically imported, in the Capybara theme however the imports are missing the webpackChunkName comment, which seems to cause the memory leak.

Expected behavior

GC reclaims unused memory.

Steps to reproduce the issue

  1. Install the latest VSF with the Capybara theme in Docker.
  2. Run, configure and import the demo data set
  3. Run 'docker stats'
  4. Browse to your vsf instance and keep reloading the page.
  5. You should see the memory usage of your vsf container increase with each reload.

Can you handle fixing this bug by yourself?

Environment details

Additional information

psmyrek commented 4 years ago

@one1note In which mode did you run VSF with Capybara theme: in development or production mode?

one1note commented 4 years ago

@psmyrek In production mode

psmyrek commented 4 years ago

Capybara theme uses multiple webpackChunkName annotations for pages (they are configured in router/index.js) and for other components (cart, search panel).

I've checked latest VSF with default theme and with Capybara theme and memory issue exists in both installation, in production mode, so this suggests that problem is somewhere else - outside Capybara theme, or even outside VSF - in external lib. This needs to be investigated.

VSF with default theme

default-theme

VSF with Capybara theme

capybara-theme

In both test cases Homepage was reloaded every 2-3 seconds.

gorbunovav commented 2 years ago

We've found that the main reason for memory leaks in our case was this change: https://github.com/vuestorefront/vsf-capybara/pull/45#discussion_r365103985