ericmckean / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

Unable to launch more than one chrome browser instance at the same time on Windows #977

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Issue Description:
ChromeDriver fails to launch the browser when there is an already running 
instance. If more than one instance of ChromeDriver is created at the same 
time, only one of them succeeds, and the others appear as tabs (with data:;) in 
the same browser session, and chromedriver throws 
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: 
crashed

ChromeDriver.Log shows "RESPONSE InitSession unknown error: Chrome failed to 
start: crashed"

This was working fine until v37 of Chrome.

Steps to reproduce
Platform: Microsoft Windows 2008 R2 SP1
ChromeDriver: 2.12
Chrome: 39.0.2171.65
WebDriver: 2.44.0

This can be reproduced in either of the following ways:
1. Setup a selenium grid, and using parallel threads create RemoteWebDriver 
sessions, and try to load a URL in the browser. This can be easily done using 
TestNG, by using is parallel tests.
2. Use ChromeDriver directly - Create a simple test for instantiating 
ChromeDriver, and loading an URL. Run two instance of this test simultaneously. 

Both the scenarios are working fine for the same Driver/Browser configurtion on 
Ubuntu. Both the scenarios were working fine on Windows until V37.0.2062.102

Things started breaking badly with v38 of Chrome, and still continues even 
after v39.

