org.openqa.selenium.WebDriverException: unknown error: session deleted because of page crash
from tab crashed
(Session info: chrome=79.0.3945.117)
org.openqa.selenium.WebDriverException: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
(Session info: chrome=79.0.3945.117)
Root Cause:
This is related to shared memory (/dev/shm) in the docker container. The application seems has some changes and it causes the chromium now complained about small /dev/shm size.
to know what is /dev/shm memory, refer this
link
Official document
docker-selenium
also mentions this problem.
default size of selenium node chrome-debug container is 64MB. This is typically too small for Chromium and will cause Chromium to crash when rendering large pages
seluser@ad8cc1964b71:/$ sudo df -h /dev/shm
Filesystem Size Used Avail Use% Mounted on
shm 64M 0 64M 0% /dev/shm
Solution:
Increase the /dev/shm size. 2 Gb is apparently working for my need.
seluser@626a09495438:/$ df -h /dev/shm
Filesystem Size Used Avail Use% Mounted on
tmpfs 2.0G 0 2.0G 0% /dev/shm
Command to run docker:
$ docker run -d -v /dev/shm:/dev/shm selenium/node-chrome-debug:latest
$ docker run -d --shm-size=2g selenium/node-chrome-debug:latest
docker run -it --rm \
--name tmpfs \
--mount type=tmpfs,dst=/dev/shm,tmpfs-size=2147483648 \
selenium/node-chrome-debug:latest
Command for Docker Swarm compose:
chrome_debug1:
image: selenium/node-chrome-debug:latest
ports:
- "5901:5900"
environment:
HUB_HOST: hub
HUB_PORT: 4444
NODE_MAX_SESSION: 1
NODE_MAX_INSTANCES: 1
volumes:
- type: tmpfs
target: /dev/shm
tmpfs:
size: 2147483648
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
Since Chromium 65, this is no longer necessary. Instead, launch the browser with the
--disable-dev-shm-usage
flag. Below is sample code for
Playwright
:
const browser = await playwright.chromium.launch({
args: ['--disable-dev-shm-usage']