generator
generator copied to clipboard
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Describe the bug Trying to generate a typescript client off of the spec here: https://raw.githubusercontent.com/MystenLabs/sui/main/sui/open_rpc/spec/openrpc.json
Heap limit is exceeded even after increasing max memory usage for Node:
export NODE_OPTIONS=--max_old_space_size=16384
<--- Last few GCs --->
[16933:0x104a08000] 713974 ms: Mark-sweep (reduce) 16381.7 (16406.0) -> 16380.8 (16405.8) MB, 95315.0 / 0.2 ms (average mu = 0.108, current mu = 0.000) allocation failure scavenge might not succeed
[16933:0x104a08000] 797317 ms: Mark-sweep (reduce) 16381.8 (16402.8) -> 16381.0 (16404.0) MB, 83336.7 / 0.0 ms (average mu = 0.060, current mu = 0.000) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x101317585 node::Abort() (.cold.1) [/usr/local/bin/node]
2: 0x1000b25c9 node::Abort() [/usr/local/bin/node]
3: 0x1000b272f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
4: 0x1001f6eb7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x1001f6e53 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
6: 0x1003a6eb5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
7: 0x1003a897a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
8: 0x1003a4049 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x1003a18e1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
10: 0x1003b019a v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x1003b0221 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
12: 0x10037d8d2 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
13: 0x1006fdaf8 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x100a8adf9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
verbose 875.018325764 Error: Command failed with signal "SIGABRT".
at ProcessTermError.ExtendableBuiltin (/usr/local/lib/node_modules/yarn/lib/cli.js:721:66)
at ProcessTermError.MessageError (/usr/local/lib/node_modules/yarn/lib/cli.js:750:123)
at new ProcessTermError (/usr/local/lib/node_modules/yarn/lib/cli.js:790:113)
at /usr/local/lib/node_modules/yarn/lib/cli.js:34550:30
at Generator.throw (<anonymous>)
at step (/usr/local/lib/node_modules/yarn/lib/cli.js:310:30)
at /usr/local/lib/node_modules/yarn/lib/cli.js:323:13
at processTicksAndRejections (internal/process/task_queues.js:95:5)
error Command failed with signal "SIGABRT".
To Reproduce
yarn --verbose open-rpc-generator generate -d https://raw.githubusercontent.com/MystenLabs/sui/main/sui/open_rpc/spec/openrpc.json -o ./generated -l typescript -t client -n tsclient
Here is a REPL environment to reproduce the issue: https://replit.com/@MichaelHuang10/FearfulWelloffLeadership#openrpc.json
Expected behavior Generate a typescript client.
Desktop (please complete the following information):
- OS: macOS
- Version: Monterey 12.3.1
- Node: v14.17.1
Perhaps some validation to prevent this behavior could help?
hm looks like an issue with a cycle, MoveTypeLayout and TypeTag both ref themselves.
Thanks @shanejonas ! Should the generator be able to handle cyclic refs? If not, do you know what is the right way/workaround to model this in the schema?
Hello, any progress on this issue?
Looks like the cycle references are not handled correctly
Experiencing the exact same issue with SUI (blockchain)'s openrpc specification. https://gist.github.com/RdeWilde/b6ec9c3c9e0b921d496e4553b5935300
Same Issue