Closed
Description
What happened?
Hi,
After Running Selenium for 2-3 hours I get:
2023-09-14T07:27:08.185-05:00 Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.185-05:00 Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver process to start. ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.193-05:00 java.io.UncheckedIOException: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.193-05:00 Caused by: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.193-05:00 Caused by: java.io.UncheckedIOException: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.193-05:00 Caused by: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.199-05:00 java.io.UncheckedIOException: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.199-05:00 Caused by: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.199-05:00 Caused by: java.io.UncheckedIOException: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
How can we reproduce the issue?
I was running my my Selenium process with the following DockerFile for 2-3 hours. After that, the issue starts appearing.
ARG CHROME_VERSION=115.0
# See https://hub.docker.com/r/selenium/standalone-chrome for Selenium standalone
# to fix a version, put '115.0' or such
# Stage 1: Pre-built Selenium Standalone Chrome image
FROM selenium/standalone-chrome:${CHROME_VERSION} as chrome
# Stage 2: Use Amazon Corretto as the base image, can also do 'FROM amazoncorretto:17' to get latest
FROM amazoncorretto:17.0.8-al2
# Currently using latest corretto; if need to fix a version then do amazoncorretto:17.0.8-al2
#https://stackoverflow.com/questions/45323271/how-to-run-selenium-with-chrome-in-docker
#https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-on-wsl-windows-subsystem-for-linux
# Install necessary dependencies to run chrome in headless mode
RUN yum install -y libX11 libXcomposite libXcursor libXdamage libXext libXi libXtst cups-libs libXScrnSaver libXrandr alsa-lib pango atk at-spi2-atk gtk3
# Copy Chrome and ChromeDriver from the first stage
COPY --from=chrome /usr/bin/chromedriver /usr/bin/chromedriver
COPY --from=chrome /opt/google/chrome/ /opt/google/chrome/
# Set environment variables for Chrome and ChromeDriver
ENV CHROME_BIN=/opt/google/chrome/google-chrome
ENV CHROMEDRIVER_BIN=/usr/bin/chromedriver
# In the original consulting file CHROMEDRIVER_PORT, CHROMEDRIVER_WHITELISTED_IPS, and CHROMEDRIVER_URL_BASE are not set
ENV CHROMEDRIVER_PORT 4444
ENV CHROMEDRIVER_WHITELISTED_IPS "127.0.0.1"
ENV CHROMEDRIVER_URL_BASE ''
# App Setup
EXPOSE 8080
EXPOSE 5005
# Copy application JAR into the image
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
# Run application
ENTRYPOINT ["java","-jar", "-Xmx600m", "/app.jar"]
### Relevant log output
```shell
2023-09-14T07:27:08.185-05:00 Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.185-05:00 Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver process to start. ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.193-05:00 java.io.UncheckedIOException: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.193-05:00 Caused by: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.193-05:00 Caused by: java.io.UncheckedIOException: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.193-05:00 Caused by: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.199-05:00 java.io.UncheckedIOException: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.199-05:00 Caused by: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
2023-09-14T07:27:08.199-05:00 Caused by: java.io.UncheckedIOException: java.io.IOException: Too many open files ecs/my-app-container/546ee453bfd44bee88fed350f9d80bee
### Operating System
AWS Linux
### Selenium version
Java 17, selenium version 4.12.1
### What are the browser(s) and version(s) where you see this issue?
I am using chromedriver
### What are the browser driver(s) and version(s) where you see this issue?
I am using tandalone-chrome
### Are you using Selenium Grid?
No