Java

Seleniumよりheadlessで起動したChromeが org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally で落ちる

、という現象があります。

Starting ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784}) on port 5840
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
org.openqa.selenium.WebDriverException: 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.)
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'nginxstack-1-vm', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.16.0-4-amd64', java.version: '15'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x564bf39ed199 <unknown>

前にも同じ現象が発生して–no-sandboxとか–disable-dev-shm-usageといったオプションを付けて回避出来ていたけどまた不定期に発生するようになりました。謎。

ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
// https://stackoverflow.com/questions/48450594/selenium-timed-out-receiving-message-from-renderer
options.addArguments("--window-size=1920,1080");
options.addArguments("--start-maximized"); // https://stackoverflow.com/a/26283818/1689770
options.addArguments("--enable-automation"); // https://stackoverflow.com/a/43840128/1689770
options.addArguments("--no-sandbox"); //https://stackoverflow.com/a/50725918/1689770
options.addArguments("--disable-infobars"); //https://stackoverflow.com/a/43840128/1689770
options.addArguments("--disable-dev-shm-usage"); //https://stackoverflow.com/a/50725918/1689770
options.addArguments("--disable-browser-side-navigation"); //https://stackoverflow.com/a/49123152/1689770
options.addArguments("--disable-gpu"); //https://stackoverflow.com/questions/51959986/how-to-solve-selenium-chromedriver-timed-out-receiving-message-from-renderer-exc

// https://github.com/dotnet/xharness/pull/343
// https://github.com/dotnet/xharness/pull/343/files/580578ce8d05082e68131ec4645dd4083187ccf0#diff-548245ee63d58ce919a2a700f41d734f777ee9345aaf209bd21249a4639f31e3R76
options.addArguments("--enable-features=NetworkService,NetworkServiceInProcess");
options.addArguments("--disable-background-timer-throttling");
options.addArguments("--disable-backgrounding-occluded-windows");
options.addArguments("--disable-breakpad");
options.addArguments("--disable-component-extensions-with-background-pages");
options.addArguments("--disable-extensions");
options.addArguments("--disable-features=TranslateUI");
options.addArguments("--disable-ipc-flooding-protection");
options.addArguments("--disable-renderer-backgrounding");
options.addArguments("--force-color-profile=srgb");
options.addArguments("--metrics-recording-only");
options.setBinary("/usr/bin/google-chrome");
options.addArguments("--no-sandbox");

まだ解決していません。再現条件も不明。
ChromeとChromeDriverのバージョンは88.0.4324.96。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です