-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Closed
Labels
C-javaJava BindingsJava BindingsI-defectSomething is not working as intendedSomething is not working as intendedJ-issue-templateApplied to issues not following the template, or missing information.Applied to issues not following the template, or missing information.
Description
What happened?
I experience memory leak in my app - selenium spawns multiple threads.
How can we reproduce the issue?
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<selenium.version>4.6.0</selenium.version>
<lombok.version>1.18.24</lombok.version>
<spring-web.version>5.3.23</spring-web.version>
<jackson-databind.version>2.14.0</jackson-databind.version>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-devtools-v107</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-http-jdk-client</artifactId>
<version>${selenium.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring-web.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
@SneakyThrows
public static void main(String[] args) {
System.setProperty("webdriver.http.factory", "jdk-http-client");
while (true) {
WebDriver driver = null;
try {
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setHeadless(false);
chromeOptions.addArguments(
"--ignore-certificate-errors",
"--auto-open-devtools-for-tabs"
);
driver = RemoteWebDriver.builder()
.augmentUsing(new Augmenter())
.oneOf(chromeOptions)
.address(GRID_URL)
.build();
driver.get("http://example.com/");
} catch (Exception e) {
log.info("Exception ", e);
} finally{
if (driver != null) {
driver.quit();
}
}
TimeUnit.SECONDS.sleep(5);
}
}
If you make thread dumps periodically - you can see that number of HttpClient-*-SelectorManager threads is increasing rather quickly (in 5 minutes I see 90 threads).
Relevant log output
no log output required
Operating System
Debian 9, Ubuntu 20.04.3
Selenium version
Java 4.6.0
What are the browser(s) and version(s) where you see this issue?
chrome 107.0
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 107.0.5304.62
Are you using Selenium Grid?
Yes, 4.6.0
Metadata
Metadata
Assignees
Labels
C-javaJava BindingsJava BindingsI-defectSomething is not working as intendedSomething is not working as intendedJ-issue-templateApplied to issues not following the template, or missing information.Applied to issues not following the template, or missing information.