🐛 [Bug] FATAL ERROR In Backend Tests, Because We Run Out Of Memory
Created by: Tirokk
🐛 Bug Report
FATAL ERROR in backend tests, because we run out of memory. Same happens often in GitHub Actions. See screen shot:
Locale:
GitHub Actions:
Additional Informations
Possible Reasons
- See https://github.com/facebook/jest/issues/7874
- May use jest v27 or v28 or later? We have v~25.3.0 …
Show Memory Usage
https://stackoverflow.com/questions/62885390/my-jests-tests-are-leaking-memory-how-can-i-fix-this
Solutions
-
We solved this now temporarily by increasing the JS memory from 2 GB to 8 GB done here #5139 . -
A possible additional solution can be to split the backend tests in two parts. - In lokal development have to commands and run one after the other.
- In GitHub Actions have two Neo4j databases on two GitHub Actions runners.
-
A Node versions upgrade to v14.20.0 or 16.16.0 seems to help, see: -
issue #5175 (closed)
-
PR #5176
But this is just because the heap size seems not to be limited to 2 GB.
Like you can see if you add --logHeapUsage
to the jest test call.
Or even change the call to cross-env NODE_ENV=test node --expose-gc ./node_modules/.bin/jest --runInBand --logHeapUsage
.