JS heap dump while deploying on Netlify
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
There's a **JS heap dump** issue which occurred while I was deploying a project on Netlify which uses mapbox-gl as a dependency.
**mapbox-gl-js version**: 2.8.2
**browser**: -
### Steps to Trigger Behavior
1. Install `mapbox-gl@2.8.2` on your project using npm: `npm install --save mapbox-gl`
2. try to deploy the project via Netlify
3. after Netlify runs `npm run build` the following error shows up:
```
1:24:57 PM: Creating an optimized production build...
1:26:00 PM: <--- Last few GCs --->
1:26:00 PM: [1457:0x51a5700] 60975 ms: Scavenge 2034.0 (2075.6) -> 2032.3 (2080.1) MB, 2.5 / 0.0 ms (average mu = 0.187, current mu = 0.145) allocation failure
1:26:00 PM: [1457:0x51a5700] 60983 ms: Scavenge 2036.7 (2080.3) -> 2033.1 (2080.8) MB, 2.6 / 0.0 ms (average mu = 0.187, current mu = 0.145) allocation failure
1:26:00 PM: [1457:0x51a5700] 61002 ms: Scavenge 2037.7 (2081.3) -> 2034.1 (2082.3) MB, 12.8 / 0.0 ms (average mu = 0.187, current mu = 0.145) allocation failure
1:26:00 PM: <--- JS stacktrace --->
1:26:00 PM: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1:26:00 PM: 1: 0xb09c10 node::Abort() [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 2: 0xa1c193 node::FatalError(char const*, char const*) [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 3: 0xcf8dbe v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 4: 0xcf9137 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 5: 0xeb09d5 [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 6: 0xeb14b6 [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 7: 0xebf9de [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 8: 0xec0420 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 9: 0xec3315 v8::internal::Heap::HandleGCRequest() [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 10: 0xe509b7 v8::internal::StackGuard::HandleInterrupts() [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 11: 0x11fcd75 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
1:26:00 PM: 12: 0x15f2099 [/opt/buildhome/.nvm/versions/node/v16.15.0/bin/node]
```
5. try downgrading mapbox-gl to version 1.13.0 then trigger a redeploy and you'll notice there's no issue with this version
### NOTE
- I also tried `mapInstance.remove()` on the cleanup effect hook (React 17.0.2) but this doesn't help either.
- There was no issue building the project on my local machine using `npm run build`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Netlify deployment with mapbox-gl@2.8.2, Node.js 16.15.0, React 17.0.2, and the reported npm install and npm run build steps; compare it with the working 1.13.0 deployment and the local build. There are no source files or tests named in the report, so the affected build entry point and a reliable reproduction still need to be identified. Done means the Netlify build completes without the reported JavaScript heap out-of-memory failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, react
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100