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

It is possible to save a Node without host configuration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Labels:
    • Environment:
      org.jenkins-ci.main:jenkins-war:2.170
      org.jenkins-ci:crypto-util:1.1
      org.jenkins-ci.modules:sshd:2.6
      org.kohsuke:trilead-putty-extension:1.2
      org.jenkins-ci.modules:ssh-cli-auth:1.5
      org.jenkins-ci.plugins:ssh-slaves:1.29.4
    • Similar Issues:
    • Released As:
      ssh-slaves-1.30.0

      Description

      If you do not set the host field in the Node configuration it is possible to save it, then when it tries to connect fails with an NPE

      Agent connection log

      ERROR: Unexpected error in launching a agent. This is probably a bug in Jenkins.
      java.lang.NullPointerException
      at com.trilead.ssh2.KnownHosts.hostnameMatches(KnownHosts.java:313)
      at com.trilead.ssh2.KnownHosts.getAllKnownHostEntries(KnownHosts.java:260)
      at com.trilead.ssh2.KnownHosts.recommendHostkeyAlgorithms(KnownHosts.java:504)
      at com.trilead.ssh2.KnownHosts.getPreferredServerHostkeyAlgorithmOrder(KnownHosts.java:282)
      at hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy.getPreferredKeyAlgorithms(KnownHostsFileKeyVerificationStrategy.java:92)
      at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:837)
      at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:833)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
       [04/04/19 15:40:41] Launch failed - cleaning up connection
      

       

      Config.xml

      <?xml version='1.1' encoding='UTF-8'?>
      <slave>
         <name>agentNullHost</name>
         <description>agent description</description>
         <remoteFS>/home/jenkins</remoteFS>
         <numExecutors>1</numExecutors>
         <mode>NORMAL</mode>
         <retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
          <launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.29.4">
             <port>22</port>
             <credentialsId>my-credentials</credentialsId>
             <launchTimeoutSeconds>210</launchTimeoutSeconds>
             <maxNumRetries>10</maxNumRetries>
             <retryWaitTime>15</retryWaitTime>
             <sshHostKeyVerificationStrategy class="hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy"/>
             <tcpNoDelay>true</tcpNoDelay>
        </launcher>
        <label>linux</label>
        <nodeProperties/>
      </slave>
      

        Attachments

          Issue Links

            Activity

            jenbeg Hao Maio created issue -
            Hide
            ifernandezcalvo Ivan Fernandez Calvo added a comment -

            It is weird this is tested on the unit test and does not fail, and I have a bunch of agent in both ways configured, Did it happens after an upgrade? if so Did you restarted Jenkins to get the new plugin?
            Could you attach the JENKINS_HOME/nodes/NODE_NAME/config.xml?

            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - It is weird this is tested on the unit test and does not fail, and I have a bunch of agent in both ways configured, Did it happens after an upgrade? if so Did you restarted Jenkins to get the new plugin? Could you attach the JENKINS_HOME/nodes/NODE_NAME/config.xml?
            jenbeg Hao Maio made changes -
            Field Original Value New Value
            Description 1)
            | |Host Key Verification Strategy| Known hosts for Verification Strategy|

             

            ERROR: Unexpected error in launching a agent. This is probably a bug in Jenkins.
            java.lang.NullPointerException
             at com.trilead.ssh2.KnownHosts.hostnameMatches(KnownHosts.java:313)
             at com.trilead.ssh2.KnownHosts.getAllKnownHostEntries(KnownHosts.java:260)
             at com.trilead.ssh2.KnownHosts.recommendHostkeyAlgorithms(KnownHosts.java:504)
             at com.trilead.ssh2.KnownHosts.getPreferredServerHostkeyAlgorithmOrder(KnownHosts.java:282)
             at hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy.getPreferredKeyAlgorithms(KnownHostsFileKeyVerificationStrategy.java:92)
             at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:837)
             at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:833)
             at java.util.concurrent.FutureTask.run(FutureTask.java:266)
             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
             at java.lang.Thread.run(Thread.java:748)
            [04/04/19 15:40:41] Launch failed - cleaning up connection

            2)  
            | |Host Key Verification Strategy| Non verifying Verification Strategy|

             

            [SSH] Opening SSH connection to null:22.
            1)
            | |Host Key Verification Strategy| Known hosts for Verification Strategy|

             

            ERROR: Unexpected error in launching a agent. This is probably a bug in Jenkins.
             java.lang.NullPointerException
             at com.trilead.ssh2.KnownHosts.hostnameMatches(KnownHosts.java:313)
             at com.trilead.ssh2.KnownHosts.getAllKnownHostEntries(KnownHosts.java:260)
             at com.trilead.ssh2.KnownHosts.recommendHostkeyAlgorithms(KnownHosts.java:504)
             at com.trilead.ssh2.KnownHosts.getPreferredServerHostkeyAlgorithmOrder(KnownHosts.java:282)
             at hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy.getPreferredKeyAlgorithms(KnownHostsFileKeyVerificationStrategy.java:92)
             at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:837)
             at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:833)
             at java.util.concurrent.FutureTask.run(FutureTask.java:266)
             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
             at java.lang.Thread.run(Thread.java:748)
             [04/04/19 15:40:41] Launch failed - cleaning up connection

            2)  
            | |Host Key Verification Strategy| Non verifying Verification Strategy|

             

            [SSH] Opening SSH connection to null:22.

             

            EDIT 05-04-2019

            -----------------------------

            *Config.xml*

            <?xml version='1.1' encoding='UTF-8'?>
            <slave>
               <name>slave01</name>
               <description>Slave for building and packaging (the delivery)</description>
               <remoteFS>/home/userName/jenkins_slave_node</remoteFS>
               <numExecutors>1</numExecutors>
               <mode>NORMAL</mode>
               <retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
                <launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.29.4">
                   <port>22</port>
                   <credentialsId>xxxxxxxx-xxxx-xxxx-8dd0-f9d5a90c058d</credentialsId>
                   <launchTimeoutSeconds>210</launchTimeoutSeconds>
                   <maxNumRetries>10</maxNumRetries>
                   <retryWaitTime>15</retryWaitTime>
                   <sshHostKeyVerificationStrategy class="hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy"/>
                   <tcpNoDelay>true</tcpNoDelay>
              </launcher>
              <label>deliver packaging customer_release</label>
              <nodeProperties/>
            </slave>
            Hide
            jenbeg Hao Maio added a comment -

            Ivan Fernandez Calvo : I added the config.xml, and yes jenkins had been restarted, before trying to launch the node.

            Show
            jenbeg Hao Maio added a comment - Ivan Fernandez Calvo : I added the config.xml, and yes jenkins had been restarted, before trying to launch the node.
            Hide
            ifernandezcalvo Ivan Fernandez Calvo added a comment -

            Your configuration does not have a host, I dunno why, it is not correct. If you edit the configuration from the UI there is no way to save it without a host, so try saving it correctly.

            <?xml version='1.1' encoding='UTF-8'?>
            <slave>
              <name>test-agent</name>
              <description>test JENKINS-56885</description>
              <remoteFS>/home/jenkins</remoteFS>
              <numExecutors>1</numExecutors>
              <mode>NORMAL</mode>
              <retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
              <launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.29.4">
                <host>192.168.1.125</host> <!-- YOUR CONFIGURATION DOES NOT HAVE HOST -->
                <port>22</port>
                <credentialsId>25a7cd49-5d24-454f-aef4-fc14bbf89ab1</credentialsId>
                <launchTimeoutSeconds>210</launchTimeoutSeconds>
                <maxNumRetries>10</maxNumRetries>
                <retryWaitTime>15</retryWaitTime>
                <sshHostKeyVerificationStrategy class="hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy">
                  <requireInitialManualTrust>false</requireInitialManualTrust>
                </sshHostKeyVerificationStrategy>
                <tcpNoDelay>true</tcpNoDelay>
              </launcher>
              <label>local-test</label>
              <nodeProperties/>
            </slave>
            
            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - Your configuration does not have a host, I dunno why, it is not correct. If you edit the configuration from the UI there is no way to save it without a host, so try saving it correctly. <?xml version= '1.1' encoding= 'UTF-8' ?> <slave> <name>test-agent</name> <description>test JENKINS-56885</description> <remoteFS>/home/jenkins</remoteFS> <numExecutors>1</numExecutors> <mode>NORMAL</mode> <retentionStrategy class= "hudson.slaves.RetentionStrategy$Always" /> <launcher class= "hudson.plugins.sshslaves.SSHLauncher" plugin= "ssh-slaves@1.29.4" > <host>192.168.1.125</host> <!-- YOUR CONFIGURATION DOES NOT HAVE HOST --> <port>22</port> <credentialsId>25a7cd49-5d24-454f-aef4-fc14bbf89ab1</credentialsId> <launchTimeoutSeconds>210</launchTimeoutSeconds> <maxNumRetries>10</maxNumRetries> <retryWaitTime>15</retryWaitTime> <sshHostKeyVerificationStrategy class= "hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy" > <requireInitialManualTrust> false </requireInitialManualTrust> </sshHostKeyVerificationStrategy> <tcpNoDelay> true </tcpNoDelay> </launcher> <label>local-test</label> <nodeProperties/> </slave>
            jenbeg Hao Maio made changes -
            Hide
            jenbeg Hao Maio added a comment -

            I did saved it over the GUI, but havent entered any host. It was the only enter field without any question mark icon. I havent even realized that it exists ... So, you enter there the host ip of the master ?

             

            Show
            jenbeg Hao Maio added a comment - I did saved it over the GUI, but havent entered any host. It was the only enter field without any question mark icon. I havent even realized that it exists ... So, you enter there the host ip of the master ?  
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Summary hostnameMatches -> NullPointerException It is possible to save a Node without host configuration
            Hide
            ifernandezcalvo Ivan Fernandez Calvo added a comment -

            you have to put there the DNS name or IP of the machine you want to use as Agent, it should not be the master name or IP because you already have some executors on the master configured by default thus put the master as Agent does not have any sense.

            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - you have to put there the DNS name or IP of the machine you want to use as Agent, it should not be the master name or IP because you already have some executors on the master configured by default thus put the master as Agent does not have any sense.
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Description 1)
            | |Host Key Verification Strategy| Known hosts for Verification Strategy|

             

            ERROR: Unexpected error in launching a agent. This is probably a bug in Jenkins.
             java.lang.NullPointerException
             at com.trilead.ssh2.KnownHosts.hostnameMatches(KnownHosts.java:313)
             at com.trilead.ssh2.KnownHosts.getAllKnownHostEntries(KnownHosts.java:260)
             at com.trilead.ssh2.KnownHosts.recommendHostkeyAlgorithms(KnownHosts.java:504)
             at com.trilead.ssh2.KnownHosts.getPreferredServerHostkeyAlgorithmOrder(KnownHosts.java:282)
             at hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy.getPreferredKeyAlgorithms(KnownHostsFileKeyVerificationStrategy.java:92)
             at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:837)
             at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:833)
             at java.util.concurrent.FutureTask.run(FutureTask.java:266)
             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
             at java.lang.Thread.run(Thread.java:748)
             [04/04/19 15:40:41] Launch failed - cleaning up connection

            2)  
            | |Host Key Verification Strategy| Non verifying Verification Strategy|

             

            [SSH] Opening SSH connection to null:22.

             

            EDIT 05-04-2019

            -----------------------------

            *Config.xml*

            <?xml version='1.1' encoding='UTF-8'?>
            <slave>
               <name>slave01</name>
               <description>Slave for building and packaging (the delivery)</description>
               <remoteFS>/home/userName/jenkins_slave_node</remoteFS>
               <numExecutors>1</numExecutors>
               <mode>NORMAL</mode>
               <retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
                <launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.29.4">
                   <port>22</port>
                   <credentialsId>xxxxxxxx-xxxx-xxxx-8dd0-f9d5a90c058d</credentialsId>
                   <launchTimeoutSeconds>210</launchTimeoutSeconds>
                   <maxNumRetries>10</maxNumRetries>
                   <retryWaitTime>15</retryWaitTime>
                   <sshHostKeyVerificationStrategy class="hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy"/>
                   <tcpNoDelay>true</tcpNoDelay>
              </launcher>
              <label>deliver packaging customer_release</label>
              <nodeProperties/>
            </slave>
            If you do not set the host field in the Node configuration it is possible to save it, then when it tries to connect fails with an NPE

            !Screenshot from 2019-04-05 13-00-24.png!

            Agent connection log

            {code}
            ERROR: Unexpected error in launching a agent. This is probably a bug in Jenkins.
            java.lang.NullPointerException
            at com.trilead.ssh2.KnownHosts.hostnameMatches(KnownHosts.java:313)
            at com.trilead.ssh2.KnownHosts.getAllKnownHostEntries(KnownHosts.java:260)
            at com.trilead.ssh2.KnownHosts.recommendHostkeyAlgorithms(KnownHosts.java:504)
            at com.trilead.ssh2.KnownHosts.getPreferredServerHostkeyAlgorithmOrder(KnownHosts.java:282)
            at hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy.getPreferredKeyAlgorithms(KnownHostsFileKeyVerificationStrategy.java:92)
            at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:837)
            at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:833)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at java.lang.Thread.run(Thread.java:748)
             [04/04/19 15:40:41] Launch failed - cleaning up connection
            {code}
             

            *Config.xml*

            {code}
            <?xml version='1.1' encoding='UTF-8'?>
            <slave>
               <name>agentNullHost</name>
               <description>agent description</description>
               <remoteFS>/home/jenkins</remoteFS>
               <numExecutors>1</numExecutors>
               <mode>NORMAL</mode>
               <retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/>
                <launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="ssh-slaves@1.29.4">
                   <port>22</port>
                   <credentialsId>my-credentials</credentialsId>
                   <launchTimeoutSeconds>210</launchTimeoutSeconds>
                   <maxNumRetries>10</maxNumRetries>
                   <retryWaitTime>15</retryWaitTime>
                   <sshHostKeyVerificationStrategy class="hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy"/>
                   <tcpNoDelay>true</tcpNoDelay>
              </launcher>
              <label>linux</label>
              <nodeProperties/>
            </slave>
            {code}
            Hide
            jenbeg Hao Maio added a comment -

            Ivan Fernandez Calvo: could you please give me any hint, of where I can read more about, what || how to choose the host ip ?

             

            Show
            jenbeg Hao Maio added a comment - Ivan Fernandez Calvo : could you please give me any hint, of where I can read more about, what || how to choose the host ip ?  
            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - take a look to the documentation https://wiki.jenkins.io/display/JENKINS/Distributed+builds also https://jenkins.io/doc/pipeline/tour/getting-started/
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Remote Link This issue links to "PR (Web Link)" [ 22561 ]
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Hide
            ifernandezcalvo Ivan Fernandez Calvo added a comment - - edited

            1.30 version will protect against those pitfalls

            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - - edited 1.30 version will protect against those pitfalls
            jenbeg Hao Maio made changes -
            Hide
            jenbeg Hao Maio added a comment -

            Ivan Fernandez Calvo: Unfortunately the documentation doesnt say anything about the host:

            https://jenkins.io/doc/book/managing/nodes/

             

            Maybe you have another hint?

            Show
            jenbeg Hao Maio added a comment - Ivan Fernandez Calvo : Unfortunately the documentation doesnt say anything about the host: https://jenkins.io/doc/book/managing/nodes/   Maybe you have another hint?
            Hide
            ifernandezcalvo Ivan Fernandez Calvo added a comment -

            Jira is not a support site see https://wiki.jenkins.io/display/JENKINS/How+to+report+an+issue
            BTW, the host setting is a hostname or an IP address of a host you want to use as an agent to execute jobs in it, does not have too much complication or too much to understand.

            Show
            ifernandezcalvo Ivan Fernandez Calvo added a comment - Jira is not a support site see https://wiki.jenkins.io/display/JENKINS/How+to+report+an+issue BTW, the host setting is a hostname or an IP address of a host you want to use as an agent to execute jobs in it, does not have too much complication or too much to understand.
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Fixed but Unreleased [ 10203 ]
            ifernandezcalvo Ivan Fernandez Calvo made changes -
            Released As ssh-slaves-1.30.0
            Status Fixed but Unreleased [ 10203 ] Resolved [ 5 ]

              People

              Assignee:
              ifernandezcalvo Ivan Fernandez Calvo
              Reporter:
              jenbeg Hao Maio
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: