rspack
rspack copied to clipboard
Memory leak when using `@rspack/core` API
System Info
System:
OS: Linux
CPU: (16) x64 Intel(R) Xeon(R) Platinum 8255C CPU @ 2.50GHz
Memory: 19.11 GB / 31.10 GB
Container: Yes
Shell: 5.0.2 - /bin/zsh
Binaries:
Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
npmPackages:
@rspack/cli: latest => 0.1.10
@rspack/core: ^0.1.10 => 0.1.10
Details
With webpack
Reproduce link
No response
Reproduce Steps
- Create a project
npm create rspack@latest
- Create a script to compile consecutively with
@rspack/core
- Run the script to get memory leak
Script content:
const { rspack } = require('@rspack/core')
const config = require('./rspack.config')
function compile() {
const compiler = rspack(config);
return new Promise((resolve, reject) => {
compiler.run((err, stat) => {
if (err) {
return reject(err)
}
return resolve(stat)
})
})
}
async function main() {
await compile();
setTimeout(() => {
const memory = process.memoryUsage();
console.log(`Total memory used: ${Math.round(memory.rss / 1024 / 1024)} MB`)
main()
}, 1000);
}
main().catch(console.error)
Confirmed. How did you discover this? We don't normally import it as a package 🤔
I am currently in the process of migrating a complex build tool that is based on webpack. The tool has the ability to compile multiple projects simultaneously, utilizing webpack's core API. However, when attempting to migrate it to rspack, I encountered a persistent issue of the process being killed due to an OOM error.
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
bump!
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
bump
@Nikaple I believe this issue has been mitigated:
But there's still some leaking problem with the
Compiler
and Compilation
. It's under our investigation.
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
bump
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
The image says rsbuild, but it seems to be related to rspack itself
This happens with the following config
import { defineConfig } from "@rsbuild/core";
import { pluginSvgr } from "@rsbuild/plugin-svgr";
import { pluginBabel } from "@rsbuild/plugin-babel";
import { pluginReact } from "@rsbuild/plugin-react";
export default defineConfig({
plugins: [
pluginReact(),
pluginBabel({
include: /\.(?:jsx|tsx)$/,
babelLoaderOptions(opts) {
opts.plugins?.unshift("babel-plugin-react-compiler");
},
}),
pluginSvgr(),
],
html: {
template: "./index.html",
},
source: {
entry: {
index: "./src/index.tsx",
},
alias: {
"@": "./src",
"@lib": "./src/app/resources",
"@/*": "./src/*",
},
},
output: {
distPath: {
root: "build",
},
minify: {
css: true,
js: true,
},
},
dev: {
progressBar: true,
hmr: true,
watchFiles: {
paths: ["./index.html", "./src/**/*"],
},
},
server: {
port: 3000,
strictPort: true,
},
});