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

Better implementation of -noreconnect jnlp slaves

XMLWordPrintable

    • 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.

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

              Created:
              Updated:
              Resolved: