redoc icon indicating copy to clipboard operation
redoc copied to clipboard

JavaScript heap out of memory and/or coredump

Open icesvz opened this issue 2 years ago • 5 comments

Describe the bug Redocly cli crash on docker and bare metal (node 18.16.1-1, node 20.4.0).

Expected behavior Generated documentation.

Minimal reproducible OpenAPI snippet(if possible) 1. docker run --rm -p 80:80 dockware/play:latest

wget -O shopware-admin-openapi3.json http://localhost/api/_info/openapi3.json?type=jsonapi

docker run --rm -v ./:/spec redocly/cli build-docs shopware-admin-openapi3.json

--> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

docker run --rm -v ./:/spec --env NODE_OPTIONS=--max_old_space_size=32000 redocly/cli build-docs shopware-admin-openapi3.json

--> ~18GB memory used --> coredump

Screenshots

redocly-coredump

htop-1

Additional context

on bare metal: redocly lint shopware-admin-openapi3.json ... Woohoo! Your OpenAPI definition is valid. 🎉 You have 76 warnings.

npm list -g /usr/lib └── @redocly/[email protected]

this is default and minimal schema for shopware https://github.com/shopware/platform/

shopware-admin-openapi3.json.zip

logs.log

icesvz avatar Jul 19 '23 13:07 icesvz

Thanks for letting us know about this. Please check if you have any circular references in your OpenAPI description, and also if you can build the docs on bare metal or if this problem is specific to docker? (note: may be related to Redocly/redoc#2474 )

lornajane avatar Jul 24 '23 12:07 lornajane

Tested on bare metal too (node 18.16.1-1, node 20.4.0) the same problem

icesvz avatar Jul 27 '23 03:07 icesvz

Please check if you have any circular references in your OpenAPI description

Is there a method/script to check this?
Maybe an option to ignore these references?

icesvz avatar Jul 28 '23 16:07 icesvz

You can run redocly bundle openapi.json --dereferenced --output bundled.json. If your definition contains circular dependencies, it will bark at you. (Spoiler, there are). However, I'm not sure this is the only issue here. Looks like there is something with React building a document on the server side.

tatomyr avatar Aug 07 '23 09:08 tatomyr

I'm transferring it back since the issue is on Redoc / Reference Docs side. cc @AlexVarchuk

tatomyr avatar Aug 11 '23 08:08 tatomyr