Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when using @rspack/core API #3169

Open
Tracked by #4409
Nikaple opened this issue May 16, 2023 · 10 comments
Open
Tracked by #4409

Memory leak when using @rspack/core API #3169

Nikaple opened this issue May 16, 2023 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@Nikaple
Copy link

Nikaple commented May 16, 2023

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

screenshot

With webpack

screenshot-webpack

Reproduce link

No response

Reproduce Steps

  1. Create a project npm create rspack@latest
  2. Create a script to compile consecutively with @rspack/core
  3. 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)
@Nikaple Nikaple added bug Something isn't working pending triage The issue/PR is currently untouched. labels May 16, 2023
@Boshen Boshen added p1-important and removed pending triage The issue/PR is currently untouched. labels May 16, 2023
@Boshen Boshen self-assigned this May 16, 2023
@Boshen
Copy link
Contributor

Boshen commented May 16, 2023

Confirmed. How did you discover this? We don't normally import it as a package 🤔

@Nikaple
Copy link
Author

Nikaple commented May 16, 2023

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.

@stale
Copy link

stale bot commented Jul 17, 2023

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!

Copy link

stale bot commented Dec 15, 2023

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!

@stale stale bot added the stale label Dec 15, 2023
@pratyushseq
Copy link

bump!

@stale stale bot removed the stale label Jan 16, 2024
@Boshen Boshen removed their assignment Feb 5, 2024
Copy link

stale bot commented Apr 5, 2024

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!

@stale stale bot added the stale label Apr 5, 2024
@Nikaple
Copy link
Author

Nikaple commented Apr 25, 2024

bump

@h-a-n-a h-a-n-a removed the stale label Apr 25, 2024
@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Apr 25, 2024

@Nikaple I believe this issue has been mitigated:
image
But there's still some leaking problem with the Compiler and Compilation. It's under our investigation.

Copy link

stale bot commented Jun 24, 2024

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!

@stale stale bot added the stale label Jun 24, 2024
@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Jun 25, 2024

bump

@stale stale bot removed the stale label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants