SeleniumHQ / docker-selenium

Provides a simple way to run Selenium Grid with Chrome, Firefox, and Edge using Docker, making it easier to perform browser automation
http://www.selenium.dev/docker-selenium/
Other
7.93k stars 2.51k forks source link

Chrome failed to start and exited abnormally. #534

Closed heisenbugger closed 6 years ago

heisenbugger commented 7 years ago

Meta -

Image(s): standalone-chrome

Docker-Selenium Image Version(s): 3.4.0

OS: CoreOS -> Debian Image

Expected Behavior -

Not crashing =)

Actual Behavior -

Crashing all the time :/

I deployed selenium standalone chrome on Kubernetes running Docker. Only selenium containers have been deployed on this cluster. The problem is: when we (devops and dev team) deployed our spider and let running on background (ENTRYPOINT) on Docker container, at the moment the crawler/spider start, Chrome failed and exited abnormally.

Traceback

File "/robson/core/flow/browser_flow.py", line 16, in __init__
    self.browser = Browser('chrome', **self.executable_path)
  File "/robson/env/local/lib/python2.7/site-packages/splinter/browser.py", line 63, in Browser
    return driver(*args, **kwargs)
  File "/robson/env/local/lib/python2.7/site-packages/splinter/driver/webdriver/chrome.py", line 31, in __init__
    self.driver = Chrome(chrome_options=options, **kwargs)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.11.11-coreos x86_64)

Any help will be appreciated.

Cheers Heisenbugger.

motou commented 7 years ago

Have you tried with the latest version? It looks like that the chrome driver version installed is out of date.

heisenbugger commented 7 years ago

Yes! I tried the latest version and I'm still getting this error.

Traceback (most recent call last):
  File "run.py", line 45, in job2
    robson.execute(config, ind)
  File "/robson/core/flow/robson.py", line 22, in execute
    browser = browser_flow(config)
  File "/robson/core/flow/browser_flow.py", line 16, in __init__
    self.browser = Browser('chrome', **self.executable_path)
  File "/robson/env/local/lib/python2.7/site-packages/splinter/browser.py", line 63, in Browser
    return driver(*args, **kwargs)
  File "/robson/env/local/lib/python2.7/site-packages/splinter/driver/webdriver/chrome.py", line 31, in __init__
    self.driver = Chrome(chrome_options=options, **kwargs)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 98, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 188, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 256, in execute
    self.error_handler.check_response(response)
  File "/robson/env/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.11.11-coreos x86_64)
motou commented 7 years ago

It could be also a problem of chrome with shm size and privilege mode. Please try to start the docker image with the parameter --shm-size=2g --privileged

vivekgrover1 commented 7 years ago

Hi, any idea how to fix the above issue?

diemol commented 7 years ago

@heisenbugger,

Could you please show us how your Kubernetes manifests/configuration files look like?

diemol commented 6 years ago

Please reopen if the issue is still present.

ddnomad commented 6 years ago

Just encountered the same problem with standalone-chrome image. Did mounted /dev/shm volume.

Running with docker-compose. Have somebody figured out what is the cause?

sterina commented 5 years ago

@ddnomad Did you find the solutin for your issues? Even i get below error when i use selenium/standalone-chrome image in docker. WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.14.109-80.92.amzn1.x86_64 x86_64)