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

Update node-html-parser to fix a memory leak due to he dependency #28874

Closed
sushantdhiman opened this issue Sep 7, 2021 · 3 comments · Fixed by #37449
Closed

Update node-html-parser to fix a memory leak due to he dependency #28874

sushantdhiman opened this issue Sep 7, 2021 · 3 comments · Fixed by #37449
Labels
bug Issue was opened via the bug report template.

Comments

@sushantdhiman
Copy link

What version of Next.js are you using?

11.1.2

What version of Node.js are you using?

14.17.0

What browser are you using?

Firefox

What operating system are you using?

Arch Linux

How are you deploying your application?

custom server with docker container

Describe the Bug

While debugging a memory leak in my application, I discovered he module is contributing to memory leak.

Next.js is dependent upon [email protected] which has a memory leak due to he module. Upstream discussions

Expected Behavior

Next.js should update its node-html-parser dependency to latest 4.1.4, so this memory leak should not affect Next.js applications

To Reproduce

  1. Start your application with --inspectmode.
  2. Take heap snapshot
  3. Browser some pages (Not sure if this is related to next/image, but I was debugging a memory leak for that)
  4. Take a new heap snapshot, compare with first snapshot

Leak

@sushantdhiman sushantdhiman added the bug Issue was opened via the bug report template. label Sep 7, 2021
@huozhi
Copy link
Member

huozhi commented Sep 7, 2021

Hi @sushantdhiman are you using next build and next start to start the application?
Did you see any decreasing after the 2rd time (the 3rd, 4th) snapshots?

@sushantdhiman
Copy link
Author

Hi @huozhi

I am using next build then node --experimental-modules server/index.js (custom express server). Memory doesn't decrease for next snapshots.

Main memory leak in my application appears when I try to use any pages (SSR) that use next/image(using sharp), It seems memory references are never released by image optimization process. But I can't pin point where the issue is, I am still investigating.

During my investigation I discovered he module from node-html-parser is also leaking (but not the main culprit). I found some discussions related to memory leak in node-html-parser, so I am reporting that.

For now just updating node-html-parser is enough to close this issue. If I discovered real problem with next/image I will create a new issue or report here.

@shuding shuding mentioned this issue Jun 4, 2022
11 tasks
@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants