1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

特定のテストを実行するとChromeがクラッシュ

Posted at

Seleniumを使ってエラーの奈落に落ちて解決できたので備忘録

エラーが出ていた時のdocker-compose.yml

version: '3'
services:
  db:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: password
    ports:
      - '3306:3306'
    command: --default-authentication-plugin=mysql_native_password
    volumes:
      - mysql-data:/var/lib/mysql
  web:
    build: .
    command: bundle exec puma -C config/puma.rb
    environment:
      RAILS_ENV: development
    volumes:
      - .:/FANTRA
      - bundle:/usr/local/bundle
      - /app/vendor
      - /app/log
      - /app/.git
    ports:
      - "3000:3000"
    depends_on:
      - db
    tty: true
    stdin_open: true
  chrome:
    image: selenium/standalone-chrome
    ports:
      - "4444:4444"

volumes:
  mysql-data:
    driver: local
  bundle:
    driver: local

とあるテストで訳のわからんレベル100ぐらいのエラー出てきよった

Failure/Error: visit tourist_tourist_tours_path(tourist.id)
            
            Selenium::WebDriver::Error::UnknownError:
              unknown error: session deleted because of page crash
              from tab crashed
                (Session info: chrome=83.0.4103.61)

同じエラーを抱えている運命の人を発見(参考URL)

どうやらページクラッシュエラーが出るのはメモリが不足していることが原因だそう。

もがき苦しんで解決方法を教えてくれた神様(参考URL)

shm_size: 2gをchromeに書き加えてやったらメモリがデカくなってくれるみたい。

  chrome:
    image: selenium/standalone-chrome
    ports:
      - "4444:4444"
    shm_size: "2g"      ##追記

まとめ

クラッシュするのは共有メモリが不足しちゃってるから起こっちゃう。
しかし、まだ理解できていない。エラー内容がざっくりしていてクラッシュしたらメモリを疑ってみる。

1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?