JavaScript heap out of memory
Closed this issue · 7 comments
Hi, we just started using this test reporter with our project and love it! Sometimes the reporter throws a heap out of memory error - is there anything we can configure to help with this? We are running a kotlin and run tests with junit. this is the step:
- name: Surefire Report
if: ${{ failure() }}
uses: ScaCap/action-surefire-report@v1
with:
github_token: ${{ secrets.github_token }}
report_paths: '**/build/test-results/test/TEST-*.xml'
this is the task in our gradle file:
tasks.withType<Test> {
reports.junitXml.isEnabled = true
}
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
<--- Last few GCs --->
[1937113:0x2c650d0] 137686 ms: Scavenge 2028.3 (2034.9) -> 2028.2 (2040.2) MB, 7.4 / 0.0 ms (average mu = 0.214, current mu = 0.244) allocation failure
[1937113:0x2c650d0] 137706 ms: Scavenge 2031.5 (2040.2) -> 2031.9 (2040.9) MB, 11.7 / 0.0 ms (average mu = 0.214, current mu = 0.244) allocation failure
[1937113:0x2c650d0] 137719 ms: Scavenge 2032.1 (2040.9) -> 2031.7 (2052.2) MB, 12.1 / 0.0 ms (average mu = 0.214, current mu = 0.244) allocation failure
1: 0x9da7c0 node::Abort() [/home/ubuntu/actions-runner/externals/node12/bin/node]
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x1374fd9]
Security context: 0x0ce84d3408a1 <JSObject>
1: write [0x2b782946e3a9] [/home/ubuntu/actions-runner/_work/_actions/ScaCap/action-surefire-report/v1/dist/index.js:~2942] [pc=0x19647738b311](this=0x2ba0bf6a7ba1 <SAXParser map = 0x36e25b3f11c1>,0x2ba0bf6a7b41 <Uint8Array map = 0x2027dce65191>)
2: /* anonymous */ [0x1fdda25d8fa9] [/home/ubuntu/actions-runner/_work/_actions/ScaCap/action-surefire-report/...
2: 0x9db976 node::OnFatalError(char const*, char const*) [/home/ubuntu/actions-runner/externals/node12/bin/node]
3: 0xb39f1e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/ubuntu/actions-runner/externals/node12/bin/node]
4: 0xb3a299 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/ubuntu/actions-runner/externals/node12/bin/node]
5: 0xce5635 [/home/ubuntu/actions-runner/externals/node12/bin/node]
6: 0xce5cc6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/home/ubuntu/actions-runner/externals/node12/bin/node]
7: 0xcf1b5a v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/home/ubuntu/actions-runner/externals/node12/bin/node]
8: 0xcf2a65 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/ubuntu/actions-runner/externals/node12/bin/node]
9: 0xcf410f v8::internal::Heap::HandleGCRequest() [/home/ubuntu/actions-runner/externals/node12/bin/node]
10: 0xca30f4 v8::internal::StackGuard::HandleInterrupts() [/home/ubuntu/actions-runner/externals/node12/bin/node]
11: 0xff1af7 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [/home/ubuntu/actions-runner/externals/node12/bin/node]
12: 0x1374fd9 [/home/ubuntu/actions-runner/externals/node12/bin/node]
please let me know if there's any additional useful information i can provide!
i was able to resolve by adding this environment variable in my actions config:
env:
NODE_OPTIONS: '--max_old_space_size=4096'
Hi @dwayneyuen, I'm glad you solved it. I never hit this problem. Can you please describe your project a bit: # of files in the repo, # of tests,...
@dwayneyuen Thanks, its working for me :)
This issue gets resolve by adding this line in your code, here size-value
depends on your application size (~4096 = 4GB):
{
"scripts":{
"server":"node --max-old-space-size={size-value} server/index.js"
}
}
Alternative, checkout this answer : https://stackoverflow.com/questions/38558989/node-js-heap-out-of-memory/66914674#66914674
i was able to resolve by adding this environment variable in my actions config:
env: NODE_OPTIONS: '--max_old_space_size=4096'
Thanks, it works for me!
dwayneyuen
env:
NODE_OPTIONS: '--max_old_space_size=4096'
Thanks, It's works
i was able to resolve by adding this environment variable in my actions config:
env: NODE_OPTIONS: '--max_old_space_size=4096'
not working for me