-----Other helpful tips:
Driver info: chromedriver=2.12.301325 
(962dea43ddd90e7e4224a03fa3c36a421281abb7),platform=Windows NT 6.0 SP2 x86_64) 
(WARNING: The server did not provide any stacktrace information)
   [testng] Command duration or timeout: 61.01 seconds
   [testng] Build info: version: '2.44.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
   [testng] System info: host: 'EC2AMAZ-BDF0FOX', ip: '10.0.121.119', os.name: 'Windows Server 2008', os.arch: 'amd64', os.version: '6.0', java.version: '1.7.0_25'
   [testng] Driver info: org.openqa.selenium.chrome.ChromeDriver
   [testng]     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   [testng]     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
   [testng]     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   [testng]     at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
   [testng]     at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
   [testng]     at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
   [testng]     at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
   [testng]     at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
   [testng]     at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:182)
   [testng]     at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
   [testng]     at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
   [testng]     at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:161)
   [testng]     at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:129)
   [testng]     at com.vizury.saiku.utils.WebDriverBuilder.getDriver(Unknown Source)
   [testng]     at com.vizury.saiku.test.PixelUrlTest.initJSPixelTest(Unknown Source)
   [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [testng]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   [testng]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   [testng]     at java.lang.reflect.Method.invoke(Method.java:606)
   [testng]     at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
   [testng]     at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
   [testng]     at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
   [testng]     at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
   [testng]     at org.testng.internal.Invoker.invokeBeforeGroupsConfigurations(Invoker.java:938)
   [testng]     at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
   [testng]     at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
   [testng]     at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
   [testng]     at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
   [testng]     at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
   [testng]     at org.testng.TestRunner.privateRun(TestRunner.java:767)
   [testng]     at org.testng.TestRunner.run(TestRunner.java:617)
   [testng]     at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
   [testng]     at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
   [testng]     at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
   [testng]     at org.testng.SuiteRunner.run(SuiteRunner.java:240)
   [testng]     at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
   [testng]     at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
   [testng]     at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
   [testng]     at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
   [testng]     at org.testng.TestNG.run(TestNG.java:1057)
   [testng]     at org.testng.TestNG.privateMain(TestNG.java:1364)
   [testng]     at org.testng.TestNG.main(TestNG.java:1333)

ChromeDriver.Log

[0.490][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "acceptSslCerts": true,
      "browserName": "chrome",
      "chromeOptions": {
         "args": [ "--incognito", "test-type" ],
         "extensions": [  ]
      },
      "loggingPrefs": {
         "browser": "ALL"
      },
      "platform": "ANY",
      "proxy": {
         "autodetect": false,
         "class": "org.openqa.selenium.Proxy",
         "ftpProxy": null,
         "hCode": 300904196,
         "httpProxy": "localhost:9945",
         "noProxy": null,
         "proxyAutoconfigUrl": null,
         "proxyType": "MANUAL",
         "socksPassword": null,
         "socksProxy": null,
         "socksUsername": null,
         "sslProxy": "localhost:9945"
      },
      "version": ""
   }
}
[0.492][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[0.492][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[0.494][INFO]: Launching chrome: "C:\Program Files 
(x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking 
--disable-client-side-phishing-detection --disable-component-update 
--disable-default-apps --disable-hang-monitor --disable-prompt-on-repost 
--disable-sync --disable-web-resources --enable-logging 
--ignore-certificate-errors --incognito 
--load-extension="C:\Windows\TEMP\scoped_dir7068_19486\internal" --log-level=0 
--metrics-recording-only --no-first-run --password-store=basic 
--proxy-server=http=localhost:9945;https=localhost:9945 
--remote-debugging-port=12132 --safebrowsing-disable-auto-update 
--safebrowsing-disable-download-protection --test-type --use-mock-keychain 
--user-data-dir="C:\Windows\TEMP\scoped_dir7068_26811" data:,
[60.995][INFO]: RESPONSE InitSession unknown error: Chrome failed to start: 
crashed

Original issue reported on code.google.com by maddyro...@gmail.com on 20 Nov 2014 at 5:08

GoogleCodeExporter commented 9 years ago
can you show us how do you register nodes to the hub? 

Original comment by andrewch...@chromium.org on 20 Nov 2014 at 11:52

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 20 Nov 2014 at 11:52

GoogleCodeExporter commented 9 years ago
We do it using the standard method as it is explained in the selenium wiki - 
https://code.google.com/p/selenium/wiki/Grid2

java -jar selenium-server-standalone-2.44.0.jar -role hub
java -jar selenium-server-standalone-2.44.0.jar -role node  -hub 
http://localhost:4444/grid/register

Original comment by maddyro...@gmail.com on 21 Nov 2014 at 5:37

GoogleCodeExporter commented 9 years ago
Google Chrome   39.0.2171.65 (Official Build) m
Revision    df9a6771580cfbd8eca670eb8bd779a0712b895e-refs/branch-heads/2171_62@{#4}
OS  Windows 

two simple test programs run at the same time
instance 1:
Starting ChromeDriver 2.12 (b6bec6f7c3a14e9472b2fc3747c726c5c88ac921) on port 
26097
Only local connections are allowed.

instance 2:
Starting ChromeDriver 2.12 (b6bec6f7c3a14e9472b2fc3747c726c5c88ac921) on port 
2965
Only local connections are allowed.

 each driver  launched its own Chrome Browser(two instances) , and loading an URL.
they can hold as long as my timer setting. 

 If you can try the new version and see.

Original comment by andrewch...@chromium.org on 21 Nov 2014 at 7:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Can not reproduce the case.  launched two instances at the same time.

following is my set up

Google Chrome   39.0.2171.65 (Official Build) m
Revision    df9a6771580cfbd8eca670eb8bd779a0712b895e-refs/branch-heads/2171_62@{#4}
OS  Windows 

two simple test programs run at the same time
instance 1:
Starting ChromeDriver 2.12 (b6bec6f7c3a14e9472b2fc3747c726c5c88ac921) on port 
26097
Only local connections are allowed.

instance 2:
Starting ChromeDriver 2.12 (b6bec6f7c3a14e9472b2fc3747c726c5c88ac921) on port 
2965
Only local connections are allowed.

 each driver  launched its own Chrome Browser(two instances) , and loading an URL.
they can hold as long as my timer setting. 

 If you can do the same.

Original comment by andrewch...@chromium.org on 21 Nov 2014 at 7:53

GoogleCodeExporter commented 9 years ago
Which version of Windows did you try this exercise on?
I pretty much did the same exercise on Windows 2008, but through a hub than 
standalone executions.
Again, the original issue we are still facing is that our test jobs running 
through Jenkins affect each other as each of them try to instantiate individual 
instances of Chrome driver without using a hub.

Original comment by maddyro...@gmail.com on 23 Nov 2014 at 5:56

GoogleCodeExporter commented 9 years ago
1. on window 7
2. can you  try following set up

java -jar selenium-server-standalone-2.44.0.jar -role node 
-Dwebdriver.chrome.driver=\path\to\chromedriver.exe  -hub 
http://localhost:4444/grid/register  -port 5556

client software
String Node = "http://127.0.0.1:5556/wd/hub";  

  don't have problem run on window 7 and Linux

Original comment by andrewch...@chromium.org on 24 Nov 2014 at 7:55

GoogleCodeExporter commented 9 years ago
I did try the exercise on Windows 7, and it works perfectly fine as it did for 
you. It works fine on Ubuntu as well.
However, it breaks on Windows 2008 Server, and the problem is consistently 
reproduceable. Is it possible for you to try the same exercise on a Windows 
2008 Server?

Our test execution environment which is hosted on cloud runs on a Microsoft 
Windows 2008 R2 SP1, and this scenario was working perfectly alright until v37 
of Chrome. Once the auto-update switched the browser to v38, things started 
breaking.

It would be quite appreciated if you can help resolving the issue.

Original comment by maddyro...@gmail.com on 25 Nov 2014 at 7:04

GoogleCodeExporter commented 9 years ago
We don't have Windows 2008 Server at moment.

Can  you  run command line

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 
--disable-background-networking --disable-client-side-phishing-detection 
--disable-component-update --disable-default-apps --disable-hang-monitor 
--disable-prompt-on-repost --disable-sync --disable-web-resources 
--enable-logging --ignore-certificate-errors --incognito 
--load-extension="C:\Windows\TEMP\scoped_dir7068_19486\internal" --log-level=0 
--metrics-recording-only --no-first-run --password-store=basic 
--proxy-server=http=localhost:9945;https=localhost:9945 
--remote-debugging-port=12132 --safebrowsing-disable-auto-update 
--safebrowsing-disable-download-protection --test-type --use-mock-keychain 
--user-data-dir="C:\Windows\TEMP\scoped_dir7068_26811"

Original comment by andrewch...@chromium.org on 25 Nov 2014 at 6:34

GoogleCodeExporter commented 9 years ago
I ran it, and saw an error pop up saying "Could not load extension from 
'C:\Windows\TEMP\scoped_dir7068_19486\internal'. Manifest file is missing or 
unreadable."
The browser was launched after I clicked on the OK button of the error dialog.

Original comment by maddyro...@gmail.com on 25 Nov 2014 at 6:50

GoogleCodeExporter commented 9 years ago
Can you remove switch  --load-extension
on your application?

Original comment by andrewch...@chromium.org on 25 Nov 2014 at 7:03

GoogleCodeExporter commented 9 years ago
Do you mean in the code which launches the webdriver or in the command you 
provided earlier?
If you mean the code change, how do i do it using an instance of ChromeOptions?

Original comment by maddyro...@gmail.com on 25 Nov 2014 at 7:28

GoogleCodeExporter commented 9 years ago
I mean remove load-extension from ChromeOptions for now.
then,  test your software as usual.

Original comment by andrewch...@chromium.org on 25 Nov 2014 at 7:43

GoogleCodeExporter commented 9 years ago
Got it. As far as I see, ChromeOptions supports adding/enabling arguments. How 
do I disable/remove an argument using ChromeOptions?

Original comment by maddyro...@gmail.com on 25 Nov 2014 at 7:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
ok,  that is build-in, ans can not disable/remove.
Once we got a Windows 2008 Server, will test on it.
in the mean time, what do you see on
--load-extension="C:\Windows\TEMP\scoped_dir7068_19486\internal
if it still available.

Original comment by andrewch...@chromium.org on 25 Nov 2014 at 10:25

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 26 Nov 2014 at 2:32

GoogleCodeExporter commented 9 years ago
I could not find any coredumps. However, I was able to collect the temp 
directories created during the test run. My test code tries to launch 5 browser 
instances in parallel, and I could see 10 temp directories getting created. 2 
directories are created per browser instance - 1. load-extension 2. temporary 
browser profile.

Let me know if you would like to take a look at these directories.

Original comment by maddyro...@gmail.com on 26 Nov 2014 at 1:18

GoogleCodeExporter commented 9 years ago
To expedite things, would you have time to have a shared session or debug the 
scenario in a test setup on a Windows 2008 server from our end?

Original comment by maddyro...@gmail.com on 26 Nov 2014 at 1:20

GoogleCodeExporter commented 9 years ago
 let's do multiple trouble shootings

 1. can you set the registry values 
 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\chromedriver.exe

 2. remove all scoped_dir_xxxx in temp dir

 3. test not more than two instances

 4. after crash, zip the whole dir and email to me - all of them

--load-extension="C:\Windows\TEMP\scoped_dir7068_19486\internal

Original comment by andrewch...@chromium.org on 26 Nov 2014 at 7:47

GoogleCodeExporter commented 9 years ago
Could you please share your e-mail id?

Original comment by maddyro...@gmail.com on 27 Nov 2014 at 11:08

GoogleCodeExporter commented 9 years ago
Can you see it?  - andrewcheng@chromium.org

Original comment by andrewch...@chromium.org on 1 Dec 2014 at 6:13

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:19

GoogleCodeExporter commented 9 years ago
Is this issue fixed? I am also facing the same issue.

Original comment by shrutiuj...@gmail.com on 5 Mar 2015 at 11:28

GoogleCodeExporter commented 9 years ago
I got this fixed using a slightly different approach though. Though the issue 
was local to my setup, I found it as a defect on the way ChromeDriver treats 
the default user profiles.

Original comment by maddyro...@gmail.com on 5 Mar 2015 at 11:35

GoogleCodeExporter commented 9 years ago
#25 would you please  describe more about your setup?

Original comment by andrewch...@chromium.org on 5 Mar 2015 at 6:19

GoogleCodeExporter commented 9 years ago
Hi Andrew, 

What details would you exactly need? 

Some that I could think of is listed below::
- I am using Chrome Version 41.0.2272.76 m
- Tried using even latest ChromeDriver & Selenium Standalone jar -- but still 
face the same issue.
- Windows 7 64 bit
- Simple code that I am trying:
          WebDriver driver1 = new ChromeDriver();              
          driver1.get("http://www.google.com");
          Thread.sleep(3000);

          WebDriver driver2 = new ChromeDriver(); 
          driver2.get("http://www.google.com");
          Thread.sleep(3000);

          driver1.quit();
          driver2.quit();
   ** With this code, google launches in first tab of Chrome -- but for the second one it doesnt load the page. Just gets stuck with: data:; in the address bar.

   ** I tried using a Chrome Extension named -- New Tab, New Windows --> that opens new tab in new window. But still see the same issue. When the 2nd driver is launched it shows same data:; error.

The same code used to work on my machine couple of months back. Not sure what 
has changed recently.

Please suggest asap how to fix it. Totally stuck with the issue. Thanks!

Original comment by shrutiuj...@gmail.com on 8 Mar 2015 at 7:12

GoogleCodeExporter commented 9 years ago
do you mean you have same driver and codes months back, and suddenly not work?

Original comment by andrewch...@chromium.org on 9 Mar 2015 at 6:35

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 9 Mar 2015 at 6:55

GoogleCodeExporter commented 9 years ago
Shruti,

Could you please check your current profile path of Chrome? You can get this 
information by typing chrome://version on your regular browser instance (not 
through webdriver), and looking for the field "Profile Path". 

This would typically be set to something like 
"C:\Users\Administrator\AppData\Local\Google\Chrome\User Data\Default". This 
somehow got changed to "C:\Program Files 
(x86)\Google\Chrome\Application\39.0.2171.95\${users}\Administrator\Chrome" in 
my case, and I had to reset this to the normal one by clearing some registry 
settings.

Perhaps, this solution might work for you as well.

Original comment by maddyro...@gmail.com on 9 Mar 2015 at 7:07

GoogleCodeExporter commented 9 years ago
My profile was also wrong like yours. So I changed the Registry userdata value. 
Now in Chrome Browser it shows like:
Profile Path    C:\Users\IBM_ADMIN\AppData\Local\Google\Chrome\User 
Data\Default\Default

Still it does not work. Pls suggest how to proceed?

Original comment by shrutiuj...@gmail.com on 10 Mar 2015 at 6:46

GoogleCodeExporter commented 9 years ago
you have ........e\User Data\Default\Default
double Default - not correct.
check you environment variable - LOCALAPPDATA=
what is it?

Original comment by andrewch...@chromium.org on 10 Mar 2015 at 6:26

GoogleCodeExporter commented 9 years ago
My mistake in typing. The Registry entry is set correctly::
UserDataDir=C:\Users\IBM_ADMIN\AppData\Local\Google\Chrome\User Data\Default

When I look at the environment variable, it says:
LOCALAPPDATA=C:\Users\IBM_ADMIN\AppData\Local

Let me know what to do now.

Original comment by shrutiuj...@gmail.com on 10 Mar 2015 at 6:34

GoogleCodeExporter commented 9 years ago
let's do another trial,

create c:\tmp
set environment variables
TEMP=c:\tmp
TMP=c:\tmp

run your testing again

Original comment by andrewch...@chromium.org on 10 Mar 2015 at 7:20

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 10 Mar 2015 at 7:21

GoogleCodeExporter commented 9 years ago
It does not work :( Let me know what else can I try?

Original comment by shrutiuj...@gmail.com on 11 Mar 2015 at 6:17

GoogleCodeExporter commented 9 years ago
what is your profile path?  -  should under c:\tmp

Original comment by andrewch...@chromium.org on 11 Mar 2015 at 5:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
** In Chrome if i do: chrome://version/
I get Profile Path=C:\Users\IBM_ADMIN\AppData\Local\Google\Chrome\User 
Data\Default\Default

** In the Windows Registry its set to: 
UserDir=C:\Users\IBM_ADMIN\AppData\Local\Google\Chrome\User Data\Default

Original comment by shrutiuj...@gmail.com on 11 Mar 2015 at 8:07

GoogleCodeExporter commented 9 years ago
this is not right,  new launched chrome profile will under c:\tmp
make sure your temp environment variable is effective

Original comment by andrewch...@chromium.org on 11 Mar 2015 at 9:12

GoogleCodeExporter commented 9 years ago
So i fixed that -->

** In Chrome if i do: chrome://version/
I get Profile Path=C:\tmp\Default

** In the Windows Registry its set to: UserDir=C:\tmp

Still its not working!!

Original comment by shrutiuj...@gmail.com on 12 Mar 2015 at 6:20

GoogleCodeExporter commented 9 years ago
do you also create on issue  1055?

Original comment by andrewch...@chromium.org on 12 Mar 2015 at 5:16

GoogleCodeExporter commented 9 years ago
Yes I had, but no luck.  Any updates on how the issue can be fixed?

Original comment by shrutiuj...@gmail.com on 14 Mar 2015 at 7:01

GoogleCodeExporter commented 9 years ago
Any updates on how this can be fixed? Will Remote Troubleshooting session be 
helpful?

Original comment by shrutiuj...@gmail.com on 17 Mar 2015 at 10:36

GoogleCodeExporter commented 9 years ago
Unable to reproduce issue with ChromeDriver:v2.14 and Chrome:v41, Windows 7.

Please find attached sample code and let us know if we differ from what you are 
trying.

Original comment by ssudunag...@chromium.org on 25 Mar 2015 at 5:16

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by ssudunag...@chromium.org on 26 Mar 2015 at 6:44