1
3

More than 3 years have passed since last update.

chrome73でCIが落ちる(chrome not reachable)原因と解決法

Last updated at Posted at 2019-03-25

ことの始まり

Rubyのバージョンを2.6.2にするタイミングでchromeもchromedriverも最新のものにしようとしていたらCIがコケまくるようになった。

Selenium::WebDriver::Error::WebDriverError:
            chrome not reachable
              (Session info: headless chrome=73.0.3683.86)
              (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 4.4.0-141-generic x86_64)

原因

chrome_optionsの一部が最新chromeとの互換性を失っていた。(らしい)
https://stackoverflow.com/questions/55222916/selenium-has-stopped-working-chrome-versions-do-not-match

blink-settings=imagesEnabled=false
no-sandbox
disable-dev-shm-usage
のどれかが原因だと思う。
おそらく disable-dev-shm-usage が原因...かな。
他の2つはオプションに含めていてもテストが正常に動くとの報告があった。
puppeteerを使う上でメモリの関係上必要なものだった?みたい
すでに修正済みで現在は不要。
もしこれでもないとすれば特定の組み合わせで起きるものなのかもしれない。

解決法

該当オプションを削除する事で問題なくテストが通るようになった。

Capybara.register_driver :selenium do |app|
  Capybara::Selenium::Driver.new(
    app,
    browser: :chrome,
    desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
      login_prefs: { browser: 'ALL' },
      chrome_options: {
        args: <ここのオプションの中のどれかが原因>,
      }
    )
  )
end

取り急ぎ修正の方向性だけ書いておきます。
細かいことはまだわかっていないのでわかり次第追記します。

追記

Chromiumのバグだそうです。現在は修正済み。
--disable-features=VizDisplayCompositor属性を付けてやると解決すると書いてあります。
https://stackoverflow.com/questions/55388995/chrome-73-stop-supporting-headless-mode-in-background-scheduled-task

余談

chromedriver-helperがサポートを終了するようです。
webdriversに移行するようにとのことです。
https://github.com/flavorjones/chromedriver-helper/issues/83

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3