Protractor: Chrome driver process does not auto-close (hangs around afterwards) when running local tests

Created on 2 Feb 2018  Â·  33Comments  Â·  Source: angular/protractor

See versions/conf/test spec/example from #4689 which are the same as for this issue.

On that same example that also runs a chrome test, after each time I run the test I see one more "chromedriver_2.35.exe (32 bit)" process that never closes in Task Manager. (it is automatically started by protractor, I don't manually start chromedriver nor webdriver-manager). It should automatically stop to not leak processes as it does automatically start.

Because of that some npm/webdriver update operations fail (can't delete the files/folders). I have to manually kill all the chromedriver_2.35.exe processes to be able to switch to a different protractor version for example.

This does not happen with Protractor 4.0.11. So it seems to be a regression somewhere along the way.

needs investigation

Most helpful comment

We were getting that error recently as well. I found that creating chrome driver with the "no-sandbox" argument will create extra chrome processes that hang around. We fixed it by removing this flag. Full disclosure, we aren't using protractor. I just stumbled on this when searching for solutions.

All 33 comments

Note: sometimes I have to restart Task Manager to see the lingering chromeDriver processes.

I have the same issue both with chromedriver and IEDriver.
Chromedriver: 2.36
IEDriver: 3.11.1
Protractor: 5.3.0
Webdriver-manager: 12.0.6

same issue here.

Chrome 65.0.3325.162
Protractor 5.3.0
Chromedriver 2.37
Selenium server 3.11.0

Same issue for me.

Chrome 65.0.3325.162
Protractor 5.3.0
Chromedriver 2.37
Selenium server 3.11.0

Same issue for me.

Chrome 65.0.3325.162
Protractor 5.3.0
Chromedriver 2.37
Selenium server 3.11.0

Same Here

Chrome : 65.0.3325.181
Protractor : 5.1.2
Chromedriver 2.37
Selenium server 3.11.0

Well, I too have the same issue
Chrome : 62.0.3202.94
Protractor : 5.1.2
Chromedriver 2.35
Selenium server 3.9.1
Since we have constraints to upgrade Chrome, I am still using 62 and chromedriver 2.35

Same problem with same versions as above.
Is there a solution ???
Now I have to do call taskkill /im chrome.exe /f after running a test
not really what I want :-)))

Same problem with me , is there any solution?
Chrome version : 65.0.3325.181
Protractor Version : 5.2.0
Chromedriver : 2.37

@sjelin any update on this issue ?
still actual on Chrome 66, 2.38 chromedriver

For me chrome.exe process leaves hanging and consumes 30% of CPU. Though the chrome window is automatically closed.
Node 8.9.3
protractor 4.0.4
chromedriver 2.38
Chrome 65.0.3325.181
webdriver manager 12.0.6
selenium standalone 3.11.0
Windows 8.1

Not sure when this started happening... Mb after some chrome or chromedriver update...
Around 1 month ago everything was fine with the same protractor 4.0.4.

For me chrome.exe process leaves hanging and consumes 30% of CPU. Though the chrome window is automatically closed.

Same here

For me chrome.exe process leaves hanging and consumes 30% of CPU. Though the chrome window is automatically closed.

+1

We were getting that error recently as well. I found that creating chrome driver with the "no-sandbox" argument will create extra chrome processes that hang around. We fixed it by removing this flag. Full disclosure, we aren't using protractor. I just stumbled on this when searching for solutions.

@phdrumlineka Thanks for that info. It seems that by providing the directConnect: true parameter in the conf.ts for Protractor, the chromedriver.exe will be closed after the test completes!

Thanks for the info .
directConnect: true parameter works only for Chrome and Fire Fox browsers and does not support IE11 browser
I have been using this from past 11 days . Its working awesome for Chromedriver

Reference link for the syntax on dirrect connect : https://github.com/angular/protractor/blob/master/docs/server-setup.md

Any solutions for IE driver will be more help full.

Many Thanks in advance

@phdrumlineka it works, thanks !

directConnect might work because it does things a bit differently.
Older versions used to work without it - so I still think it should get fixed.

@phdrumlineka Thanks for hint, no more extra chrome processes if removing "no-sandbox" argument.
Tried with chromedriver 2.38 (64bit) on Windows.

Related to #4572

An issue exists within chromium here: https://bugs.chromium.org/p/chromedriver/issues/detail?id=2311
It got changed from "unconfirmed" to "started" on May 1st. More traffic on that ^ issue would be helpful.

For me it was solved by removing the no-sandbox option

capabilities:
browserName: 'chrome'
shardTestFiles: false
maxInstances: 2
chromeOptions:
'args': ['no-sandbox']

For me it was solved by removing the no-sandbox argument

capabilities:
browserName: 'chrome'
shardTestFiles: false
maxInstances: 2
chromeOptions:
'args': ['no-sandbox']

2018-04-25 19:08 GMT+02:00 StasGrishaev notifications@github.com:

@sjelin https://github.com/sjelin any update on this issue ?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/angular/protractor/issues/4690#issuecomment-384362217,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQn6vPThFYbOCiKqU_eT5wXeB_5x_8uFks5tsK10gaJpZM4R3JjC
.

It might be worth noting for people. Removing the no-sandbox option does not work for dockerized chrome instances since running as root is not supported. e.g. you'll get the error "Running as root without --no-sandbox is not supported."

I'm having the same problem, but it appears that chromedriver, geckodriver and IEdriverServer stay lingering after tests.

I believe a temporary but bad solution is to kill the processes before each test.

Note: I'm not using driver quit in my specs.

Node 8.11.3
protractor 5.4.1
chromedriver 2.42
geckodriver 0.22
IEdriverServer 3.14
Chrome 69.0.3497.100
Firefox 62.0
IE 11.0.9600.18893
selenium standalone 3.14.0
Windows 7

Same here. Windows 10 and Linux aswell, Chromedriver 2.44.609551
Removing "--no-sandbox" is not an option, because DevToolsActivePort file doesn't exist error will appear.

This is also a problem on Windows 10 for me, and what is more of a concern is that IEDriverServer locks the node_modules folder from being deleted.

It looks like the related Chromedriver issue has been closed: https://bugs.chromium.org/p/chromedriver/issues/detail?id=2311

Supposedly Chrome version 71 or above resolves the issue.

Has anyone tried Chrome 71+?

It seems the issue still persists with ChromeDriver 75.0.3770.90 (stored in C:\Windows).

Executing through IntelliJ IDEA 2019.1.3 with Selenium Pytest FW, Python 3.7 on Windows 10 Pro x64 (10.0.17134), NodeJS 11.12.0

I am also experiencing the issue with 75.0.3770.90. I am running it from a git bash terminal inside VSCode and the VSCode instances stick around as well, so I end up with 30+ instances open until I task manager close them.

Solution:
Env:
Protractor : 5.3.0
Chrome : v75

We do use --no-sandbox for our continuous integration. That eventually lead to the lingering driver process even when all tests pass.

The simple solution that worked for us is explicitly closing the driver using following code. We call it after everything is done (pass/fail) inside onComplete

browser.driver.close().then(function(){
  browser.driver.quit();
});

Since this gets the env to clean slate and provides a bit of comfort, i think its the best shot there is.

Hope it helps

Solution:
Env:
Protractor : 5.3.0
Chrome : v75

We do use --no-sandbox for our continuous integration. That eventually lead to the lingering driver process even when all tests pass.

The simple solution that worked for us is explicitly closing the driver using following code. We call it after everything is done (pass/fail) inside onComplete

browser.driver.close().then(function(){
  browser.driver.quit();
});

Since this gets the env to clean slate and provides a bit of comfort, i think its the best shot there is.

Hope it helps

@rakcheru: I started facing this issue some time back. We have maxInstances = 4. After all the tests get finished, Protractor would hang on : One instance of Webdriver still running. I tried your solution and it worked. Thanks

Solution:
Env:
Protractor : 5.3.0
Chrome : v75

We do use --no-sandbox for our continuous integration. That eventually lead to the lingering driver process even when all tests pass.

The simple solution that worked for us is explicitly closing the driver using following code. We call it after everything is done (pass/fail) inside onComplete

browser.driver.close().then(function(){
  browser.driver.quit();
});

Since this gets the env to clean slate and provides a bit of comfort, i think its the best shot there is.

Hope it helps

@rakcheru I tried the above solution, but I am getting Error: TypeError: Cannot read property 'driver' of undefined

Is this browser instance from, const { browser } = require("protractor"); ?

Was this page helpful?
0 / 5 - 0 ratings