Skip to content

"JavaScript heap out of memory" error when declaring the ui5 tooling as a "dependency" #311

Closed

Description

@IObert

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

  1. Clone the sample app
  2. Remove all devDependencies and turn them in normal dependencies
  3. Try to run ui5 serve -o index.html

Context

  • UI5 Module Version (output of ui5 --version when 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)

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

Activity

  1. changed the title [-]`JavaScript heap out of memory` error when declaring the ui5 tooling as a "dependency"[/-] [+]"JavaScript heap out of memory" error when declaring the ui5 tooling as a "dependency"[/+] on Mar 18, 2019
  2. self-assigned this
    on Apr 1, 2019
  3. transferred this issue fromSAP/ui5-projecton Nov 20, 2020
  4. RandomByte commented on Feb 15, 2021

    @RandomByte
    Member

    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:

    1. Double check whether your dependencies could be devDependencies since those are ignored by default
    2. List those dependencies that are UI5 Tooling relevant in an additional "ui5.dependencies" array in your package.json:
      {
          "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"
              ]
          }
      }
      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.
  5. RandomByte commented on Jun 9, 2023

    @RandomByte
    Member

    Surprised to see this issue is still open. This should be resolved with the v3 releases 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions