Open alanorth opened 1 year ago
I found a few references to this that say increasing the "old" space helps:
I just tried this and it worked:
$ export NODE_OPTIONS=--max_old_space_size=8192
$ yarn run start:dev
So there may be something we can do in package.json
if this becomes an issue more people are having. Also, note that I picked 8192 arbitrarily rather than based on profiling how much memory the build actually used. The real number should be related to how many assets we have, or how large our bundle is.
We already set NODE_OPTIONS in the Dockerfile. It is set to 4096 there. Can we do anything to reduce the amount of memory that is used to compile a dev version of dspace-angular or do we have to raise the memory again and again?
Hi @pnbecker I am not using Docker. :) I am building using the normal yarn CLI workflow.
As discussed in the angular-ui Slack channel: there is a hard-coded value (4GB) of max_old_space_size
in webpack.js
👉 https://github.com/DSpace/dspace-angular/blob/9c780200b2136621517cff034234c5c29c6d7762/scripts/webpack.js#L4
But this hard-coded value in webpack.js
was for something else and is unused as I understood it?
But this hard-coded value in
webpack.js
was for something else and is unused as I understood it?
Yes, as @artlowel mentioned in the angular-ui Slack channel, webpack.js
is no longer needed. I will open a Github issue and ask for deletion. 👉 https://github.com/DSpace/dspace-angular/issues/2285
I'm not sure exactly how to move this forward, as I cannot reproduce this locally. For now, I'll keep the ticket open but move to "Needs Info" column. I think we need some reproducible steps where we can reliably trigger this out of memory error... or more examples from others who seen the same thing.
@tdonohue no problem, I understand. We can actually close it. At least it is on the record now for anyone searching.
Same problem here (only in development mode "yarn start:dev" not in for build:prod").
export NODE_OPTIONS=--max-old-space-size=4096
fixes the problem. Can this be fixed permanently so that not all run into the same problem?
only occurs with 7.6.
Me and my colleague ran into the same problem with our Ubuntu development machines and DSpace 7.6.
Perhaps we can just make sure there is enough memory in package.json
for start:dev
Like this?
"start:dev": "nodemon --exec \"cross-env NODE_OPTIONS=--max-old-space-size=4096 NODE_ENV=development yarn run serve\"",
And of course it would be interesting to know, why there is an increase in memory usage for start:dev
in 7.6.
Reopening, as this still seems to be occurring for some folks.
Via Slack, @MW3000 found an important clue in https://stackoverflow.com/a/64120041 . It appears the default value for V8/Node memory may differ on various systems/OSes.
My best guess is that when this memory defaults to a lower value, occasionally not enough memory may be provided to allow the DSpace UI to run in development mode. It's unclear why this started with 7.6. 7.6 did include an upgrade from Angular 13->15. It could have been a side effect of that, or a side effect of one of the other major features added to 7.6.
Regardless, for anyone encountering this issue, the known fix is to increase max-old-space-size
to 4GB or greater via NODE_OPTIONS
:
export NODE_OPTIONS=--max-old-space-size=4096
Notes on this have been added to our "Common Installation Issues": https://wiki.lyrasis.org/display/DSDOC7x/Installing+DSpace#InstallingDSpace-Javascriptheapoutofmemory
NODE_OPTIONS=--max-old-space-size=4096 yarn start:prod yarn run v1.22.19 $ yarn run build:prod && cross-env NODE_ENV=production yarn run serve:ssr $ cross-env NODE_ENV=production yarn run build:ssr $ ng build --configuration production && ng run dspace-angular:server:production ⠦ Generating browser application bundles (phase: building)...Killed error Command failed with exit code 137. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 137. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 137. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This error occurs in production
Not an issue with DSpace Angular frontend per se, but I'm running into this often and haven't seen any discussion here so I will file this as a reference.
This is on the
main
branch around DSpace 7.5 and DSpace 7.6 (Angular 13 and 15). Node version is v18.15.0. System has 16GB of memory and there are several gigs free.