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

Better implementation of -noreconnect jnlp slaves

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • Jenkins 1.466.1 on Linux

      I have a script that launch nodes via JNLP in my organizations compute farm. For some reason interactive jobs doesn't work (possibly a bug in jenkins) which I have worked around by launching a JNLP slave that connects to the master. Next issue is that I don't want to leave jobs that are running forever in the compute farm (it would mess with load distribution), which is solved by the on-demand provisioning model.

      However, launching a JNLP slave on-demand only causes it to reconnect once it looses its connection to Jenkins, even if it was closed due to the idle timeout. I've solved this is by launching the Jnlp slave's main class, which has the -noreconnect flag implemented, with this command:

      java -cp ./slave.jar hudson.remoting.jnlp.Main -headless -noreconnect -url "http://hostname/" "secret" "Node"

      It works but I feel it would be better to have a more official solution for this. This solution also causes a few minor issues. First of all the Node icon in Jenkins will show the "starting up" animation indefinately, probably because it waits for the slave to connect via stdin/stdout. The node will also display an error message, "This node is offline because Jenkins failed to launch the slave agent on it", when it reaches its idle timeout and disconnects. The log file says java.net.SocketException: Socket closed, which obviously is due to slave.jar shutting down, which it's supposed to at that point.

          [JENKINS-14803] Better implementation of -noreconnect jnlp slaves

          made implementation and sended pull request.
          https://github.com/jenkinsci/remoting/pull/11

          Kiyofumi Kondoh added a comment - made implementation and sended pull request. https://github.com/jenkinsci/remoting/pull/11

          Code changed in jenkins
          User: kkkon
          Path:
          src/main/java/hudson/remoting/Launcher.java
          http://jenkins-ci.org/commit/remoting/7cc8329152e6234ca61337691e95097e4a50b0b4
          Log:
          [FIXED JENKINS-14803] add options 'noReconnect'

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: kkkon Path: src/main/java/hudson/remoting/Launcher.java http://jenkins-ci.org/commit/remoting/7cc8329152e6234ca61337691e95097e4a50b0b4 Log: [FIXED JENKINS-14803] add options 'noReconnect'

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          src/main/java/hudson/remoting/Launcher.java
          http://jenkins-ci.org/commit/remoting/d1ccc5b6369d0eb8fc4da0d60bb96310b2d86970
          Log:
          JENKINS-14803

          Given the use case, I think it's simpler to just define one option
          instead of two.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: src/main/java/hudson/remoting/Launcher.java http://jenkins-ci.org/commit/remoting/d1ccc5b6369d0eb8fc4da0d60bb96310b2d86970 Log: JENKINS-14803 Given the use case, I think it's simpler to just define one option instead of two.

            Unassigned Unassigned
            ealbgus Albin Gustavsson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: