Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU usage with chromedriver 124.0.6367.78 and selenium-java 4.20.0[馃悰 Bug]: #13872

Closed
dmidura opened this issue Apr 25, 2024 · 9 comments

Comments

@dmidura
Copy link

dmidura commented Apr 25, 2024

What happened?

I am seeing very high CPU usage when running automation. The Chrome processes are not quitting after the automation directs the driver to quit. Instead, they collect in the background and just add to the CPU load. This just started when chrome upgraded to 124.0.6367.79. I was running selenium-java 4.19.1, but I've tried with 4.20.0 and haven't seen an improvement.

I am on chromedriver 124.0.6367.79
I am using selenium-java 4.20.0
I am running in a Windows environment.

Can someone please tell me how to reduce the CPU load clocking for my automation?

How can we reproduce the issue?

This is my driver initialization:
        
ChromeOptions chromeOpts = new ChromeOptions();
        chromeOpts.addArguments("--window-size=1920,1080");
        chromeOpts.addArguments("--disable-gpu");
        chromeOpts.addArguments("enable-automation");
        chromeOpts.addArguments("--no-sandbox");
        chromeOpts.addArguments("--disable-infobars");
        chromeOpts.addArguments("--disable-dev-shm-usage");
        chromeOpts.addArguments("--disable-browser-side-navigation");
        chromeOpts.addArguments("--disable-gpu");
        chromeOpts.addArguments("disable-features=NetworkService");
        chromeOpts.addArguments("--disable-extensions");
        chromeOpts.addArguments("--dns-prefetch-disable");
        chromeOpts.addArguments("--remote-allow-origins=*");
        chromeOpts.setExperimentalOption("prefs", setDownloadPath());
        chromeOpts.setPageLoadStrategy(PageLoadStrategy.NORMAL);

        LoggingPreferences logPrefs = new LoggingPreferences();
        logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
        chromeOpts.setCapability("goog:loggingPrefs", logPrefs);

WebDriver driver = new ChromeDriver(chromeOpts);

// do automation with the driver

driver.quit();

Relevant log output

I can only see this is happening by looking at the running processes in my windows task manager.

Operating System

Windows 11 Enterprise

Selenium version

4.19.1, 4.20.0

What are the browser(s) and version(s) where you see this issue?

Chrome 124.0.6367.79

What are the browser driver(s) and version(s) where you see this issue?

chromedriver 124.0.6367.78

Are you using Selenium Grid?

no

Copy link

@dmidura, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@Rodaxfck
Copy link

Rodaxfck commented Apr 25, 2024

I've had the exact same problem since yesterday
Multiple running chrome processes and remaining "chromedriver.exe" after some test executions
My laptop was slower and slower and I noticed this
https://bugs.chromium.org/p/chromedriver/issues/detail?id=4744

@diemol
Copy link
Member

diemol commented Apr 25, 2024

Yes, this has been reported. Unfortunately, we cannot fix this issue as it is in Chrome.

@diemol diemol closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
@DeepakSahu-Engineer
Copy link

I have been facing this issue since last week .. This is not only about Chrome 124 it is also Happening with firefox and edge browser .

@vinoth959
Copy link
Contributor

Same issue i'm facing too.. first iteration starts fine and after the browser closes and restart then issue is back

@balivadas
Copy link

Added a comment in the chrome driver bugs link https://bugs.chromium.org/p/chromedriver/issues/detail?id=4744

"The issue still exists with chromedriver version 124.0.6367.155 and chrome browser version 124.0.6367.119.
After testcase is run, and completed (chrome driver is quit), the Google Chrome process still exists with 2 threads running consuming on an average 10% of CPU utilization.
If i run 10 testcases, it means 100% CPU utilization and this is making the system very slow.

As the original author recommended below 2 options
IMPORTANT TIPS:

  1. This is related to "--no-sandbox" browser argument. As soon as I remove this argument, I don't see "zombie processes".
  2. If I really want to use "--no-sandbox" argument, and I add "--remote-debugging-pipe", then the issue is not reproducible anymore - no "zombie" processes.

Nothing works for us.

Attached is the screenshot which shows when a simple testcase to open chrome launch google.com and close it is run 10 times and the processes still exists even after testcases are completed and browsers are closed by chrome driver.

Note: during execution, if I manually close the browser, no more zombie processes left."
2

@RileyXX
Copy link

RileyXX commented May 20, 2024

You need to call driver.close() before driver.quit() otherwise you get lingering chrome processes with high resource usage. This is an issue with recent chrome versions (124+).

@GerbenArkesteijn
Copy link

I was having the same problem.

As a possible work around you could comment out or remove chromeOpts.addArguments("--no-sandbox"); in your driver initialization. For me it reduced the CPU load.

Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants