Redocly / Redocly/redoc

JavaScript heap out of memory on large swagger file

Open
#1,357 13 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

More of a query (than an issue) - I'm getting the following issue while trying to generate the OpenAPI documentation for a very large swagger file (33,300 lines).

I've tried to increase the memory in Node.js but without success (although I'm not sure I'm doing it right). If you could help that would be great! Thanks!

C:\APIs>redoc-cli bundle AllSwaggers.json -o AllSwaggers.html
Prerendering docs

<--- Last few GCs --->
0)[23380:000001AAF961C5C0] 61437 ms: Mark-sweep 2047.1 (2050.8) -> 2046.5 (2051.0) MB, 3430.8 / 0.0 ms (+ 0.0 ms in 9 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 3437 ms) (average mu = 0.179, current mu = 0.002) al[23380:000001AAF961C5C0] 63076 ms: Mark-sweep 2047.3 (2051.0) -> 2046.9 (2051.0) MB, 1575.9 / 0.0 ms (+ 51.4 ms in 12 steps since start of marking, biggest step 11.4 ms, walltime since start of marking 1639 ms) (average mu = 0.120, current mu = 0.007)

<--- JS stacktrace --->

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

0: ExitFrame [pc: 00007FF75288B3BD]

Security context: 0x03b4f47808d1
1: /* anonymous / [000001402A837A59] [C:\Users\jimh\AppData\Roaming\npm\node_modules\redoc-cli\node_modules\redoc\bundles\redoc.lib.js:~8988] [pc=000002D82D212741](this=0x032c52a4cef9 ,0x03cad0476119 <String[55]: #/components/schemas/InstanceNameAndDomainNameAndFullId>)
2: /
anonymous */ [0000031A168E9009] [...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF751C75EBF napi_wrap+114095
2: 00007FF751C20B46 v8::base::CPU::has_sse+66998
3: 00007FF751C21946 v8::base::CPU::has_sse+70582
4: 00007FF752436E4E v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF75241EF21 v8::SharedArrayBuffer::Externalize+833
6: 00007FF7522EB18C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
7: 00007FF7522F63C0 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312
8: 00007FF7522F2EE4 v8::internal::Heap::PageFlagsAreConsistent+3204
9: 00007FF7522E86E3 v8::internal::Heap::CollectGarbage+1283
10: 00007FF7522E6D54 v8::internal::Heap::AddRetainedMap+2452
11: 00007FF75230809D v8::internal::Factory::NewFillerObject+61
12: 00007FF75206E1E1 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1665
13: 00007FF75288B3BD v8::internal::SetupIsolateDelegate::SetupHeap+546637
14: 000002D82D212741

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the reported redoc-cli bundle AllSwaggers.json -o AllSwaggers.html command and inspect the stack trace location in redoc.lib.js around line 8988. Determine whether the 33,300-line Swagger file can be processed within a supported Node.js memory limit; done should be a confirmed workaround, or a documented limitation if no workaround is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.