DevExpress / testcafe-browser-provider-saucelabs

This is the Sauce Labs browser provider plugin for TestCafe.
https://devexpress.github.io/testcafe/
MIT License
31 stars 41 forks source link

Unable To Open Two Saucelabs Connections Concurrently Using This Module #27

Closed bhreinb closed 1 year ago

bhreinb commented 6 years ago

Hi There,

On occasions I need to open two or more tunnels to sauce labs. Out of the box this module sends the following command line arguments to the library 'sauce-connect-launcher'

[ "-u", "", "-k", "", "--tunnel-identifier", 1538299859372, "--direct-domains", ".google.com,.gstatic.com,*.googleapis.com", "--readyfile", "/var/folders/9k/9y01ch7s6h95s9_ky6g_bpc40000gp/T/sc-launcher-readyfile" ]

That module (sauce-connect-launcher) is using this binary to establish a tunnel to sauce labs

https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy#SauceConnectProxy-DownloadSauceConnect

When this executes once the command completes successfully, see below

ACTIONGOLFNOT:bin $ ./sc -i 1538299859372 -u -k --direct-domains .google.com,.gstatic.com,*.googleapis.com 30 Sep 10:40:45 - Sauce Connect 4.5.1, build 4191 13eede5 30 Sep 10:40:45 - Using CA certificate verify path /etc/ssl/certs. 30 Sep 10:40:45 - WARNING: open file limit 256 is too low! 30 Sep 10:40:45 - Sauce Labs recommends setting it to at least 8000. 30 Sep 10:40:45 - Starting up; pid 3186 30 Sep 10:40:45 - Command line arguments: ./sc -i 1538299859372 -u -k *** --direct-domains .google.com,.gstatic.com,.googleapis.com 30 Sep 10:40:45 - Log file: /var/folders/9k/9y01ch7s6h95s9_ky6g_bpc40000gp/T/sc-1538299859372.log 30 Sep 10:40:45 - Pid file: /tmp/sc_client-1538299859372.pid 30 Sep 10:40:45 - Timezone: IST GMT offset: 1h 30 Sep 10:40:45 - Using no proxy for connecting to Sauce Labs REST API. 30 Sep 10:40:46 - Started scproxy on port 54196. 30 Sep 10:40:46 - Please wait for 'you may start your tests' to start your tests. 30 Sep 10:40:53 - Secure remote tunnel VM provisioned. 30 Sep 10:40:53 - Tunnel ID: 29b6f873149e4df5aa6fc7757dec280f 30 Sep 10:40:53 - Using no proxy for connecting to tunnel VM. 30 Sep 10:40:53 - Starting Selenium listener... 30 Sep 10:40:53 - Establishing secure TLS connection to tunnel... 30 Sep 10:40:54 - Selenium listener started on port 4445. 30 Sep 10:40:56 - Sauce Connect is up, you may start your tests.

However, when I attempt to open another tunnel I get the following output with the exact same parameters

ACTIONGOLFNOT:bin $ ./sc -i 1538300185679 -u -k --direct-domains .google.com,.gstatic.com,*.googleapis.com 30 Sep 10:42:07 - Sauce Connect 4.5.1, build 4191 13eede5 30 Sep 10:42:07 - Using CA certificate verify path /etc/ssl/certs. 30 Sep 10:42:07 - WARNING: open file limit 256 is too low! 30 Sep 10:42:07 - Sauce Labs recommends setting it to at least 8000. 30 Sep 10:42:07 - Starting up; pid 3187 30 Sep 10:42:07 - Command line arguments: ./sc -i 1538300185679 -u -k *** --direct-domains .google.com,.gstatic.com,.googleapis.com 30 Sep 10:42:07 - Log file: /var/folders/9k/9y01ch7s6h95s9_ky6g_bpc40000gp/T/sc-1538300185679.log 30 Sep 10:42:07 - Pid file: /tmp/sc_client-1538300185679.pid 30 Sep 10:42:07 - Timezone: IST GMT offset: 1h 30 Sep 10:42:07 - Using no proxy for connecting to Sauce Labs REST API. 30 Sep 10:42:07 - Unable to serve metrics on localhost:8888, error was: listen tcp [::1]:8888: bind: address already in use 30 Sep 10:42:08 - Started scproxy on port 54208. 30 Sep 10:42:08 - Please wait for 'you may start your tests' to start your tests. 30 Sep 10:42:19 - Secure remote tunnel VM provisioned. 30 Sep 10:42:19 - Tunnel ID: 902e6921826c44f69416460aa52b69af 30 Sep 10:42:19 - Using no proxy for connecting to tunnel VM. 30 Sep 10:42:19 - Starting Selenium listener... 30 Sep 10:42:19 - Establishing secure TLS connection to tunnel... 30 Sep 10:42:19 - Failed to start Selenium listener. Please make sure there are no other applications using the Selenium port, or specify an alternative port for Sauce Connect via the --se-port option (exit code 2). 30 Sep 10:42:19 - Please check logfile for more information. 30 Sep 10:42:19 - Sauce Connect could not establish a connection. 30 Sep 10:42:19 - Please check your firewall and proxy settings. 30 Sep 10:42:19 - You can also use the sc --doctor to launch Sauce Connect in diagnostic mode. 30 Sep 10:42:19 - Goodbye.

Namely, the first instance is using selenium port 8888, while the second instance tries to connect on that same port 8888 which is why it fails to connect in the second circumstance. The issue I describe above is exactly what I'm seeing when I tunnel to SauceLabs with this module via two processes on the same machine as the second instance is trying to use a port already in use and fails. To fix this the module needs to pass the selenium port down to sauce-connect-launcher so to bypass this problem. Let me know if there are any questions.

AndreyBelym commented 6 years ago

Yes, saucelabs-connector start a webserver to allow monitoring connection metrics on the port 8888, I think we can get a random free port in the provider and pass it to the saucelabs-connector binary.

bhreinb commented 6 years ago

Hi @AndreyBelym,

sounds good. You can see the reason for the feature request in this project

https://github.com/bhreinb/SYSTAC

namely a ability to run tests in parallel with Testcafe & Cucumber. Thanks a mill.

Thilaknath commented 4 years ago

@bhreinb @AndreyBelym Is this resolved now?

Dmitry-Ostashev commented 4 years ago

This improvement is not implemented yet. So, your PR would be appreciated.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.

github-actions[bot] commented 1 year ago

We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.