Repository navigation
Closed as not planned
Labels
bugAn error in the Docusaurus core causing instability or issues with its executiondomain: performanceRelated to bundle size or perf optimization
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
Too costly assembly for little documentation.
Inability to separate assembly of several documentations separately from each other.
Reproducible demo
Steps to reproduce
I've do some prebuilding before deploy:
npm cicd ./apinpm cinpm run build:docscd ..npm run build
But in any case, separately run npm run build gaves same results.
Expected behavior
Correctly assembling, I can't even get a single language version; increasing the amount of maximum memory for Node.js is far from the best solution. This temporarily solves the problem, but for the near future, a multiple increase in the number of documentation pages will be required.
Actual behavior
> [email protected] build
> docusaurus build
[INFO] Website will be built for all these locales:
- en
- ru
[INFO] [en] Creating an optimized production build...
[info] [webpackbar] Compiling Client
[info] [webpackbar] Compiling Server
[success] [webpackbar] Client: Compiled successfully in 8.37m
<--- Last few GCs --->
[1819:0x621e840] 1372542 ms: Scavenge 1945.2 (2076.7) -> 1932.6 (2076.7) MB, 11.8 / 0.0 ms (average mu = 0.332, current mu = 0.312) allocation failure;
[1819:0x621e840] 1372619 ms: Scavenge 1948.5 (2078.5) -> 1935.1 (2078.5) MB, 16.2 / 0.0 ms (average mu = 0.332, current mu = 0.312) allocation failure;
[1819:0x621e840] 1372661 ms: Scavenge 1949.0 (2078.7) -> 1936.3 (2078.7) MB, 9.8 / 0.0 ms (average mu = 0.332, current mu = 0.312) allocation failure;
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xb6e500 node::Abort() [node]
2: 0xa7e632 [node]
3: 0xd47ea0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xd48247 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xf[25](https://github.com/Nernar/nernar.github.io/actions/runs/3448410688/jobs/5755616270#step:8:26)605 [node]
6: 0xf[26](https://github.com/Nernar/nernar.github.io/actions/runs/3448410688/jobs/5755616270#step:8:27)508 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
7: 0xf36a13 [node]
8: 0xf37888 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xf121ee v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xf135b7 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
11: 0xef478a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
12: 0x12b7d2f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
13: 0x16e9979 [node]
Aborted (core dumped)
Error: Process completed with exit code 1[34](https://github.com/Nernar/nernar.github.io/actions/runs/3448410688/jobs/5755616270#step:8:35).Allocation sampling .heapprofile
Your environment
- Public source code: https://github.com/Nernar/nernar.github.io
- Public site URL: https://nernar.github.io/api
- Docusaurus version used: 2.2.0
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Microsoft Edge 103.0.1264.71, Node.js v16.18.0
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): Zorin OS 16.2 (like Ubuntu LTS)
I've also tried with pretty same specs on GitHub Actions with
ubuntu-latest.
Self-service
- I'd be willing to fix this bug myself.
Metadata
Metadata
Assignees
Labels
bugAn error in the Docusaurus core causing instability or issues with its executiondomain: performanceRelated to bundle size or perf optimization

Activity
slorber commentedon Nov 16, 2022
Thanks for the repro and heap dump 👍
Are aware of the high memory usage of Docusaurus, let's track this here: #4765
Unfortunately, Docusaurus v2 has been initially architectured by loading everything into memory, so it's unlikely we'll be able to fix this in the near future with a completely new streaming architecture.
There are some production build phases that are more memory intensive and we'll try to optimize them but I think it's unlikely a very large site will ever be able to build with the default NodeJS options on our current architecture.
sporritt commentedon Jun 20, 2023
I came across this problem today and resolved it by bumping the heap available to node:
export NODE_OPTIONS=--max-old-space-size=10248 npm run build