Protractor: Launcher uncaught exception

Created on 18 Jul 2016  路  22Comments  路  Source: angular/protractor

Should log the error if the error is unknown and is being thrown.

lib/launcher.ts#L182

} else {
  logger.error(e);
  process.exit(ProtractorError.CODE);
}
bug

Most helpful comment

@cnishina i think that version 4.0.0 suffer of various instabilities.

i was having the issue of this ticket; now that i disclosed the error with your suggestion i get:

./node_modules/protractor/bin/protractor tests/end2end/protractor-coverage.config.js
[17:51:07] I/local - Starting selenium standalone server...
[17:51:07] I/launcher - Running 1 instances of WebDriver
[17:51:08] I/local - Selenium standalone server started at http://10.13.17.141:39838/wd/hub
[17:51:10] E/launcher - { [WebDriverError: Connection reset] name: 'WebDriverError' }
[17:51:10] E/launcher - Process exited with error code 199

it seems that passing from protractor binary, the ip choosen for the selenium webdriver is a randomom one from the pool of the laptop of the user and this causes errors depending on the network configuration.

i would suggest that you allow the user to specify the address of the standalone selenium or you adopt forcefully the 127.0.0.1

All 22 comments

@cnishina i think that version 4.0.0 suffer of various instabilities.

i was having the issue of this ticket; now that i disclosed the error with your suggestion i get:

./node_modules/protractor/bin/protractor tests/end2end/protractor-coverage.config.js
[17:51:07] I/local - Starting selenium standalone server...
[17:51:07] I/launcher - Running 1 instances of WebDriver
[17:51:08] I/local - Selenium standalone server started at http://10.13.17.141:39838/wd/hub
[17:51:10] E/launcher - { [WebDriverError: Connection reset] name: 'WebDriverError' }
[17:51:10] E/launcher - Process exited with error code 199

it seems that passing from protractor binary, the ip choosen for the selenium webdriver is a randomom one from the pool of the laptop of the user and this causes errors depending on the network configuration.

i would suggest that you allow the user to specify the address of the standalone selenium or you adopt forcefully the 127.0.0.1

Looking at the options for selenium standalone server (https://github.com/SeleniumHQ/selenium/blob/master/java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java#L30), it does not look like we can set the ip address of the server. This does not appear to be an issue on my end.

cat conf.js
// An example configuration file.
exports.config = {
  localSeleniumStandaloneOpts: {
    port: 4444
  },
capabilities: {
    'browserName': 'chrome'
  },
...
protractor conf.js      
[11:13:04] I/local - Starting selenium standalone server...
[11:13:04] I/launcher - Running 1 instances of WebDriver
[11:13:04] I/local - Selenium standalone server started at http://172.31.68.184:4444/wd/hub
Started
...


3 specs, 0 failures
Finished in 4.744 seconds
[11:13:12] I/local - Shutting down selenium standalone server.
[11:13:12] I/launcher - 0 instance(s) of WebDriver still running
[11:13:12] I/launcher - chrome #01 passed

Hmmm... looks like that error is not very helpful. Could you try this out? I might need to revise my PR.

} else {
  logger.error(e);
  logger.error(e.stack);
  process.exit(ProtractorError.CODE);
}
evilaliv3@remotehost:~/Devel/GlobaLeaks/client$ ./node_modules/protractor/bin/protractor tests/end2end/protractor-coverage.config.js 
[21:32:39] I/local - Starting selenium standalone server...
[21:32:39] I/launcher - Running 1 instances of WebDriver
[21:32:39] I/local - Selenium standalone server started at http://192.168.1.100:48788/wd/hub
[21:32:42] E/launcher - { [WebDriverError: Connection reset] name: 'WebDriverError' }
[21:32:42] E/launcher - WebDriverError: Connection reset
    at WebDriverError (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:10)
    at Object.checkLegacyResponse (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15)
    at parseHttpResponse (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13)
    at /home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11
    at ManagedPromise.invokeCallback_ (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14)
    at TaskQueue.execute_ (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14)
    at TaskQueue.executeNext_ (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21)
    at /home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2820:25
    at /home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:639:7
    at process._tickCallback (node.js:369:9)
From: Task: WebDriver.createSession()
    at Function.createSession (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
    at Builder.build (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/node_modules/selenium-webdriver/builder.js:458:24)
    at Local.DriverProvider.getNewDriver (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
    at Runner.createBrowser (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/built/runner.js:187:43)
    at /home/evilaliv3/Devel/GlobaLeaks/client/node_modules/protractor/built/runner.js:261:30
    at _fulfilled (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:796:13)
    at /home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:604:44
    at runSingle (/home/evilaliv3/Devel/GlobaLeaks/client/node_modules/q/q.js:137:13)
[21:32:42] E/launcher - Process exited with error code 199

francly anyhow the reason of the failure is so unclear

@evilaliv3 this exact same test worked in Protractor 3.3.0?

Also, could you share your config file?

I was using successfully grunt-protractor-runner that uses grunt ^3.0.0.

my config file is:
https://github.com/globaleaks/GlobaLeaks/blob/master/client/tests/end2end/protractor-coverage.config.js

Having similar issue here - allways seeing this at end of (successfully executed) tests:

[13:32:56] E/launcher - "process.on('uncaughtException'" error, see launcher
[13:32:56] E/launcher - Process exited with error code 199

with protractor 4.0.0. and chromedriver 2.22 - did not have this before the update to 4.0.0 - our tests did run without these problems before. and the chrome browser does not get closed anymore now (seems to fail there somehow).

+1 also having this same issue with Protractor on our Jenkins server, and Jenkins is flagging the uncaughtException errors as failures. I'm going to have to downgrade to 3.3.0 until this is fixed.

I was getting this on protractor v4 as well. Below is the function that seem to cause the problem as removing it doesn't have this issue.

    self.waitForLightboxToFadeOut = function () {
        var EC = protractor.ExpectedConditions;

        return browser.wait(EC.invisibilityOf($('.ngdialog')), 3000);
    }

Just to clarify the test will pass with the above code but you get the following error at the end

[13:32:56] E/launcher - "process.on('uncaughtException'" error, see launcher
[13:32:56] E/launcher - Process exited with error code 199

thanks @cuongluu8; i'm going to test immediately the same fix so to see if it fix the issue also on our side.

To work around this problem I used the following code instead

ElementFinder.prototype.isPresentAndDisplayed = function () {
    var self = this;

    return self.isPresent().then(function (present) {
        if (present) {
            return self.isDisplayed();
        }

        return false;
    });
};

ElementFinder.prototype.waitToBeHidden = function (timeout) {
    var self = this;
    timeout = Number.isInteger(timeout) ? timeout : 5000;

    return browser.wait(function() {
        return self.isPresentAndDisplayed()
            .then(function (displayed) {
                return !displayed;
            });
    }, timeout, 'timed out waiting for element to be hidden');
};
   self.waitForLightboxToFadeOut = function () {
        return element(by.css('.ngdialog')).waitToBeHidden()
    }

@cuongluu8 if i'm not wrong anyhow this are all functions implemented in your test that maybe were failing due to errors in your code.

we should first identify a small function reproducing the issue and identify what change in protractor may have opened this bug.

when "E/launcher - "process.on('uncaughtException'" error, see launcher
[13:32:56] E/launcher - Process exited with error code 199" occur, how to config to debug where the problem is?

Please upgrade your protractor version. This was addressed a while ago.

my protractor version is V4.0.0, does it need higher version? @cnishina

i updated protractor to V4.0.4, and it works good, thank you. @cnishina

**My protractor version is Version 4.0.11. still facing the issue.

jenkins@keshav-Aspire-V5-573G:/tmp/TestBaseProject$ npm test**

[email protected] test /tmp/TestBaseProject
grunt test && maven site

Running "jshint:files" (jshint) task

4 files lint free.

Running "protractor_webdriver:start" (protractor_webdriver) task
Starting Selenium server
Started Selenium server: http://127.0.0.1:4444

Running "protractor:singlerun" (protractor) task
[22:41:47] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[22:41:47] I/launcher - Running 1 instances of WebDriver
Session created: count=1, browserName=chrome
Exception thrown: Keeping the Selenium server alive
[22:42:48] E/launcher - unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-45-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.15 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'keshav-Aspire-V5-573G', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-45-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
[22:42:48] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e),platform=Linux 4.4.0-45-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.15 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'keshav-Aspire-V5-573G', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-45-generic', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
at WebDriverError (/tmp/TestBaseProject/node_modules/selenium-webdriver/lib/error.js:27:10)
at Object.checkLegacyResponse (/tmp/TestBaseProject/node_modules/selenium-webdriver/lib/error.js:639:15)
at parseHttpResponse (/tmp/TestBaseProject/node_modules/selenium-webdriver/http/index.js:538:13)
at /tmp/TestBaseProject/node_modules/selenium-webdriver/http/index.js:472:11
at ManagedPromise.invokeCallback_ (/tmp/TestBaseProject/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/tmp/TestBaseProject/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/tmp/TestBaseProject/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at /tmp/TestBaseProject/node_modules/selenium-webdriver/lib/promise.js:2820:25
at /tmp/TestBaseProject/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (node.js:368:9)
From: Task: WebDriver.createSession()
at Function.createSession (/tmp/TestBaseProject/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Builder.build (/tmp/TestBaseProject/node_modules/selenium-webdriver/builder.js:458:24)
at Hosted.DriverProvider.getNewDriver (/tmp/TestBaseProject/node_modules/protractor/built/driverProviders/driverProvider.js:37:33)
at Runner.createBrowser (/tmp/TestBaseProject/node_modules/protractor/built/runner.js:197:43)
at /tmp/TestBaseProject/node_modules/protractor/built/runner.js:276:30
at _fulfilled (/tmp/TestBaseProject/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/tmp/TestBaseProject/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/tmp/TestBaseProject/node_modules/q/q.js:796:13)
at /tmp/TestBaseProject/node_modules/q/q.js:556:49
at runSingle (/tmp/TestBaseProject/node_modules/q/q.js:137:13)
at flush (/tmp/TestBaseProject/node_modules/q/q.js:125:13)
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)
at Function.Module.runMain (module.js:444:11)
at startup (node.js:136:18)
at node.js:966:3
[22:42:48] E/launcher - Process exited with error code 199

Warning: Tests failed, protractor exited with code: 199 Use --force to continue.

Aborted due to warnings.
npm ERR! Test failed. See above for more details.

You will need to set ignoreUncaughtExceptions: true in conf.js

Getting same error in
Protractor version - 5.1.2
Google chrome version - 58.0.3029.96
chromedriver=2.30.477691
node - 6.10.2

Can you suggest me a working combination?

+1 getting the same error.
Ignoring uncaught error TypeError: callback is not a function
[17:13:50] E/launcher - BUG: launcher exited with 1 tasks remaining

npm --version : 5.0.3
node --version: v8.1.3
"protractor": "5.1.2",
"cucumber": "2.3.1",

Replicating same error.

Protractor version - 5.1.2
Google chrome - Version 61.0.3163.100
chromedriver=2.33
node - 6.11.3

[13:31:18] E/launcher - WebDriverError: chrome not reachable
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d902
3f),platform=Windows NT 10.0.10586 x86_64) (WARNING: The server did not provide
any stacktrace information)
Command duration or timeout: 60.38 seconds
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:40
.131Z'
System info: host: 'TL77', ip: '172.16.17.59', os.name: 'Windows 10', os.arch: '
amd64', os.version: '10.0', java.version: '9'
Driver info: driver.version: unknown
at WebDriverError (C:UsersvineethvasudevanAppDataRoamingnpmnode_module
sprotractornode_modulesselenium-webdriverliberror.js:27:5)
at Object.checkLegacyResponse (C:UsersvineethvasudevanAppDataRoamingnpm
node_modulesprotractornode_modulesselenium-webdriverliberror.js:505:15)
at parseHttpResponse (C:UsersvineethvasudevanAppDataRoamingnpmnode_mod
ulesprotractornode_modulesselenium-webdriverlibhttp.js:509:13)
at doSend.then.response (C:UsersvineethvasudevanAppDataRoamingnpmnode_
modulesprotractornode_modulesselenium-webdriverlibhttp.js:440:13)
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
at Function.createSession (C:UsersvineethvasudevanAppDataRoamingnpmnod
e_modulesprotractornode_modulesselenium-webdriverlibwebdriver.js:777:24)
at Function.createSession (C:UsersvineethvasudevanAppDataRoamingnpmnod
e_modulesprotractornode_modulesselenium-webdriverchrome.js:709:29)
at createDriver (C:UsersvineethvasudevanAppDataRoamingnpmnode_modules
protractornode_modulesselenium-webdriverindex.js:167:33)
at Builder.build (C:UsersvineethvasudevanAppDataRoamingnpmnode_modulesprotractornode_modulesselenium-webdriverind
ex.js:623:16)
at Local.getNewDriver (C:UsersvineethvasudevanAppDataRoamingnpmnode_modulesprotractorlibdriverProvidersdriverProv
ider.ts:60:29)
at Runner.createBrowser (C:UsersvineethvasudevanAppDataRoamingnpmnode_modulesprotractorlibrunner.ts:225:39)
at q.then.then (C:UsersvineethvasudevanAppDataRoamingnpmnode_modulesprotractorlibrunner.ts:391:27)
at _fulfilled (C:UsersvineethvasudevanAppDataRoamingnpmnode_modulesprotractornode_modulesqq.js:834:54)
at self.promiseDispatch.done (C:UsersvineethvasudevanAppDataRoamingnpmnode_modulesprotractornode_modulesqq.js:863
:30)
at Promise.promise.promiseDispatch (C:UsersvineethvasudevanAppDataRoamingnpmnode_modulesprotractornode_modulesqq.
js:796:13)
[13:31:18] E/launcher - Process exited with error code 199

Resolved this issue following steps.

1.Download chrome browser standalone version (v55)

  1. put it into the C:/Program Files (x86)/Google/Chrome/Application/folder.
  2. add this path in your conf.js
    here
    capabilities: {
    'browserName': 'chrome',
    //Paste path here
    'binary': '"C:/Program Files (x86)/Google/Chrome/Application/chrome64_54.0.2840.71/chrome.exe"'
    },
  3. Run it.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mvolkmann picture mvolkmann  路  3Comments

luakri picture luakri  路  3Comments

andyman3693 picture andyman3693  路  3Comments

amedvedjev picture amedvedjev  路  3Comments

psech picture psech  路  3Comments