A common cause for Chrome to crash during startup is running Chrome as
administrator) on Linux. While it is possible to work around this issue by passing
--no-sandboxflag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Chrome as a regular user instead.
This error message...
org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your code trials and the versioning information of all the binaries would have given us some hint about what's going wrong.
However as per Add --disable-dev-shm-usage to default launch flags seems adding the argument
--disable-dev-shm-usage will temporary solve the issue.
If you desire to initiate/span a new Chrome Browser session you can use the following solution:
System.setProperty("webdriver.chrome.driver", "C:\\path\\to\\chromedriver.exe"); ChromeOptions options = new ChromeOptions(); options.addArguments("start-maximized"); // open Browser in maximized mode options.addArguments("disable-infobars"); // disabling infobars options.addArguments("--disable-extensions"); // disabling extensions options.addArguments("--disable-gpu"); // applicable to windows os only options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems options.addArguments("--no-sandbox"); // Bypass OS security model WebDriver driver = new ChromeDriver(options); driver.get("https://google.com");
As per base_switches.cc
disable-dev-shm-usage seems to be valid only on Linux OS:
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) // The /dev/shm partition is too small in certain VM environments, causing // Chrome to fail or crash (see http://crbug.com/715363). Use this flag to // work-around this issue (a temporary directory will always be used to create // anonymous shared memory files). const char kDisableDevShmUsage = "disable-dev-shm-usage"; #endif
In the discussion Add an option to use /tmp instead of /dev/shm David mentions:
I think it would depend on how are /dev/shm and /tmp mounted. If they are both mounted as tmpfs I'm assuming there won't be any difference. if for some reason /tmp is not mapped as tmpfs (and I think is mapped as tmpfs by default by systemd), chrome shared memory management always maps files into memory when creating an anonymous shared files, so even in that case shouldn't be much difference. I guess you could force telemetry tests with the flag enabled and see how it goes.
As for why not use by default, it was a pushed back by the shared memory team, I guess it makes sense it should be useing /dev/shm for shared memory by default.
Ultimately all this should be moving to use memfd_create, but I don't think that's going to happen any time soon, since it will require refactoring Chrome memory management significantly.
You can find a couple of detailed discussions in:
Here is the link to the Sandbox story.
~ Answered on 2018-06-01 11:57:19