developit / developit/microbundle

microbundle out of memory on build

Open
#870 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
8.1k
Forks
358
PR merge metrics
No merged PRs in 30d

Description

How to reproduce:
1. Clone https://github.com/daangn/urlpack
2. `cd urlpack/packages/msgpack` (https://github.com/daangn/urlpack/tree/main/packages/msgpack)
3. `yarn install`
4. `yarn _build` (`microbundle --format esm,cjs`)

This always fails with an out-of-memory issue. on Node v14, v16, Mac OS and Ubuntu 20.04

It is not reproduced in other packages with similar code and settings.

```
yarn run v1.22.5
$ microbundle --format esm,cjs

<--- Last few GCs --->

[44348:0x5519880] 13088 ms: Scavenge 3273.1 (3307.3) -> 3273.1 (3307.3) MB, 36.7 / 0.0 ms (average mu = 0.906, current mu = 0.894) allocation failure
[44348:0x5519880] 13243 ms: Scavenge 3536.7 (3570.9) -> 3536.7 (3570.9) MB, 36.9 / 0.0 ms (average mu = 0.906, current mu = 0.894) allocation failure
[44348:0x5519880] 13643 ms: Scavenge 3574.7 (3608.9) -> 3574.7 (3608.9) MB, 5.6 / 0.0 ms (average mu = 0.906, current mu = 0.894) allocation failure

<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
1: 0xa222f0 node::Abort() [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
2: 0x96411f node::FatalError(char const*, char const*) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
3: 0xb97f1e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
4: 0xb98297 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
5: 0xd52fd5 [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
6: 0xd83bbe v8::internal::EvacuateNewSpaceVisitor::Visit(v8::internal::HeapObject, int) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
7: 0xd8fbf6 v8::internal::FullEvacuator::RawEvacuatePage(v8::internal::MemoryChunk*, long*) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
8: 0xd7bd8f v8::internal::Evacuator::EvacuatePage(v8::internal::MemoryChunk*) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
9: 0xd7c008 v8::internal::PageEvacuationTask::RunInParallel(v8::internal::ItemParallelJob::Task::Runner) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
10: 0xd6e8e9 v8::internal::ItemParallelJob::Run() [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
11: 0xd91b50 void v8::internal::MarkCompactCollectorBase::CreateAndExecuteEvacuationTasks(v8::internal::MarkCompactCollector*, v8::internal::ItemParallelJob*, v8::internal::MigrationObserver*, long) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
12: 0xd923ec v8::internal::MarkCompactCollector::EvacuatePagesInParallel() [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
13: 0xd925b5 v8::internal::MarkCompactCollector::Evacuate() [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
14: 0xda45b1 v8::internal::MarkCompactCollector::CollectGarbage() [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
15: 0xd60878 v8::internal::Heap::MarkCompact() [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
16: 0xd62368 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
17: 0xd642a5 v8::internal::Heap::HandleGCRequest() [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
18: 0xd0a787 v8::internal::StackGuard::HandleInterrupts() [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
19: 0x107c20a v8::internal::Runtime_StackGuardWithGap(int, unsigned long*, v8::internal::Isolate*) [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
20: 0x1423279 [/home/cometkim/.asdf/installs/nodejs/14.17.0/bin/node]
Aborted (core dumped)
error Command failed with exit code 134.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Clone daangn/urlpack, enter packages/msgpack, run yarn install, then reproduce with yarn _build (microbundle --format esm,cjs). Read the package configuration and microbundle build path involved in this command; done means the msgpack package builds successfully without exhausting the Node.js heap on the reported environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.