-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Closed
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.
Description
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
karlhorky, GeekySouravSingh and mateusfg7
Metadata
Metadata
Assignees
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.Confirmed issue that is tracked by the Next.js team.