Encountering JavaScript Heap Memory issues during the execution of our TestCafe automation test suite on our Jenkins machine running CentOS 7.7.1908 Linux.
Please find the below error message:
Last few GCs —>
[9201:0x18dd2a0] 244894 ms: Mark-sweep 1958.4 (2081.4) -> 1937.2 (2080.9) MB, 1237.4 / 0.0 ms (average mu = 0.344, current mu = 0.344) allocation failure scavenge might not succeed
[9201:0x18dd2a0] 246494 ms: Mark-sweep 1953.3 (2080.9) -> 1937.8 (2081.1) MB, 1425.7 / 0.0 ms (average mu = 0.239, current mu = 0.109) allocation failure scavenge might not succeedJS stacktrace —>
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed – JavaScript heap out of memory
1: 0x7f0508e2a268 node::Abort() [/lib64/libnode.so.93]
2: 0x7f0508d17b89 [/lib64/libnode.so.93]
3: 0x7f050a021a00 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib64/libnode.so.93]
4: 0x7f050a021dc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib64/libnode.so.93]
5: 0x7f050a1e17e5 [/lib64/libnode.so.93]
6: 0x7f050a1e18c5 [/lib64/libnode.so.93]
7: 0x7f050a1f5c5c v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/lib64/libnode.so.93]
8: 0x7f050a1f6581 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib64/libnode.so.93]
9: 0x7f050a1f9749 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib64/libnode.so.93]
10: 0x7f050a1f97d7 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib64/libnode.so.93]
11: 0x7f050a1b9fcd v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/lib64/libnode.so.93]
12: 0x7f050a55240a v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/lib64/libnode.so.93]
13: 0x7f0509f1ccf9 [/lib64/libnode.so.93]
sh: line 1: 9194 Aborted
In our package file, we currently have the following dependencies:
“dependencies”: {
“@types/lodash”: “^4.17.7”,
“@types/node”: “^20.14.11”,
“axios”: “^1.7.2”,
“csv-parse”: “^5.5.6”,
“dotenv”: “^16.4.5”,
“downloads-folder”: “^3.0.3”,
“fs-extra”: “^11.2.0”,
“image-to-base64”: “^2.2.0”,
“log4js”: “^6.9.1”,
“minimist”: “^1.2.8”,
“npm”: “^6.14.15”,
“prettier”: “^3.3.3”,
“save-dev”: “^0.0.1-security”,
“testcafe”: “^3.6.2”,
“testcafe-reporter-custom”: “^1.2.1”,
“testcafe-reporter-html”: “^1.4.6”,
“testcafe-reporter-junit”: “^3.0.2”,
“ts-node”: “^10.9.2”,
“tsc”: “^2.0.4”,
“typescript”: “^5.5.4”
},
“devDependencies”: {
“mkdirp”: “^3.0.1”
}
Node version: ‘v16.18.1’
I’ve tried few methods in my package.json file
node –max_old_space_size=1024 npm testcafe chrome <my file>
Also using process.memoryUsage() I grabbed the heap total and heap used values
{
rss: 975765504,
heapTotal: 883564544,
heapUsed: 838497000,
external: 2417679,
arrayBuffers: 156348
}
Karthik E is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.