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

Docker JNLP launcher does not appear to honor Connect Timeout setting

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: docker-plugin
    • Labels:
      None
    • Environment:
      Jenkins: 2.23
      Docker Plugin: 0.16.2
      Docker: 1.11.1 (+swarm)
    • Similar Issues:

      Description

      I get several orphaned Docker containers per day with the following endless output in the logs:

      + cat
      + chmod +x /tmp/init.sh
      + exec /tmp/init.sh
      + export CONFIG=/tmp/config.sh
      + CONFIG=/tmp/config.sh
      + '[' '!' -f /tmp/config.sh ']'
      + echo 'No config, sleeping for 1 second'
      No config, sleeping for 1 second
      + sleep 1
      + '[' '!' -f /tmp/config.sh ']'
      + echo 'No config, sleeping for 1 second'
      No config, sleeping for 1 second
      + sleep 1
      + '[' '!' -f /tmp/config.sh ']'
      + echo 'No config, sleeping for 1 second'
      
      

      (... continued forever)

      Looking at /tmp/init.sh on the looping container I see this at the top:

      Unable to find source-code formatter for language: sh. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
      
      #!/usr/bin/env bash
      
      set -uxe
      
      export CONFIG="/tmp/config.sh"
      while [ ! -f "$CONFIG" ]; do
          echo "No config, sleeping for 1 second"
          sleep 1
      done
      
      echo "Found config file"
      source "$CONFIG"
      
      

      If for whatever reason a config file is not copied to the container, this is what I would expect to happen. What does the Connection Timeout setting in the Jenkins cloud configuration do then? My opinion is that regardless of whether that setting is applicable here (or even to JNLP option at all), this loop should not go on forever but should have a sane default maximum iteration limit.

      Happy to provide a PR if needed, but want to get feedback first.

        Attachments

          Activity

            People

            • Assignee:
              magnayn magnayn
              Reporter:
              akom Alexander Komarov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: