Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51756

SauceConnect fails to launch due to unavailable port

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Our Jenkins jobs which use the sauce ondemand plugin are occasionally failing due to the following error. 

      Starting pre-build for Sauce Labs plugin
      Starting Sauce Connect on slave node using tunnel identifier: shield-basecamp-1528304995845
      Launching Sauce Connect on localhost
      /home/jenkins/sc-4.4.9-linux/bin/sc already exists, so not extracting
      6 Jun 12:09:56 - Sauce Connect 4.4.9, build 3688 098cbcf -dirty
      6 Jun 12:09:56 - Using CA certificate bundle /etc/ssl/certs/ca-bundle.crt.
      6 Jun 12:09:56 - Using CA certificate verify path /etc/ssl/certs.
      6 Jun 12:09:56 - Starting up; pid 12638
      6 Jun 12:09:56 - Command line arguments: /home/jenkins/sc-4.4.9-linux/bin/sc -u Ind_jenkins -k **** -P 54490
      6 Jun 12:09:56 - Log file: /tmp/sc-shield-basecamp-1528304995845.log
      6 Jun 12:09:56 - Pid file: /tmp/sc_client-shield-basecamp-1528304995845.pid
      6 Jun 12:09:56 - Timezone: CDT GMT offset: -5h
      6 Jun 12:09:56 - Using no proxy for connecting to Sauce Labs REST API.
      6 Jun 12:09:56 - Unable to serve metrics on localhost:8888, error was: listen tcp 127.0.0.1:8888: bind: address already in use
      6 Jun 12:09:57 - ***********************************************************
      6 Jun 12:09:57 - A newer version of Sauce Connect (build 3905) is available!
      6 Jun 12:09:57 - Download it here:
      6 Jun 12:09:57 - https://saucelabs.com/downloads/sc-4.4.12-linux.tar.gz
      6 Jun 12:09:57 - ***********************************************************
      6 Jun 12:09:57 - Started scproxy on port 53304.
      6 Jun 12:09:57 - Please wait for 'you may start your tests' to start your tests.
      6 Jun 12:10:20 - Provisioned tunnel:19f0eab4194d4300897a0f6e3aabaad4
      6 Jun 12:10:20 - Using no proxy for connecting to tunnel VM.
      6 Jun 12:10:20 - Starting Selenium listener...
      6 Jun 12:10:20 - Establishing secure TLS connection to tunnel...
      6 Jun 12:10:20 - 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).
      6 Jun 12:10:20 - Please check logfile for more information.
      6 Jun 12:10:20 - Sauce Connect could not establish a connection.
      6 Jun 12:10:20 - Please check your firewall and proxy settings.
      6 Jun 12:10:20 - You can also use the sc --doctor to launch Sauce Connect in diagnostic mode.
      6 Jun 12:10:20 - Goodbye.
      Error launching Sauce Connect
      Flushing Sauce Connect Input Stream
      Flushing Sauce Connect Error Stream
      Closing Sauce Connect process

      We thought we could just use the maxRetries feature but we noted that on retry, the port that is used in subsequent attempts is always the same thus the tunnel still fails to start. 

      # -P is still 54490
      Error launching Sauce Connect, trying 2 time(s) more.
      Detected active tunnel: 19f0eab4194d4300897a0f6e3aabaad4
      /home/jenkins/sc-4.4.9-linux/bin/sc already exists, so not extracting
      6 Jun 12:10:27 - Sauce Connect 4.4.9, build 3688 098cbcf -dirty
      6 Jun 12:10:27 - Using CA certificate bundle /etc/ssl/certs/ca-bundle.crt.
      6 Jun 12:10:27 - Using CA certificate verify path /etc/ssl/certs.
      6 Jun 12:10:27 - Starting up; pid 12731
      6 Jun 12:10:27 - Command line arguments: /home/jenkins/sc-4.4.9-linux/bin/sc -u jenkins -k **** -P 54490
      ...
      Error launching Sauce Connect, trying 1 time(s) more.
      Detected active tunnel: d190fa6361094c8784a815648c1a1a78
      /home/jenkins/sc-4.4.9-linux/bin/sc already exists, so not extracting
      6 Jun 12:10:59 - Sauce Connect 4.4.9, build 3688 098cbcf -dirty
      6 Jun 12:10:59 - Using CA certificate bundle /etc/ssl/certs/ca-bundle.crt.
      6 Jun 12:10:59 - Using CA certificate verify path /etc/ssl/certs.
      6 Jun 12:10:59 - Starting up; pid 12849
      6 Jun 12:10:59 - Command line arguments: /home/jenkins/sc-4.4.9-linux/bin/sc -u jenkins -k **** -P 54490

      We think this occurs more frequently when multiple job needing sauce are triggered around the same time on the machine. 

      Can we enhance the maxRetries functionality to allow selecting a new port on each retry or giving us the option to retry with a different port? 

        Attachments

          Activity

          timyh Tim H created issue -

            People

            Assignee:
            yfangsl Yeh Fang
            Reporter:
            timyh Tim H
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: