添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
很拉风的山羊  ·  如何将已有 Maven ...·  1 月前    · 
茫然的风衣  ·  Dev Life in IT :: [ ...·  2 周前    · 
打酱油的书签  ·  Deploy a Webserver to ...·  5 天前    · 
文雅的鞭炮  ·  Microsoft Dev Box - ...·  4 天前    · 
爱热闹的金针菇  ·  Configuring the ...·  1 年前    · 
活泼的冲锋衣  ·  java - Use of ...·  1 年前    · 
含蓄的绿茶  ·  基于 Echarts + Python ...·  1 年前    · 
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']
		

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *