codeforequity-at / botium-core

The Selenium for Chatbots - Bots Testing Bots
https://www.botium.ai
MIT License
229 stars 64 forks source link

JavaScript heap out of memory while running Botium -cli run #187

Closed vedeshkm closed 5 years ago

vedeshkm commented 5 years ago

I am facing below issue while running botium-cli run. Please help

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF71468121A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810 2: 00007FF71465A5B6 node::MakeCallback+4518 3: 00007FF71465AFA0 node_module_register+2160 4: 00007FF7148EB3EE v8::internal::FatalProcessOutOfMemory+846 5: 00007FF7148EB31F v8::internal::FatalProcessOutOfMemory+639 6: 00007FF714E29304 v8::internal::Heap::MaxHeapGrowingFactor+11476 7: 00007FF714E1FA67 v8::internal::ScavengeJob::operator=+25543 8: 00007FF714E1DFDC v8::internal::ScavengeJob::operator=+18748 9: 00007FF714E26F57 v8::internal::Heap::MaxHeapGrowingFactor+2343 10: 00007FF714E26FD6 v8::internal::Heap::MaxHeapGrowingFactor+2470 11: 00007FF7149C9DD7 v8::internal::Factory::NewFillerObject+55 12: 00007FF714A61ABA v8::internal::WasmJs::Install+29530 13: 0000036E448DC5C1

I tried several methods to increase heap size. below are heap memory details.

{ total_heap_size: 9682944, total_heap_size_executable: 1048576, total_physical_size: 9682944, total_available_size: 1518467488, used_heap_size: 5384736, heap_size_limit: 1526909922, malloced_memory: 8192, peak_malloced_memory: 890096, does_zap_garbage: 0 }

codeforequity-at commented 5 years ago

Are you using the compiled version (downloaded .exe), or the NPM version (npm install -g botium-cli) ?

Is there anything happening until this error is thrown ? What happens if you start botium-cli with "--verbose" option ? You are sure you have enough memory on your machine ?

vedeshkm commented 5 years ago

i am using npm install -g botium-cli NPM version.

No error is thrown until i get heap out of memory issue and i haven't used --verbose option. How to use it?

i could see i have a heap memory of 1,5 GB, so how to scale it permanently for 8 GB?

codeforequity-at commented 5 years ago

Just run "botium-cli run --verbose"

I would say that 1,5 GB is very high amount of memory. What kind of test cases are you running ? Is it a tremendeous amount which makes it reasonable that it can run out of memory ?

vedeshkm commented 5 years ago

we have huge amount of permutations and commutations applied testcases which is causing the failure.

So need your help on how to fix this heap out of memory issue.

vedeshkm commented 5 years ago

option "--max-old-space-size=8192" helps to increase heap memory but i don't know where to provide this and execute from.

Can we add this is in package.json or anywhere else? Please suggest.

vedeshkm commented 5 years ago

Tried "botium-cli run --verbose" but no luck

full trace of issue

<--- Last few GCs --->

[6376:000001E058252660] 14887 ms: Mark-sweep 1395.5 (1425.7) -> 1395.1 (1423.2) MB, 1329.1 / 0.0 ms (average mu = 0.057, current mu = 0.015) allocation failure scavenge might not succeed [6376:000001E058252660] 14893 ms: Scavenge 1396.0 (1423.2) -> 1395.6 (1424.2) MB, 5.1 / 0.0 ms (average mu = 0.057, current mu = 0.015) allocation failure [6376:000001E058252660] 14897 ms: Scavenge 1396.5 (1424.2) -> 1396.1 (1425.7) MB, 3.3 / 0.0 ms (average mu = 0.057, current mu = 0.015) allocation failure

<--- JS stacktrace --->

==== JS stack trace =========================================

0: ExitFrame [pc: 000000F04AA5C5C1]

Security context: 0x032249b9e6e1 1: / anonymous /(aka / anonymous /) [00000392EFD83FC1] [D:\Users\me\AppData\Roaming\npm\node_modules\botium-cli\node_modules\botium-core\src\scripting\Convo.js:~103] [pc=000000F04AC99378](this=0x013c065026f1 ,step=0x01b3bd9c37b1 ) 2: arguments adaptor frame: 3->1 3: _expandConvo [000000D2ACFF...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF75566121A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810 2: 00007FF75563A5B6 node::MakeCallback+4518 3: 00007FF75563AFA0 node_module_register+2160 4: 00007FF7558CB3EE v8::internal::FatalProcessOutOfMemory+846 5: 00007FF7558CB31F v8::internal::FatalProcessOutOfMemory+639 6: 00007FF755E09304 v8::internal::Heap::MaxHeapGrowingFactor+11476 7: 00007FF755DFFA67 v8::internal::ScavengeJob::operator=+25543 8: 00007FF755DFDFDC v8::internal::ScavengeJob::operator=+18748 9: 00007FF755E06F57 v8::internal::Heap::MaxHeapGrowingFactor+2343 10: 00007FF755E06FD6 v8::internal::Heap::MaxHeapGrowingFactor+2470 11: 00007FF7559A9DD7 v8::internal::Factory::NewFillerObject+55 12: 00007FF755A41ABA v8::internal::WasmJs::Install+29530 13: 000000F04AA5C5C1

codeforequity-at commented 5 years ago

So this is not really a Botium topic.

To my knoweldge, the best option is to set the NODE_OPTIONS environment variable before running the botium-cli:

set NODE_OPTIONS=--max_old_space_size=4096 (or export NODE_OPTIONS... on Linux or Windows Bash).

Another option is to manually change the botium-cli.cmd batch script, in you case it should be located here: D:\Users\me\AppData\Roaming\npm\

vedeshkm commented 5 years ago

Where to set NODE_OPTIONS?

to which directory should i need to point to?

codeforequity-at commented 5 years ago

NODE_OPTIONS is an environment variable. you Can set it in your shell before running botium-cli.

vedeshkm commented 5 years ago

what needs to be changed in botium-cli.cmd?

below is what present in botium-cli cmd

@IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "%~dp0\node_modules\botium-cli\bin\botium-cli.js" % ) ELSE ( @SETLOCAL @SET PATHEXT=%PATHEXT:;.JS;=;% node "%~dp0\node_modules\botium-cli\bin\botium-cli.js" % )

codeforequity-at commented 5 years ago

You can add the "--max_old_space_size=4096" to the node.exe call for example, there are several options for heap configuration in Node (but please don't ask me about them, please consult Node.js documentation for this).

vedeshkm commented 5 years ago

is this way is correct?

@IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "--max_old_space_size=8192" "%~dp0\node_modules\botium-cli\bin\botium-cli.js" % ) ELSE ( @SETLOCAL @SET PATHEXT=%PATHEXT:;.JS;=;% node "%~dp0\node_modules\botium-cli\bin\botium-cli.js" % )

codeforequity-at commented 5 years ago

Yes, I would add it to the last line as well (depending on your machine it will either result in the upper or the lower call to node.exe).

vedeshkm commented 5 years ago

You meant like below?

@IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "--max_old_space_size=8192" "%~dp0\node_modules\botium-cli\bin\botium-cli.js" % ) ELSE ( @SETLOCAL @SET PATHEXT=%PATHEXT:;.JS;=;% node "--max_old_space_size=8192" "%~dp0\node_modules\botium-cli\bin\botium-cli.js" % )

codeforequity-at commented 5 years ago

yes

Am Fr., 18. Jän. 2019, 00:07 hat vedeshkm notifications@github.com geschrieben:

You meant like below?

@if https://github.com/if EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "--max_old_space_size=8192" "%~dp0\node_modules\botium-cli\bin\botium-cli.js" % ) ELSE ( @SETLOCAL https://github.com/SETLOCAL @set https://github.com/set PATHEXT=%PATHEXT:;.JS;=;% node "--max_old_space_size=8192" "%~dp0\node_modules\botium-cli\bin\botium-cli.js" % )

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/codeforequity-at/botium-core/issues/187#issuecomment-455365927, or mute the thread https://github.com/notifications/unsubscribe-auth/AZEdT8XPDQalq4_MyCvXFchOZXqdKxgJks5vEQI2gaJpZM4aEuGZ .

codeforequity-at commented 5 years ago

success ?

vedeshkm commented 5 years ago

Hi,

Nope, tried a lot but not succeeded.

Is there any way we could tell Botium what is the heap memory it should use?

Also any idea on below error statement?

[8768:000001F6F003A1E0] 349462 ms: Scavenge 8156.4 (8329.0) -> 8156.0 (8330.0) MB, 33.5 / 0.0 ms (average mu = 0.091, current mu = 0.052) allocation failure

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.