[Bug]: Memory leak in 1.5.0
Version
System:
OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 26.86 GB / 31.28 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Browsers:
Chrome: 141.0.7390.65
npmPackages:
@rsbuild/core: 1.5.0 => 1.5.0
@rsbuild/plugin-react: ^1.4.1 => 1.4.1
@rsbuild/plugin-sass: ^1.4.0 => 1.4.0
@rsbuild/plugin-type-check: ^1.2.4 => 1.2.4
Details
We have an issue when running component tests with Cypress. The process will start consuming endless amounts of memory and then crash. This happens about 1 in 5 times. I managed to narrow it down to one package and version and that is @rsbuild/core: 1.5.0. The last version working is 1.4.16. I have also tried 1.5.16 and this behaves in the same way as 1.5.0.
We use cypress-rspack-dev-server to run our code during component testing.
I have tried to reduce the size of our project to create something smaller that i could share to reproduce. But i have not been able to do so and still recreate the error. I am unfortunately not able to share the whole repository.
I am in a bit of loss on how to proceed, I know this is very little to work with. Any help would be highly appreciated.
Reproduce link
could not reduce the project and still reproduce the error
Reproduce Steps
could not reduce the project and still reproduce the error
Could you try overriding the @rspack/core version to identify which Rspack release introduced this issue? Try setting it to v1.5.0-beta.0, v1.5.0-beta.1, or v1.5.0.
Hi, in order to test this i added "resolutions": { "@rspack/core": "1.5.0-beta.0" }, to package.json. verified that yarn.lock was updated according to the resolution.
I managed to reproduce the bug with all three versions of @rspack/core: v1.5.0-beta.0, v1.5.0-beta.1, v1.5.0.
Could you please try to reproduce the issue use https://github.com/web-infra-dev/rspack/pull/11927 and check the snapshot output?
This would confirm whether the memory leak is cause by rspack's global variables.
You can compile rspack using env ALLOCATIVE=1 pnpm run build:binding:profiling, and run dev using env RSPACK_ALLOCATIVE_DIR="$PWD/out/" rspack dev.