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

[Bug]: False positive memory leak when running with --experimental-vm-modules and using --detectLeaks #14649

Closed
enisdenjo opened this issue Oct 27, 2023 · 7 comments

Comments

@enisdenjo
Copy link

Version

^29.7.0

Steps to reproduce

  1. Clone enisdenjo/jest-fetch-leak repo
  2. Read its readme for local repro

Expected behavior

No leak. Or at least consistent behaviour between CJS and ESM.

Actual behavior

Leaks in ESM, doesn't leak in CJS.

Additional context

Exact same test leaks with:

node --experimental-vm-modules node_modules/jest/bin/jest.js --detectLeaks

but doesn't leak with:

node node_modules/jest/bin/jest.js --detectLeaks

Environment

ubuntu-latest from GitHub Actions
@enisdenjo enisdenjo changed the title [Bug]: False positive memory leak with native fetch when running with --experimental-vm-modules and using --detectLeaks [Bug]: False positive memory leak when running with --experimental-vm-modules and using --detectLeaks Oct 27, 2023
@enisdenjo
Copy link
Author

Seems like it's not only Jest, I've implemented the leak detector and tested pure Node (https://github.com/enisdenjo/node-leak). Running an ESM script in the vm leaks, while CJS script doesn't. 🤔

@SimenB
Copy link
Member

SimenB commented Oct 30, 2023

See #14526 and its linked upstream Node comment (about how it's not really possible to create a good leak detector from JS). Dunno if it helps in this case - the point is more that it's inherently not possible to get 100% precise.

Node has had some ESM vm API leak fixes recently (nodejs/node#48510), not sure if those help?.


Might be worth opening an issue upstream and pinging @joyeecheung with your minimal version without Jest.

@enisdenjo
Copy link
Author

Opened an issue with Node (nodejs/node#50964). Let's see.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Dec 29, 2023
Copy link

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

1 similar comment
Copy link

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants