New issue
Advanced search Search tips
Starred by 15 users

Issue metadata

Status: Unconfirmed
Owner: ----



Sign in to add a comment

Chromedriver leaves forked Chrome instances hanging with large CPU load

Reported by foldig...@gmail.com, Mar 12 Back to list

Issue description

Issue Description:
Whenever a test started with ChromeDriver (2.36 - Latest) it launches a Chrome instance (65 - Latest) then the forked instance stays as a process after the test finished. It is running with high CPU load (~25-30% per each). It can be reproduced multiple times so that the CPU usage can make the endpoint crawl. 

Steps to reproduce (if relevant, you MUST provide a simplified html page or
link to public site):
0. Prerequisites:
- ChromeDriver (2.36) 
- Chrome 65 x64
- Windows 10 x64
- Desktop
- NodeJS (v8.10.0)
1. Run at least 1 failing test with CucumberJS and Protractor ("cucumber": "^1.3.0","protractor": "^5.1.1").
2. Examine the processes in Task manager.

Actual result:
2. The chromedriver.exe stops 4-5 secs after the tests completed. Then the forked Chrome instances stay in the background as running processes with huge CPU usage.

Expected result:
2. The chromedriver.exe should stop and its Chrome instances as well.





 
i205^cimgpsh_orig.png
90.5 KB View Download
Since the latest stable Chrome version (v65) + latest Chromedriver(2.36) I can reproduce this issue whenever I trigger them with my tests.

Symptoms:
Executing tests resulted in ~100% of CPU load and additional memory usage. This behaviour negatively affects my test results.
Closing the chrome instances, some of them are still running in the background.

My expectation in terms of test execution is to automatically close the chrome/chromedriver and all of its instances (started by script) by finishing the test run.
This is the status of the task manager on windows after executing a single threaded test with ChromeDriver v2.36. The test has been crushed by the overloaded CPU.
chrome.png
47.5 KB View Download
Things I've tried but did not resolve the issue:
reinstall chrome (v65 x64)
disable and remove extensions
run it without a single chrome instance open in the background
delete npm-cache
redo npm i
update to npm 5.7 (latest)
update to node 8 (latest LTS)
update windows 10: Version 10.0.16299.248

Any other ideas?
Labels: Needs-Feedback
Please share your protractor project code so we could run it on our side.
Please describe the repro steps for your code.
Also please attach the chromedriver verbose log file to this bug.




Regarding #4

I am unable to share it since it is a corporate project.




I have also tested in the following configs and it is the same:
 - Chrome v65 / Chromedriver 2.33
 - Chrome v65 / Chromedriver 2.34
 - Chrome v65 / Chromedriver 2.35
 - Chrome v65 / Chromedriver 2.36
 - Chrome DEV v66 / Chromedriver 2.36

Note, that this issue did not exist with the following configs and before:
 - Chrome v64 / Chromedriver 2.35
 - Chrome DEV v66 / Chromedriver 2.35
 - Chrome BETA v65 / Chromedriver 2.35

There was no change neither on framework nor on Protractor side, both working scripts and current are using same configuration and code base.

I might be able to attack a log file which does not contain sensitive information. Which part of logs would be necessary to have? (I guess initialization of drivers/devtools and destuction of drivers.)

Comment 7 Deleted

You have opts.addArguments("--no-sandbox"); in your code? I have a similar problem if I use this option
Yes, it seems that was the problem because when we removed it the issue is fixed.
Do you have any info about why it is causing this issue?
No, I just ran into a similar problem, and I found out that this option affects the repeatability.
Sorry, but without a repro code we can't tell you what was the problem.
Please anybody of you provide a repro code.

We were not able to reproduce this issue on our side.

Starting ChromeDriver 2.37.543619 (a237acd3116cac3b3f0da42a000502ce3fafcb23) on port 31953
Only local connections are allowed.
Mar 21, 2018 1:30:28 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

===============================================
Default Suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================

The following code was run with launched multiple instances of Chrome.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.util.concurrent.TimeUnit;

public class Issue2311 {

  private static WebDriver driver;

  @BeforeClass
  public static void setup() {
    ChromeOptions opts = new ChromeOptions();
    opts.addArguments("--no-sandbox");
    driver = new ChromeDriver(opts);
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  }

  @Test
  public void test(){
    driver.get("https://google.com");
    //we have 6 chrome.exe processes
    driver.quit();
    //2 processes chrome.exe are not stop
  }
}

We have a same issue on Win10 & Win7 machines with Chrome x64 v65.0.3325.181 and Chrome driver v.2.37 (v.2.36 also doesn't help).
In Task Manager I see 2 instances(each for created session) of Chrome hanging in processes and eating ~12% of CPU on i7 4790, which is really painful.

In %TEMP% folder I see two folders scoped_dir%ID%, where I have only file with name CrashpadMetrics-active.pma and size 1024 KB. I can't delete this file(and folders) until I kill Chrome processes that hang.
Attaching one of the file here.
CrashpadMetrics-active.pma
1.0 MB Download
You can monitor chromedriver.exe process with procmon tool.

Please track in your test scenario how many driver.quit(); are being called. If all the driver.quit(); calls passed true but you still see chromedriver.exe is showing up in task manager, then please attach the procmon.pml and chromedriver verbose log files to this bug.

Also I would suggest you to take a look at events logs in your system.


Comment 17 by m...@zentelia.com, Apr 18 (3 days ago)

I experience the exact same issue. I am running the 

ChromeDriver 2.37.543627
Java lib.    3.11.0
Chrome       65.0.3325.181

I also have Version 68.0.3399.0 (Official Build) canary (64-bit) installed but I am not running any test on it. Here is the log entry for class submitted by khachatryan@chromium.org which reads as follows 

////////////////////////////////////////

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.util.concurrent.TimeUnit;

public class Issue2311 {


    private static WebDriver driver;

    @BeforeClass
    public static void setup() {
        System.setProperty("webdriver.chrome.logfile", "c:\\temp\\chromedriver.log");
        System.setProperty("webdriver.chrome.verboseLogging", "true");
        System.setProperty("webdriver.chrome.driver", "c:\\temp\\chromedriver.exe");
        ChromeOptions opts = new ChromeOptions();
        opts.addArguments("--no-sandbox");
        driver = new ChromeDriver(opts);
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    }

    @Test
    public void test(){
        driver.get("https://google.com");
        //we have 6 chrome.exe processes

        driver.quit();
        //2 processes chrome.exe are not stop
    }
}
 
////////////////////////////////////////

I tried the same thing with the a AfterClass fixture which has the same behaviour. 



chromedriver.log
23.7 KB View Download

Sign in to add a comment