rsbuild icon indicating copy to clipboard operation
rsbuild copied to clipboard

[Bug]: HMR Memory leak when saving rsbuild.config.ts multiple times

Open hussain-nz opened this issue 9 months ago • 4 comments

Version

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 27.91 GB / 39.39 GB
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.19041.3636
  npmPackages:
    @rsbuild/core: 0.6.13 => 0.6.13
    @rsbuild/plugin-eslint: 0.6.13 => 0.6.13
    @rsbuild/plugin-react: 0.6.13 => 0.6.13
    @rsbuild/plugin-type-check: 0.6.13 => 0.6.13

Details

Running dev server and changing the rsbuild.config.ts causes the memory to jump up 2-4gb at a time, eventually reaching the machine's maximum memory limit and slowing down HMR from 10 seconds to 1+ minutes. Attached a video to show this happening.

Reproduce link

Video attached

Reproduce Steps

  1. rsbuild dev
  2. Change rsbuild.config.ts multiple times
  3. Notice that memory for the rsbuild process is jumping up too much and reaching maximum after 5-10 file changes saved.

https://github.com/web-infra-dev/rsbuild/assets/157121643/bf6c7bad-3b66-4e91-b0f2-d0415a36c6d6

hussain-nz avatar May 09 '24 04:05 hussain-nz

Thanks for the report, we will try to reproduce and fix this.

chenjiahan avatar May 09 '24 08:05 chenjiahan

I can't confirm whether this problem is in both mac or win. On my mac, config reload is more obvious than hmr memory.

But there is no jump such as a one-time increase of 2-4GB.

image

SoonIter avatar Jun 08 '24 08:06 SoonIter

image Rsbuild v0.7.10 仅打开Webstorm运行一个前端项目 开发环境构建失败后再次使用npm工具重新构建,多次之后Node内存占用就10-20GB了,占用内存主要是运行的Rsbuild项目

TianJianJun0727 avatar Aug 09 '24 01:08 TianJianJun0727

Rsbuild v0.7.10 仅打开Webstorm运行一个前端项目 开发环境构建失败后再次使用npm工具重新构建,多次之后Node内存占用就10-20GB了,占用内存主要是运行的Rsbuild项目

This problem cannot be reproduced in my machine. Can you provide a minimum reproduction? Excluding the impact of webstorm or vscode, you can reproduce it on vscode.

SoonIter avatar Aug 09 '24 03:08 SoonIter

The same happens on my machine too, windows

ahqsoftwares avatar Oct 22 '24 17:10 ahqsoftwares

Image

ahqsoftwares avatar Oct 22 '24 17:10 ahqsoftwares

The same happens on my machine too, windows

hey, can you confirm that this happened after https://github.com/web-infra-dev/rsbuild/pull/3261 (1.0.1-beta.16)?

SoonIter avatar Oct 28 '24 03:10 SoonIter

The same happens on my machine too, windows

hey, can you confirm that this happened after #3261 (1.0.1-beta.16)?

I am currently at @rsbuild/core 1.0.17

Also, a discovery, removing watchFiles reduces the intensity of the memory leak

ahqsoftwares avatar Oct 28 '24 15:10 ahqsoftwares