Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

UnknownError: session deleted because of page crash from tab crashed #20

Closed
elgalu opened this issue Jun 1, 2015 · 58 comments
Closed
Labels

Comments

@elgalu
Copy link
Owner

elgalu commented Jun 1, 2015

Chrome crashes on docker-selenium instances (works ok with real machines) on certain high GPU intensive UI tests

{code}
UnknownError: unknown error: session deleted because of page crash
from tab crashed
(Session info: chrome=43.0.2357.81)
(Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Linux 3.13.0-32-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 53 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'zelenium', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-32-generic', java.version: '1.7.0_80'
Session ID: b12eb3c43351dad58746798c40078ef9
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=LINUX, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=/tmp/.com.google.Chrome.11yHIh}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=43.0.2357.81, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickCallback (node.js:355:11)
==== async task ====
WebDriver.executeScript()
.....
{code}

Works ok in Firefox.

@elgalu elgalu added the bug label Jun 1, 2015
@elgalu
Copy link
Owner Author

elgalu commented Jun 1, 2015

Note: playing with certain Chrome options like --no-sandbox didn't help

capabilities: {
    browserName: 'chrome',
    chromeOptions: {
        args: [
            '--disable-gpu',
            '--disable-impl-side-painting',
            '--disable-gpu-sandbox',
            '--disable-accelerated-2d-canvas',
            '--disable-accelerated-jpeg-decoding',
            '--no-sandbox',
            '--test-type=ui',
            ],
    },
},

@elgalu
Copy link
Owner Author

elgalu commented Jun 16, 2015

@elgalu elgalu added this to the priority-major milestone Jun 24, 2015
@bitliner
Copy link

Same here, using selenium/standalone-chrome:2.46.0

@khoaln
Copy link

khoaln commented Jun 30, 2015

Same here. I have been trying many docker images built for running selenium+protractor +xvfb (includes one of @elgalu ;) ). Look like this is dues to docker. Everything ok on real machine or vagrant+virtualbox.

@bitliner
Copy link

I had to switch to firefox, and it does not happen anymore.

@elgalu
Copy link
Owner Author

elgalu commented Jun 30, 2015

Yes, Firefox works ok fortunately.
I guess Chrome guys would be able to fix the problem if someone gets together a sample project that reproduces the problem and host it somewhere.

@smacgaha
Copy link

smacgaha commented Jul 1, 2015

When I run my suite without test cases that download files, I don't see this error. Has anyone else tried this?

@kkochubey1
Copy link

Chrome 42 - 44 crashes when manually open http://www.google.com/adwords

Is there issue already opened for Chrome browser in docker. Should I submit a new one for Chromium?

We are running into similar issue with our application same as with http://www.google.com/adwords
We use own docker configuration similar to selenium/node-chrome-debug

Steps to reproduce manually on public selenium image:
docker run -d -p 4444:4444 --name selenium-hub selenium/hub
docker run -it -p 5900:5900 --link selenium-hub:hub selenium/node-chrome-debug

start vnc viewver on default docker IP 127.0.0.1:5900
or for boot2docker IP at 192.168.69.103:5900
(default password is 'secret')

Right mouse click. Open Applications\Terminal Emulators\XTerm
run following commands

sudo su - seluser
google-chrome

In google chrome window type
http://www.google.com/adwords

It loads page and then shows: Aw, Snap!

It is reproducible in all Chrome browsers starting 42 (till latest 44)
Currently on Chrome/44.0.2403.155

It is not reproducible on the our old docker-selenium image with older Chrome/41.0.2272.89

Please refer correct duplicate or let me know where I can submit this issue?
I can provide additional details, logs if needed?

@kkochubey1
Copy link

@elgalu
Copy link
Owner Author

elgalu commented Aug 13, 2015

Best chance for this to be fixed here:
https://code.google.com/p/chromium/issues/detail?id=519952

@issuj
Copy link

issuj commented Aug 20, 2015

FYI, I have found that recent version(s) of Chrome seem to crash in Docker containers, on certain pages, due to too small /dev/shm. May or may not be relevant to this issue.

@elgalu
Copy link
Owner Author

elgalu commented Aug 20, 2015

OMG @issuj you figured this out, I just tried below code and Chrome no longer crashes:

Simpy mount -v /dev/shm:/dev/shm

Or, longer, create a big shm

  1. Started in privileged mode: docker run --privileged
  2. Fix small /dev/shm size
docker exec $id sudo umount /dev/shm
docker exec $id sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm

However it would be nice to avoid privileged mode.
Any ideas @stonemaster @rongearley @jvermillard ?

Other refs:
moby/moby#3505 (comment)
moby/moby#4981 (comment)
moby/moby#2606 (comment)

@afiestas
Copy link

We were having the same issue, fixed by remounting /dev/shm with bigger size.

@kkochubey1
Copy link

Awesome! It works for us!

@elgalu
Copy link
Owner Author

elgalu commented Aug 26, 2015

Quoting @kkochubey1 solution:

It also works if use -v /dev/shm:/dev/shm option to share host /dev/shm
In this case you do not need --privileged mode.

@elgalu elgalu closed this as completed Aug 26, 2015
ShockwaveNN added a commit to ONLYOFFICE/testing-wrata that referenced this issue Sep 11, 2015
From elgalu/docker-selenium#20 (comment)
Should be fixed, after docker implement `-shm` argument in moby/moby#3505
@soupdiver
Copy link

Woohoooo thanks @elgalu and @issuj
Finally working for me also
👍

@afthar
Copy link

afthar commented Dec 1, 2015

Does anyone know how to connect /dev/shm using docker-compose. Couldn't find anything in the reference

volumes:
    - /dev/shm:/dev/shm

^doesn't work on mac.

@arkaitzgarro
Copy link

@afthar It works like a charm on my mac machine. Docker version 1.8.1, build d12ea79

seleniumnode:
  image: selenium/standalone-chrome:2.47.1
  ports:
  - "4444:4444"
  volumes:
  - /dev/shm:/dev/shm

@curlydevil
Copy link

@arkaitzgarro works for me as well.
UPD: works in local docker environment. If your CI does not allow sharing /dev/shm - this will not help.

@schmunk42
Copy link

@afthar Works for me on a Mac with docker 1.9.1, like @arkaitzgarro mentioned.

@knownasilya
Copy link

Is there a way to do this in Kubernetes on GCP?

@knownasilya
Copy link

knownasilya commented Jun 2, 2016

How big should it be (64M is the default it seems)? Going to try using --shm-size with docker build.

moby/moby#16168 (comment)

@CampsiteHelper
Copy link

Should this not be resolved within the base container definition?

@ivasilko
Copy link

Is there a way to do this in Kubernetes on GCP?
spec:
volumes:
- name: shm-vol
hostPath:
path: /dev/shm
containers:
volumeMounts:
- name: shm-vol
mountPath: /dev/shm

@baflQA
Copy link
Collaborator

baflQA commented Jul 8, 2019

Hi. I'm still having this issue on some of the pods spawned by the zalenium. Where should I set this "/dev/shm:/dev/shm" in my yaml when deploying zalenium to K8S?

@diemol
Copy link
Collaborator

diemol commented Jul 9, 2019

@baflQA, this should work https://stackoverflow.com/questions/46085748/define-size-for-dev-shm-on-container-engine/46434614#46434614

Not sure if k8s has a different way to do it these days.

@grzegorztomasiak
Copy link

Just to add my few cents about this issue.

None of the solutions given on the internet worked for me. Including increasing /dev/shm.
The problem in my case was a memory leak in the application that wasn't discovered by real human or browser but was mainly caused by Mink driver.

I had in my HTML a following piece of code

<input type="text" name="content" value="{{ a long HTML template string here }}" />

When this view was tested, Mink tried to execute a step I follow "Close", which was searching the DOM to find Close button. But because the long HTML template was there, I assume Mink could not handle HTML in HTML and it caused memory leak which in result crashed the chrome driver with the error.

To resolve this, I had to change the way I store the HTML template (via ajax, not form) and no more crashing.

@viniciusd
Copy link

Not sure if k8s has a different way to do it these days.

Using this stackoverflow solution on Kubernetes, worked like a charm

@yuezk
Copy link

yuezk commented Jan 13, 2020

I encountered this issue when I calling the executeScript method to try to get an object from the web page and I'm not using selenium in docker. I found a workaround for this, that is calling JSON.stringify() in the web page before returning the object. Something like below.

const dataStr = await browser.driver.executeScript('return JSON.stringify(obj)');
// Parse the JSON string.
const data = JSON.parse(dataStr);

@saramorsi
Copy link

OMG @issuj you figured this out, I just tried below code and Chrome no longer crashes:

Simpy mount -v /dev/shm:/dev/shm

Or, longer, create a big shm

  1. Started in privileged mode: docker run --privileged
  2. Fix small /dev/shm size
docker exec $id sudo umount /dev/shm
docker exec $id sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm

However it would be nice to avoid privileged mode.
Any ideas @stonemaster @rongearley @jvermillard ?

Other refs:
moby/moby#3505 (comment)
moby/moby#4981 (comment)
moby/moby#2606 (comment)

How do I run these commands? and what is $id in this case?

dpool pushed a commit to dpool/devops that referenced this issue Feb 5, 2021
- add volume mount to chrome container
@see elgalu/docker-selenium#20
@lexavey
Copy link

lexavey commented Mar 2, 2021

how about windows ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests