DSpace 7.6.1 getting "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory"

1,863 views
Skip to first unread message

Tomas Hajek

unread,
Nov 22, 2023, 5:32:37 PM11/22/23
to dspac...@googlegroups.com
Hi,
   I had DSpace version 7.5 running and working under pm2 (for a production config) and I could run yarn start:dev when testing theme updates after stopping the pm2 processes (pm2 stop dspace-ui).
   I recently updated to 7.6 and then to 7.6.1.  The update to 7.6 seemed fine both on the front-end and the back-end and then I saw the information on bug fixes for 7.6.1 so I updated the back-end to 7.6.1 and that seems to be fine but I am now experiencing a "JavaScript heap out of memory"  when trying a "yarn start:dev".
  I tried going back to 7.6 and even doing a fresh checkout of the dspace-angular 7.6 source but am consistently now getting the same/similar error message with 7.6.  I then tried going back to 7.5 but now that seems to also be giving a "JavaScript heap out of memory" error. 
   If I reboot I can get 7.5 to start in dev mode but 7.6.1 still gives a "JavaScript heap out of memory" error. 
   Yarn, node, pm2, etc... is all pretty new to me so I'm thinking I have something set somewhere now that is causing this or I need to adjust a memory parameter somewhere but I'm at a bit of a loss as to where to look.  
   This is all in a test environment and I can pretty much redeploy back to 7.5 with an Ansible playbook but I'd like to figure out where I went wrong so any advice would be much appreciated.

  A related question, In my test environment I can go to https://<dspace-server-name>/server/#/server/api and get the dspaceVersion for the back-end, is there a similar way to get the DSpace version for the front-end?  I think my front-end is currently on 7.6 but I'd like to be sure.

Example error output below:
dspace@hajek-dspace-d01 ~/dspace-angular-src/config$ yarn start:dev
yarn run v1.22.21
$ nodemon --exec "cross-env NODE_ENV=development yarn run serve"
[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): config/**/*
[nodemon] watching extensions: json
[nodemon] starting `cross-env NODE_ENV=development yarn run serve`
$ yarn base-href
$ ts-node --project ./tsconfig.ts-node.json scripts/base-href.ts
Building development app config
Overriding app config with /home/dspace/dspace-angular-src/config/config.yml
Overriding app config with /home/dspace/dspace-angular-src/config/config.dev.yml
Setting baseHref to / in angular.json
$ ts-node --project ./tsconfig.ts-node.json scripts/serve.ts
Building development app config
Overriding app config with /home/dspace/dspace-angular-src/config/config.yml
Overriding app config with /home/dspace/dspace-angular-src/config/config.dev.yml
⠋ Generating browser application bundles (phase: setup)...Building development app config
Overriding app config with /home/dspace/dspace-angular-src/config/config.yml
Overriding app config with /home/dspace/dspace-angular-src/config/config.dev.yml
Angular config.json file generated correctly at /home/dspace/dspace-angular-src/src/assets/config.json

⠙ Generating browser application bundles (phase: setup)...- angular-idle-preload [main/commonjs] (git+https://github.com/gdi2290/angular-idle-preload.git)
- ng2-nouislider [es2015/esm2015] (https://github.com/tb/ng2-nouislider)
- ngx-sortablejs [es2015/esm2015] (https://github.com/sortablejs/ngx-sortablejs)
- ng2-file-upload [es2015/esm2015] ()
⠏ Generating browser application bundles (phase: sealing)...
<--- Last few GCs --->

[45299:0x55ae38e7b7f0]   263556 ms: Mark-sweep 2014.2 (2090.0) -> 2002.2 (2094.0) MB, 2554.2 / 0.1 ms  (average mu = 0.276, current mu = 0.012) allocation failure scavenge might not succeed
[45299:0x55ae38e7b7f0]   267071 ms: Mark-sweep 2018.3 (2094.0) -> 2006.3 (2097.5) MB, 3453.6 / 0.1 ms  (average mu = 0.142, current mu = 0.017) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x55ae3544df54 node::Abort() [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
 2: 0x55ae35302700 node::OOMErrorHandler(char const*, bool) [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
 3: 0x55ae3563ae44 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
 4: 0x55ae3563b106 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
 5: 0x55ae357db209  [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
 6: 0x55ae357f453f v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
 7: 0x55ae357f71a4 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
 8: 0x55ae357f7239 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
 9: 0x55ae357c119f v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
10: 0x55ae35b026e0 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
11: 0x55ae35ed8cd9  [ng serve --host localhost --port 4000 --serve-path / --ssl false --configuration development]
[nodemon] clean exit - waiting for changes before restart



Thanks in advance for any guidance.

--

                Tomas Hajek
                ha...@oakland.edu
                1-248-370-3505
                Assistant Director, Research Computing and Infrastructure Engineering
                University Technology Services
                Oakland University

Abel Gómez

unread,
Nov 22, 2023, 6:06:00 PM11/22/23
to dspac...@googlegroups.com

Hi Tomas,

looks like the memory limit in your system for node is too low.

You can temporarily run yarn with more memory by simply running:

NODE_OPTIONS=--max-old-space-size=4096 yarn start:dev

If that works, the memory limit is the root cause. See https://nodejs.org/api/cli.html#--max-old-space-sizesize-in-megabytes for more info.

Since "yarn start:dev" is for debugging, I don't see the need to apply the change permanently in your system, but you can do so by modifying the file "package.json" (see "start:dev" in the "scripts" section: https://github.com/DSpace/dspace-angular/blob/7e2f23aacd7a0d023ba911bd9c8acc842553f172/package.json#L9).

Abel

--
All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/CAPx-GQoEF2Wc-827kQHdLq%2Bc7%3DuijjXWArsefjLyQ9cMN9E3vw%40mail.gmail.com.
-- 
Abel Gómez Llana, PhD

ab...@gomez.llana.me
https://abel.gomez.llana.me

Tomas Hajek

unread,
Nov 29, 2023, 5:41:39 AM11/29/23
to DSpace Technical Support
Thanks Abel,
  It looks like running with "NODE_OPTIONS=--max-old-space-size=4096 yarn start:dev" worked to start the dev environment.  Thanks also for the link to the related documentation

Probably a questions to the DSpace developers.
Is there a reason why I might have to set this now when previously I did not?  Did the requirements change with version 7.6.1 or maybe I have something wrong in my environment but this installation is nearly a stock installation.  
Also, still wondering if there is a way to query the DSpace version for the front-end like there is for the back-end?

Thanks

DSpace Technical Support

unread,
Dec 4, 2023, 3:46:07 PM12/4/23
to DSpace Technical Support
This "JavaScript heap out of memory" error appears to be related to this bug: https://github.com/DSpace/dspace-angular/issues/2259

So far we haven't been able to track it down as it doesn't occur for everyone.  It appears to only exist on some Operating Systems, and only impacts running in development mode ("yarn start:dev").  For more details see the ticket above.

As for the User Interface, it reports it's version to commandline anytime you start it up via `yarn start` or `yarn start:dev`.  You should see a message like this which reports the version information:
```
dspace-angular
Version: 7.6.1
Environment: Production
```

Tim

Tomas Hajek

unread,
Dec 4, 2023, 5:09:54 PM12/4/23
to DSpace Technical Support
Hi Tim,
  Thanks for the additional information.  I'll read through the bug report and see if there is anything I might be able to add but I'm a bit of a novice to the technology involved as might be obvious by some of my questions. 
  Regarding the User interface version.
   I do run "yarn start:dev" when working on updates to our theme but for production I am running under pm2 after a yarn build:prod and deploying the dist folder.  What I was looking for was a way to know what version of DSpace is deployed out for production since this can be different than the version checked out in the dspace-angular source tree that we are working on.  Looking over the commands available I see that there is a "pm2 logs" commands and I see output similar to what you mentioned with yarn.  Looks like I can grep the pm2 logs as well:
dspace@kl-dspace-d02 ~$ grep Version: /home/dspace/.pm2/logs/*.log | tail -2
/home/dspace/.pm2/logs/dspace-ui-out-1.log:Version: 7.5.0
/home/dspace/.pm2/logs/dspace-ui-out-1.log:Version: 7.6.1
 So I think I have my answer for that now. 
Thanks again!

You received this message because you are subscribed to a topic in the Google Groups "DSpace Technical Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dspace-tech/b9PnRKRPOYo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/b52a00ff-801e-4cab-88ea-65c3cbafff8en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages