FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory -unknown cause
Bug report
- Node Version (
using npm -v):2.14.20 - Protractor Version:
3.2.1 - Browser(s):
chrome (webdriver-manager) - Operating System and Version
W10 10586.164 - Your protractor configuration file (confidential parts omitted)
// conf.js
exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
restartBrowserBetweenTests: false,
jasmineNodeOpts: {defaultTimeoutInterval: 120000, isVerbose: true},
multiCapabilities: [{'browserName': 'chrome', sharedTestFiles: false, maxInstances: 5}],
suites: {
//confidential suites(there are quite a few)
},
onPrepare: function () {
browser.ignoreSynchronization = true;
var loginPage = require('./pageObjects/loginPage.js');
loginPage.loginPage.login(confidential url, confidential user, confidential password);
browser.sleep(1000);
browser.ignoreSynchronization = false;
};
- A relevant example test: when I use the following definitions, the test runs(and obviously failed): the element defined here:
selectText: function (num) {
element(by.id('ui-tinymce-' + num + '_ifr'));
},
and through this function:
this.switchTo(this.text.selectText(0));
which is defined here:
switchTo: function (frame) {
browser.switchTo().frame(frame);
},
however when I defined it the correct way:
selectText: function (num) {
return element(by.id('ui-tinymce-' + num + '_ifr'));
},
it crashes
- Output from running the test:
DEBUG - Running with --troubleshoot
DEBUG - Protractor version: 3.2.1
DEBUG - Your base url for tests is undefined
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
DEBUG - WebDriver session successfully started with capabilities Capabilities {
'applicationCacheEnabled' => false,
'rotatable' => false,
'mobileEmulationEnabled' => false,
'chrome' => { chromedriverVersion: '2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4)',
userDataDir: 'C:\\Users\\(omitted)\\AppData\\Local\\Temp\\scoped_dir264_1068' },
'takesHeapSnapshot' => true,
'databaseEnabled' => false,
'handlesAlerts' => true,
'hasTouchScreen' => false,
'version' => '49.0.2623.87',
'platform' => 'XP',
'browserConnectionEnabled' => false,
'nativeEvents' => true,
'acceptSslCerts' => true,
'webdriver.remote.sessionid' => 'ccdd1ebb-2c71-483a-9c2b-d3653e0326dc',
'locationContextEnabled' => true,
'webStorageEnabled' => true,
'browserName' => 'chrome',
'takesScreenshot' => true,
'javascriptEnabled' => true,
'cssSelectorsEnabled' => true }
DEBUG - Running with spec files (omitted)
Started
<--- Last few GCs --->
86554 ms: Scavenge 1304.4 (1456.3) -> 1304.4 (1456.3) MB, 2.6 / 0 ms (+ 0.0 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
87847 ms: Mark-sweep 1304.4 (1456.3) -> 1203.7 (1456.3) MB, 1292.8 / 0 ms (+ 0.0 ms in 1 steps since start of marking, biggest step 0.0 ms) [last resort gc].
89313 ms: Mark-sweep 1203.7 (1456.3) -> 1301.2 (1456.3) MB, 1466.5 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 000000264A0B4639 <JS Object>
1: bind [native v8natives.js:~1197] [pc=000002C316FC7CC2] (this=0000025F457CE0C9 <JS Function onTaskCancelled_ (SharedFunctionInfo 000001FF305F7271)>,aY=000000264A081519 <an EventEmitter with map 000002D4B41A0889>)
2: arguments adaptor frame: 2->1
3: enqueue [C:\Users\...(omitted)\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:~2619] [pc=000002...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
- Steps to reproduce the bug (not the slightest clue. not even sure if this is a bug caused by protractor, jasmine, webdriver, or nodejs,)
EDIT: Switching the select function to this:
select: function (num) {
return browser.findElement(by.id('ui-tinymce-' + num + '_ifr'));
},
and switching browser.ignoreSynchronization before and after seemed to do the trick
I noticed that in your original selectText you didn't return anything. Was that intentional?
@sjelin this was to show that if the selectText fails, the code that is causing the crash is never run
Sorry, looks like a misread the original post. I've never used switchTo, but I'm pretty sure browser.switchTo().frame takes an integer or a string, not a webelement, as an argument. That said, your fix at the end seems to imply that the issue is using element() vs browser.findElement(), the difference being the former is wrapped by protractor.
@sjelin first of all sorry for the late response. regarding the browser.switchTo().frame I have no idea why, but this method works for me. Maybe it parses the output of promise browser.findElement somehow?
Could you try:
selectText: function (num) {
return element(by.id('ui-tinymce-' + num + '_ifr')).getWebElement();
},
And let me know if that fixes your problem
@sjelin so the problem was fixed before using
select: function (num) {
return browser.findElement(by.id('ui-tinymce-' + num + '_ifr'));
},
is your fix a better alternative(does it not require ignoring synchronization)? For that matter, why do I need to ignoresynchronization when switching to an iframe
Thanks!
My fix might be a better alternative not requiring ignoring synchronization, but I'll need you to try it :stuck_out_tongue:
Basically, the getWebElement unwraps protractor elements into webdriver elements.
@sjelin It seems to me that the best solution was to select the frame by number, however your solution was way better than mine :smile: !
Alright, I'm gonna close this issue then