question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storybook manager dev-server leaks memory during hot refresh.

See original GitHub issue

Describe the bug When using storybook in development mode, I’ve noticed that the amount of memory the node process uses increases with every change made to my react components. After doing some memory profiling, it appears to be that webpack-dev-middleware is writing to memory all of the data of the files made by storybook’s temporary cache (located under node_modules/.cache after every hot reload, without clearing out previously made entries.

Storybook is using a hash for its filenames in this cache instead of a static file name, causing webpack-dev-middleware to write the newly generated files’ data to memory after each hot refresh. This should be changed to a static filename. See the following: https://github.com/storybookjs/storybook/blob/next/lib/core/src/server/manager/manager-webpack.config.ts#L56 https://github.com/webpack/webpack/issues/10796#issuecomment-620844831

While the manager does have writeToDisk: true set, this does not prevent webpack-dev-middleware from writing to memory: https://github.com/webpack/webpack-dev-middleware#writetodisk

To Reproduce

  1. Start storybook up in dev mode while using node --inspect.
  2. Make a change to any react components, then check node’s memory usage.

Expected behavior The main process for running storybook in dev mode doesn’t leak memory.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
shilmancommented, Mar 20, 2021

Yowza!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-rc.5 containing PR #14264 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there’s still more to do.

0reactions
shilmancommented, Apr 1, 2021

Fixed in #14284 released in 6.2

npx sb ugprade
Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack's Hot Module Replacement Feature Explained
When a hot update failed to replace the code in the browser, the HMR runtime will let webpack-dev-server know. The webpack-dev-server will then ......
Read more >
Storybook webpack repeatedly rebuilding (hot reloading over ...
I am using Storybook for a NextJS project and when I run it, it keeps rebuilding over and over and never stops. My...
Read more >
New Features Release Notes - Ocean Networks Canada
Rebuild Data Preview Management page with react; Support multiple ... fix memory leak on logger, fix telnet console issue with RBR BPRs.
Read more >
Fulcro Developers Guide
(ns book.example-1 (:require [com.fulcrologic.fulcro.components :as comp ... It also has hot-code (and CSS) reload built in, so there is no need for any ......
Read more >
Third Party Software | Confluent
Third Party Software included in Confluent Platform 7.3 ... "Java Concurrency in Practice" book annotations, CC-BY-2.5 ... better-queue-memory, MIT.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found