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

dev server warning of a memory leak #50909

Closed
1 task done
Josehower opened this issue Jun 7, 2023 · 4 comments
Closed
1 task done

dev server warning of a memory leak #50909

Josehower opened this issue Jun 7, 2023 · 4 comments
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked

Comments

@Josehower
Copy link
Contributor

Josehower commented Jun 7, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103
    Binaries:
      Node: 20.2.0
      npm: 9.6.6
      Yarn: 1.22.19
      pnpm: 8.5.1
    Relevant packages:
      next: 13.4.4-canary.0
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.4

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://codesandbox.io/p/sandbox/next-memory-leak-reproduction-dev-mode-nvfvrl

To Reproduce

to reproduce:

  1. Visit the reproduction sandbox
  2. Open a log tab
  3. click in the fire button in the browser tab (to trigger multiple request to different pages simulating high traffic)
  4. verify that you receive the following error in the log tab:
(node:1491) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 29 unpipe listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)

Describe the Bug

This error may validate other issues with similar problems that have been documented with a posible leak in Next.js. If the leak exists is really problematic form small apps running in some servers with low amount of ram. Its important to say that this error only shows in dev server mode.

If its a false alarm also it would need to be removed.

Expected Behavior

requesting multiple pages in an app should't cause any memory leak

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1431

@Josehower Josehower added the bug Issue was opened via the bug report template. label Jun 7, 2023
@holicreact
Copy link

me too same see

kodiakhq bot pushed a commit that referenced this issue Jul 7, 2023
This should resolve part of the `MaxListenersExceededWarning` problem mentioned in #50909. When there are too many concurrent requests sent to the dev server, we only need to handle the first.

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
@shuding
Copy link
Member

shuding commented Jul 8, 2023

Should be better with #52360. There's still an event emitter that gets registered too many times but it's not a leak I believe. Will look into fixing that too.

@timneutkens timneutkens added the linear: next Confirmed issue that is tracked by the Next.js team. label Jul 11, 2023
@timneutkens
Copy link
Member

Going to close this issue as #52360 was landed.

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. 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 Sep 12, 2023
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. linear: next Confirmed issue that is tracked by the Next.js team. locked
Projects
None yet
Development

No branches or pull requests

4 participants