Upgrading to selenium/standalone-chrome:127.0 Gives 'DevToolsActivePort file doesn't exist' and cannot start chrome

156 views
Skip to first unread message

EuclidHeron

unread,
Oct 1, 2024, 8:20:11 PM10/1/24
to Selenium Users
Hi,

Apologies if I am not asking in the right forums; I did my research and it seems like the issue was seen before ('DevToolsActivePort file doesn't exist'), but not when upgrading from standalone-chrome 126.0 to 127.0 .
I have the following docker file and everything works fine (I can make calls to websites, etc) with with 126.0 using headless=new . But when I upgrade to 127.0 I get an error (note 'session not created: DevToolsActivePort file doesn't exist'), even when I am on the latest version of the selenium Java libraries (4.25.0). Does anyone know a solution or how to diagnose? Error is:

```
Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally. (session not created: DevToolsActivePort file doesn't exist) (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Host info: host: '564b16878950', ip: '172.17.0.2' Build info: version: '4.25.0', revision: '8a8aea2337' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.6.16-linuxkit', java.version: '17.0.11' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [user-agent=Mozilla/5.0 (Mac..., --disable-extensions, --disable-gpu, --no-sandbox, --incognito, --disable-application-cache, --disable-dev-shm-usage], extensions: []}, pageLoadStrategy: eager}]}]' ExceptionUtils.getStackTrace='org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally. (session not created: DevToolsActivePort file doesn't exist) (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Host info: host: '564b16878950', ip: '172.17.0.2' Build info: version: '4.25.0', revision: '8a8aea2337' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.6.16-linuxkit', java.version: '17.0.11' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [user-agent=Mozilla/5.0 (Mac..., --disable-extensions, --disable-gpu, --no-sandbox, --incognito, --disable-application-cache, --disable-dev-shm-usage], extensions: []}, pageLoadStrategy: eager}]}] at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:162) at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174) at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)
```



I am already using:

```
chromeOptions.addArguments("--headless=new");

 arguments.add("disable-infobars");
 arguments.add("--disable-gpu");
 arguments.add("--no-sandbox");
 arguments.add("--incognito");
 arguments.add("--disable-application-cache");
 arguments.add("--disable-dev-shm-usage");
```

My Dockerfile is:
```
ARG CHROME_VERSION=127.0 # Stage 1: Pre-built Selenium Standalone Chrome image FROM selenium/standalone-chrome:${CHROME_VERSION} as chrome # See https://hub.docker.com/_/amazoncorretto # Stage 2: Use Amazon Corretto as the base image, can also do 'FROM amazoncorretto:17' to get latest FROM amazoncorretto:17.0.11-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 coreutils # 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 # Note timeout value should be set to be at least resourceleak.maxLifetimeMs ENTRYPOINT ["java","-jar", "-Xmx600m", "/app.jar"]
```


EuclidHeron

unread,
Oct 7, 2024, 10:03:23 PM10/7/24
to Selenium Users
I was able to get it working with the following. There were two main issues:
1) I thought I was using al2023 (Amazon Linux 2023) but I was using AL2
2) I needed to add some more dependencies

```
ARG CHROME_VERSION=129.0

# Stage 1: Pre-built Selenium Standalone Chrome image
FROM selenium/standalone-chrome:${CHROME_VERSION} as chrome

FROM amazoncorretto:17.0.12-al2023
RUN yum install -y libX11 libXcomposite libXcursor libXdamage libXext libXi libXtst cups-libs libXScrnSaver libXrandr alsa-lib pango atk at-spi2-atk gtk3 nss cups wget libdrm mesa-libgbm


# 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

# Copy application JAR into the image
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar

ENTRYPOINT ["java","-jar", "-Xmx600m", "/app.jar"]
```

Reply all
Reply to author
Forward
0 new messages