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.

Segmentation faults keep occurring after a while.

See original GitHub issue

Bug report

What is the current behavior? After a while of running the webpack dev server in watch mode, webpack 5 segfaults with a message like this:


<--- Last few GCs --->

[44446:0x2a53fb0]  7749337 ms: Mark-sweep 1374.2 (1441.4) -> 1359.6 (1441.9) MB, 219.9 / 0.0 ms  (average mu = 0.194, current mu = 0.102) allocation failure scavenge might not succeed
[44446:0x2a53fb0]  7749600 ms: Mark-sweep 1374.8 (1442.9) -> 1360.7 (1443.4) MB, 183.2 / 0.0 ms  (average mu = 0.249, current mu = 0.304) allocation failure scavenge might not succeed


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x3376821dbe1d]
    1: StubFrame [pc: 0x3376821dd3a6]
Security context: 0x127c2a29e6c1 <JSObject>
    2: SourceMapGenerator_serializeMappings [0x12508177b811] [/var/www/wordpress/current/tsi/admin/portal/build/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:~312] [pc=0x33768705556d](this=0x102c5a302201 <SourceMapGenerator map = 0x22a5f09e6491>)
    3: SourceMapGenerator_toJSON [0x1250...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x8fb090 node::Abort() [webpack]
 2: 0x8fb0dc  [webpack]
 3: 0xb0322e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [webpack]
 4: 0xb03464 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [webpack]
 5: 0xef74c2  [webpack]
 6: 0xef75c8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [webpack]
 7: 0xf036a2 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [webpack]
 8: 0xf03fd4 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [webpack]
 9: 0xf06c41 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [webpack]
10: 0xed00c4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [webpack]
11: 0x117024e v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [webpack]
12: 0x3376821dbe1d
Aborted (core dumped)

It seems to be running out of memory, but I am not sure why. I have recently migrated my project from webpack 4 to 5. On webpack 4, I never experienced segfaults at all. On webpack 5, after a while, it will try to compile and segfault as shown above.

If the current behavior is a bug, please provide the steps to reproduce. I’m not sure how to reproduce this outside of my project. The project is large (webpack reports producing around 16MB of js). If it’s an issue of memory not being freed, trying it with a similarly large project in watch mode should yield similar results.

What is the expected behavior? It shouldn’t segfault…

Other relevant information: webpack version: 5.24.4 Node.js version: 10.21.0 Operating System: Ubuntu 16.04 running inside of a docker container on Arch Linux Additional tools:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:56 (39 by maintainers)

github_iconTop GitHub Comments

3reactions
sokracommented, Mar 11, 2021

Node.js memory is limited by default to 1.4/2GB. You can increase it with node --max-old-space-size=4196 node_modules/webpack/bin/webpack.js ... or cross-env NODE_OPTIONS=--max-old-space-size=4196 webpack

1reaction
alexander-akaitcommented, Apr 13, 2021

Hard to say… maybe you can profile memory, so we can search leaks?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Identify what's causing segmentation faults (segfaults)
A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core...
Read more >
Why am I getting a segmentation fault at this while loop?
A crazy value in your index has caused the array element syntax to reference memory out of range resulting in a segfault. Share....
Read more >
List of Common Reasons for Segmentation Faults in C/C++
The main reason for segmentation fault is accessing memory that is either not initialized, out of bounds for your program or trying to ......
Read more >
Tips on Segmentation Faults
Any time your program gives a "segmentation violation" or "segmentation fault" error, review this document for tips on correcting the error.
Read more >
Learning about segmentation faults in C++ - Educative.io
Segmentation faults can occur due to multiple reasons; overflowing the stack allocated during recursion, accessing array elements with out of bound indexes, ...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found