ui5-tooling
ui5-tooling copied to clipboard
"JavaScript heap out of memory" error when declaring the ui5 tooling as a "dependency"
Expected Behavior
The ui5 commands (e.g. ui5 serve) should work.
Current Behavior
Terminal "stalls" for some minutes and eventually fails with an error
Steps to reproduce the issue
- Clone the sample app
- Remove all
devDependenciesand turn them in normaldependencies - Try to run
ui5 serve -o index.html
Context
- UI5 Module Version (output of
ui5 --versionwhen using the CLI):1.0 - 1.2 - Node.js Version:
v10.6.0 - npm Version:
6.5.0 - OS/Platform:
Mac Mojave 10.14.3 - Browser (if relevant):
NA - Other information:
NA
Affected components (if known)
- [ ] ui5-builder
- [ ] ui5-server
- [ ] ui5-cli
- [ ] ui5-fs
- [X] ui5-project as suggested by @RandomByte via Slack
- [ ] ui5-logger
Log Output / Stack Trace
ui5 serve index.html
<--- Last few GCs --->
[3933:0x102801600] 73998 ms: Scavenge 1327.6 (1403.1) -> 1327.6 (1403.6) MB, 2.6 / 0.0 ms (average mu = 0.322, current mu = 0.254) allocation failure
[3933:0x102801600] 74002 ms: Scavenge 1327.9 (1403.6) -> 1327.9 (1404.6) MB, 2.5 / 0.0 ms (average mu = 0.322, current mu = 0.254) allocation failure
[3933:0x102801600] 74008 ms: Scavenge 1328.6 (1404.6) -> 1328.6 (1405.1) MB, 2.1 / 0.0 ms (average mu = 0.322, current mu = 0.254) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x2b6bec7841bd]
Security context: 0x3ae69721e6c9 <JSObject>
1: map [0x3ae697206ac9](this=0x3ae603ae44f1 <JSArray[3]>,0x3ae679489979 <JSFunction queue.push.project.dependencies.map (sfi = 0x3ae601164f51)>)
2: dedupeTree [0x3ae6fd5027d9] [/Users/<user>/SoftwareDev/sandbox/openui5-sample-app/node_modules/@ui5/project/lib/translators/npm.js:~451] [pc=0x2b6bec9e960c](this=0x3ae6a13602d9 <NpmTranslator map = 0x3ae...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x100033d65 node::Abort() [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
2: 0x100035500 node::FatalTryCatch::~FatalTryCatch() [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
3: 0x10019f10a v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
4: 0x10056d6b2 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
5: 0x10056c669 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
6: 0x10056a2f8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
7: 0x10057683c v8::internal::Heap::AllocateRawWithRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
8: 0x1005451d4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
9: 0x1007cf974 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/Users/<user>/.nvm/versions/node/v10.6.0/bin/node]
10: 0x2b6bec7841bd
Abort trap: 6
I recall that Marius found a way to work around this. Anyways, to provide some information for anyone running into this kind of issue:
This is a known issue with projects that have many transitive npm dependencies. UI5 Tooling follows all dependencies of a project, and their dependencies. Due to shortcomings of that implementation "out of memory" errors like the one reported here can occur. We will hopefully improve this handling soon.
Until then you have two options depending on your project:
- Double check whether your
dependenciescould bedevDependenciessince those are ignored by default - List those dependencies that are UI5 Tooling relevant in an additional "ui5.dependencies" array in your package.json:
Any direct dependencies which are not listed in that array will be ignored. This should resolve the reported issue with the dependency tree generation. This configuration is not documented and will become obsolete (ignored) once UI5 Tooling dependency handling has improved.{ "name": "my-app", "version": "1.0.0", "dependencies": { "some-non-ui5-dependency": "^1.0.0", "some-ui5-dependency": "^1.0.0" }, "ui5": { "dependencies": [ "some-ui5-dependency" ] } }
Surprised to see this issue is still open. This should be resolved with the v3 releases 🎉