Skip to content

[🐛 Bug]: Hanging SelectorManager Threads after the request has been processed on selenium grid and the driver is given the quit command. #12206

Closed
@ghost

Description

What happened?

On rendering a url on selenium grid, even after a session is closed and completed, the Selector manager threads in case of jdk http client and in case of default http client, AsycHttpClient threads are hanging even long after the session is closed on the grid.
Screenshot 2023-06-15 at 1 56 41 PM

How can we reproduce the issue?

public Optional<WebData> runSelenium(String domain) {
    var capabilities = Optional.of(new ChromeOptions())
        .map(options -> options.addArguments(List.of("--headless=new",
            "--disable-application-cache",
            "--disable-features=IsolateOrigins,site-per-process",
            "--no-sandbox",
            "--disable-dev-shm-usage",
            "--disable-web-security",
            "--disable-blink-features=AutomationControlled",
            "--disable-site-isolation-trials",
            "--remote-allow-origins=*",
            "--disable-popup-blocking"
        )))
        .map(options -> options.addArguments("--user,agent="
            + "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0"
            + ".3945.117 Safari/537.36"))
        .map(options -> (ChromeOptions) options.setPageLoadStrategy(PageLoadStrategy.fromString("normal")))
        .map(options -> (ChromeOptions) options.setPageLoadTimeout(Duration.ofSeconds(60)))
        .map(options -> (ChromeOptions) options.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.DISMISS))
        .get();
    var url = new URL("http://localhost:4444/wd/hub");
    var driver = new RemoteWebDriver(url, capabilities, false);

    try {

      driver.switchTo().newWindow(WindowType.WINDOW);
      driver.get("http://" + "google.com");
      driver.close();

      driver.switchTo().newWindow(WindowType.WINDOW);
      driver.get("http://" + "phonepe.com");
      driver.close();
    } catch (Exception e) {

    }


    return Optional.empty();
  }

Relevant log output

.

Operating System

macOs, Debian GNU/Linux 10

Selenium version

Java 17

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

Chrome 113

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

chromedriver-113.0-grid-4.9.1-20230508

Are you using Selenium Grid?

4.9.1-20230508

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions