webpack crashes node frequently during development
Node (running webpack) has been crashing a lot for me today, apparently due to running out of memory. I'm not doing anything beyond running gdk run db
and gdk run app
, and then touching some Vue files. I'm not even sure that at least one of the crashes happened after not touching anything.
See log output for some information:
$ gdk run db
(in /home/markrian/dev/gdk-ee)
17:29:16 redis.1 | started with pid 1764
17:29:16 minio.1 | started with pid 1765
17:29:16 postgresql.1 | started with pid 1766
17:29:16 webpack.1 | started with pid 1768
17:29:16 registry.1 | started with pid 1769
[...snip...]
17:29:17 webpack.1 | yarn run v1.13.0
17:29:17 webpack.1 | $ nodemon -w 'config/webpack.config.js' --exec 'webpack-dev-se
rver --config config/webpack.config.js'
17:29:17 webpack.1 | [nodemon] 1.18.9
17:29:17 webpack.1 | [nodemon] to restart at any time, enter `rs`
17:29:17 webpack.1 | [nodemon] watching: config/webpack.config.js
17:29:17 webpack.1 | [nodemon] starting `webpack-dev-server --config config/webpack
.config.js`
17:29:18 webpack.1 | ℹ 「wds」: Project is running at http://localhost:3809/
17:29:18 webpack.1 | ℹ 「wds」: webpack output is served from /assets/webpack/
17:29:27 webpack.1 | ℹ 「wdm」: wait until bundle finished: /assets/webpack/manifest.
json
17:29:43 webpack.1 | 194 entries from '/pages' automatically added to webpack outpu
t.
17:29:45 webpack.1 | ℹ 「wdm」:
17:29:45 webpack.1 | ℹ 「wdm」: Compiled successfully.
17:34:21 webpack.1 | ℹ 「wdm」: Compiling...
17:34:31 webpack.1 |
17:34:31 webpack.1 | <--- Last few GCs --->
17:34:31 webpack.1 |
17:34:31 webpack.1 | [1837:0x40aa9f0] 313084 ms: Mark-sweep 1373.3 (1424.4) -> 13
72.8 (1424.9) MB, 429.8 / 0.1 ms (average mu = 0.145, current mu = 0.014) allocation failure sca
venge might not succeed
17:34:31 webpack.1 | [1837:0x40aa9f0] 313399 ms: Mark-sweep 1373.5 (1424.9) -> 13
73.0 (1424.9) MB, 287.7 / 0.1 ms (average mu = 0.123, current mu = 0.087) allocation failure sca
venge might not succeed
17:34:31 webpack.1 |
17:34:31 webpack.1 |
17:34:31 webpack.1 | <--- JS stacktrace --->
17:34:31 webpack.1 |
17:34:31 webpack.1 | ==== JS stack trace =========================================
17:34:31 webpack.1 |
17:34:31 webpack.1 | 0: ExitFrame [pc: 0x2ce498b5be1d]
17:34:31 webpack.1 | Security context: 0x328cd871e6e1 <JSObject>
17:34:31 webpack.1 | 1: InnerArraySort(aka InnerArraySort) [0x328cd87062e9] [na
tive array.js:~486] [pc=0x2ce499cd82a9](this=0x3d3c2ce026f1 <undefined>,l=0x119a4118ae99 <JSArray
[1]>,m=1,aw=0x097b3d0eb309 <JSFunction obj.reasons.module.reasons.sort (sfi = 0x373b2b6ef2e1)>)
17:34:31 webpack.1 | 2: sort [0x328cd87058c1] [native array.js:~610] [pc=0x2ce4
99eb4ca5](this=0x119a4118ae99 <JSArray[1]>,...
17:34:31 webpack.1 |
17:34:31 webpack.1 | FATAL ERROR: Ineffective mark-compacts near heap limit Allocat
ion failed - JavaScript heap out of memory
17:34:31 webpack.1 | 1: 0x8dc1c0 node::Abort() [/usr/bin/node]
17:34:31 webpack.1 | 2: 0x8dc20c [/usr/bin/node]
17:34:31 webpack.1 | 3: 0xad60ae v8::Utils::ReportOOMFailure(v8::internal::Isolate
*, char const*, bool) [/usr/bin/node]
17:34:31 webpack.1 | 4: 0xad62e4 v8::internal::V8::FatalProcessOutOfMemory(v8::int
ernal::Isolate*, char const*, bool) [/usr/bin/node]
17:34:31 webpack.1 | 5: 0xec3972 [/usr/bin/node]
17:34:31 webpack.1 | 6: 0xec3a78 v8::internal::Heap::CheckIneffectiveMarkCompact(u
nsigned long, double) [/usr/bin/node]
17:34:31 webpack.1 | 7: 0xecfb52 v8::internal::Heap::PerformGarbageCollection(v8::
internal::GarbageCollector, v8::GCCallbackFlags) [/usr/bin/node]
17:34:31 webpack.1 | 8: 0xed0484 v8::internal::Heap::CollectGarbage(v8::internal::
AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/bin/node]
17:34:31 webpack.1 | 9: 0xed30f1 v8::internal::Heap::AllocateRawWithRetryOrFail(in
t, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/bin/node]
17:34:31 webpack.1 | 10: 0xe9c574 v8::internal::Factory::NewFillerObject(int, bool,
v8::internal::AllocationSpace) [/usr/bin/node]
17:34:31 webpack.1 | 11: 0x113beae v8::internal::Runtime_AllocateInNewSpace(int, v8
::internal::Object**, v8::internal::Isolate*) [/usr/bin/node]
17:34:31 webpack.1 | 12: 0x2ce498b5be1d
17:34:31 webpack.1 | Aborted
17:34:31 webpack.1 | [nodemon] app crashed - waiting for file changes before starti
ng...
I've checked, and I have about 6GB of RAM available after it crashes out. While webpack is humming along nicely, it seems to consume ~2GB. So either node is ballooning up by an additional 4GB (!) for some reason, or something else is amiss.