question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next 9.5.1 out of memory after some hot reloads

See original GitHub issue

Bug report

Describe the bug

Since updating to 9.5.x (from 9.4.x), i get an out of memory error after 10 something hot reloads:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

it did rarely happen in 9.4.1, but it happens very consistantly in 9.5.x

To Reproduce

thats probably tricky. it happens on big projects and might be related to some bug in the hot reload / rebuild. Maybe it happens when there are some import circles?

Expected behavior

nextjs should not go out-of-memory

System information

  • OS:macOS
  • Browser: chrome
  • Version of Next.js: 9.5.1
  • Version of Node.js: 12.13.1

Additional information

we are using a custom server with typescript

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:177
  • Comments:144 (18 by maintainers)

github_iconTop GitHub Comments

122reactions
macrozonecommented, Aug 4, 2020

Please provide a reproduction so that we can investigate

this is extremly hard to do, but i am 100% sure others have the same issue. Do you hav any idea how this could happen? Its a new problem and happens very consistantly.

maybe circular dependencies? I investigate now in that

39reactions
sbinlondoncommented, Nov 13, 2020

Just a small update:

Used node-oom-heapdump to grab a heap snapshot of our app when it crashed.

Screenshot 2020-11-13 at 12 18 22

It seems to call out one of Webpack’s dependencies, watchpack (and its DirectoryWatcher.js), which makes sense to me because my crashes happen the most when I’m in dev mode, switching between branches that have a large number of changed files between them.

I have sent the heap snapshot to the Next.js team so hopefully it will help them look into this. I think I’m potentially going to open an issue on the Watchpack repo as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Allocate More Memory to Javascript Heap Using Next.js
I encounter a similar issue recently and it was due to VS code automatically importing a log method from an existing npm module....
Read more >
next-transpile-modules - npm
This plugin aims to solve the following challenges: code transpilation from local packages (think: a monorepo with a styleguide package); code ...
Read more >
PopVision Graph Analyser User Guide - Graphcore Documents
The PopVision Graph Analyser generates the following reports: ... a model with high memory consumption may go out of memory when profiling is...
Read more >
“How-to” Guides - Spring
For instance, the following example loads a YAML configuration file from the ... directly to the classpath (for hot reloading purposes).
Read more >
Release Notes for the Cisco ASA Series, 9.6(x)
For a standalone ASA, after the unit reloads with the new version, ... If a value less than 456,384,512 is returned for “Max...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found