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 crashes with out of memory error when missing import in page #51025

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

Comments

@Josehower
Copy link
Contributor

Josehower commented Jun 9, 2023

Verify canary release

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

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 18.15.0
      npm: 8.19.4
      Yarn: 1.22.19
      pnpm: 8.6.1
    Relevant packages:
      next: 13.4.5-canary.9
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: N/A

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-js-memory-leak-case-reached-heap-limit-2t3tj9

To Reproduce

After visiting the reproduction repo:

  • Start dev server
  • visit '/' Hit fire once or twice
  • verify the error FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Describe the Bug

This error happens in dev mode in 256MB Ram environments when a wrong import is found, and multiple pages of the app are requested, simulating traffic to the website (in the repo, this is created by using auto-cannon).

The error may be related to other memory errors reported on #50909 and #49929 and also may add a datapoint into the Hypothesis of a current memory leak in Next.js.

https://nextjs.org/docs/messages/module-not-found

<--- Last few GCs --->

[2218:0x5eb9a70]    40167 ms: Mark-sweep 252.1 (263.9) -> 250.1 (263.7) MB, 206.0 / 0.0 ms  (average mu = 0.174, current mu = 0.125) allocation failure scavenge might not succeed
[2218:0x5eb9a70]    40404 ms: Mark-sweep 252.4 (263.9) -> 250.6 (264.2) MB, 216.7 / 0.0 ms  (average mu = 0.135, current mu = 0.086) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb02930 node::Abort() [/usr/local/bin/node]
 2: 0xa18149 node::FatalError(char const*, char const*) [/usr/local/bin/node]
 3: 0xcdd16e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 4: 0xcdd4e7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
 5: 0xe94b55  [/usr/local/bin/node]
 6: 0xe95636  [/usr/local/bin/node]
 7: 0xea3b5e  [/usr/local/bin/node]
 8: 0xea45a0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
 9: 0xea751e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
10: 0xe68a5a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
11: 0x11e17c6 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x15d5439  [/usr/local/bin/node]

Expected Behavior

The app shouldn't crash with an out of memory error when a missing import is found.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1432

@Josehower Josehower added the bug Issue was opened via the bug report template. label Jun 9, 2023
@Josehower Josehower changed the title dev server Throw when missing import in page dev server Crash when missing import in page Jun 9, 2023
@Josehower Josehower changed the title dev server Crash when missing import in page dev server crash when missing import in page Jun 9, 2023
@Josehower Josehower changed the title dev server crash when missing import in page dev server crashes when missing import in page Jun 9, 2023
@Josehower Josehower changed the title dev server crashes when missing import in page dev server crashes with out of memory error when missing import in page Jun 9, 2023
@mateusfg7
Copy link

mateusfg7 commented Jun 21, 2023

I'm facing the same issue after a few minutes running and using app on development environment (next dev)

@SampaioLeal
Copy link

same here on dev environment

@Gr33nLight
Copy link

Same here, hoping to see a fix soon.

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

We're consolidating these reports into this issue, please read the issue and provide a reproduction there so that it can be investigated: #54708

@vercel vercel locked and limited conversation to collaborators Aug 29, 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.
Projects
None yet
Development

No branches or pull requests

5 participants