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

Protocol JNLP4-connect failed to establish channel

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Not A Defect
    • remoting
    • None
    • Jenkins 2.277.3

    Description

      The windows agent doesn't connect to Jenkins server

      Step to reproduce

      1) download agent.jar from Jenkins server

      2) run in windows cmd:

      C:\tmp>java -jar agent.jar -jnlpUrl https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp -secret 94e0097f6b1b889bb19386667909d373d762a5c08230963a7df0df5e35aa6540 -noCertificateCheck

      This is the log:

      Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
      INFO: Setting up agent: Jenkins Windows Slave
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener <init>
      INFO: Jenkins agent is running in headless mode.
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
      WARNING: Certificate validation for HTTPs endpoints is disabled
      May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
      INFO: Using Remoting version: 4.6
      May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
      WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\gianc\.jenkins\cache\jars
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Locating server among https://jenkins.[myurl.com
      May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver openURLConnection
      WARNING: HTTPs certificate check is disabled for the endpoint.
      May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
      INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Agent discovery successful
      Agent address: jenkins.myurl.com
      Agent port: 30500
      Identity: e6:20:0c:c5:02:da:ef:3e:ec:a1:d1:76:45:b3:f7:46
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Handshaking
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Connecting to jenkins.myurl.com:30500
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Trying protocol: JNLP4-connect
      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Protocol JNLP4-connect failed to establish channel
      java.nio.channels.ClosedChannelException
      at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doSend(ProtocolStack.java:694)
      at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.doSend(AckFilterLayer.java:312)
      at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.start(AckFilterLayer.java:187)
      at org.jenkinsci.remoting.protocol.ProtocolStack.init(ProtocolStack.java:202)
      at org.jenkinsci.remoting.protocol.ProtocolStack.access$700(ProtocolStack.java:107)
      at org.jenkinsci.remoting.protocol.ProtocolStack$Builder.build(ProtocolStack.java:555)
      at org.jenkinsci.remoting.engine.JnlpProtocol4Handler.connect(JnlpProtocol4Handler.java:181)
      at org.jenkinsci.remoting.engine.JnlpProtocolHandler.connect(JnlpProtocolHandler.java:157)
      at hudson.remoting.Engine.innerRun(Engine.java:739)
      at hudson.remoting.Engine.run(Engine.java:514)

      ^^

      May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener error
      SEVERE: The server rejected the connection: None of the protocols were accepted
      java.lang.Exception: The server rejected the connection: None of the protocols were accepted
      at hudson.remoting.Engine.onConnectionRejected(Engine.java:824)
      at hudson.remoting.Engine.innerRun(Engine.java:764)
      at hudson.remoting.Engine.run(Engine.java:514)

       

      I have read the source code

      https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Engine.java

      but i don't understand why it raise

       

      failed to establish channel

      It would be nice to implement in the source code the explanation of why the communication fails

       

      I have an old good Jenkins 2.249.3

      if i try to connect on port 30500:

      telnet good-jenkins.myurl.com 30500
      Trying 192.168.45.110...
      Connected to good-jenkins.myurl.com.
      Escape character is '^]'.

      instead with the new release of Jenkins 2.277.3, it connects, but then the connection is immediately disconnected

      telnet bad-jenkins.myurl.com 30500
      Trying 192.168.43.49...
      Connected to bad-jenkins.myurl.com.
      Escape character is '^]'.
      Connection closed by foreign host.

       

      I have attached the global security - agent config.

       

      Attachments

        Activity

          gianca Giancarlo created issue -
          gianca Giancarlo made changes -
          Field Original Value New Value
          Rank Ranked higher
          gianca Giancarlo made changes -
          Attachment agent.jpg [ 54763 ]
          Description The windows agent doesn't connect to Jenkins server

          Step to reproduce

          1) download agent.jar from Jenkins server

          2) run in windows cmd:

          C:\tmp>java -jar agent.jar -jnlpUrl https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp -secret 94e0097f6b1b889bb19386667909d373d762a5c08230963a7df0df5e35aa6540

          This is the log

           

          ^[Loaded java.lang.Throwable$PrintStreamOrWriter from C:\Program Files\Java\jre1.8.0_51\lib\rt.jar]^
          ^[Loaded java.lang.Throwable$WrappedPrintWriter from C:\Program Files\Java\jre1.8.0_51\lib\rt.jar]^
          ^[Loaded java.util.IdentityHashMap$KeySet from C:\Program Files\Java\jre1.8.0_51\lib\rt.jar]^
          ^May 10, 2021 5:45:27 PM hudson.remoting.jnlp.Main$CuiListener status^
          ^INFO: Protocol JNLP4-connect failed to establish channel^
          ^java.nio.channels.ClosedChannelException^
           ^at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doSend(ProtocolStack.java:694)^
           ^at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.doSend(AckFilterLayer.java:312)^
           ^at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.start(AckFilterLayer.java:187)^
           ^at org.jenkinsci.remoting.protocol.ProtocolStack.init(ProtocolStack.java:202)^
           ^at org.jenkinsci.remoting.protocol.ProtocolStack.access$700(ProtocolStack.java:107)^
           ^at org.jenkinsci.remoting.protocol.ProtocolStack$Builder.build(ProtocolStack.java:555)^
           ^at org.jenkinsci.remoting.engine.JnlpProtocol4Handler.connect(JnlpProtocol4Handler.java:181)^
           ^at org.jenkinsci.remoting.engine.JnlpProtocolHandler.connect(JnlpProtocolHandler.java:157)^
           ^at hudson.remoting.Engine.innerRun(Engine.java:739)^
           ^at hudson.remoting.Engine.run(Engine.java:514)^

          ^May 10, 2021 5:45:27 PM hudson.remoting.jnlp.Main$CuiListener error^
          ^SEVERE: The server rejected the connection: None of the protocols were accepted^
          ^java.lang.Exception: The server rejected the connection: None of the protocols were accepted^
           ^at hudson.remoting.Engine.onConnectionRejected(Engine.java:824)^
           ^at hudson.remoting.Engine.innerRun(Engine.java:764)^
           ^at hudson.remoting.Engine.run(Engine.java:514)^

          ^[Loaded java.util.IdentityHashMap$IdentityHashMapIterator from C:\Program Files\Java\jre1.8.0_51\lib\rt.jar]^



          I have read the source code

          [https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Engine.java]

          but i don't understand why it raise

           

          *failed to establish channel*
          The windows agent doesn't connect to Jenkins server

          Step to reproduce

          1) download agent.jar from Jenkins server

          2) run in windows cmd:

          C:\tmp>java -jar agent.jar -jnlpUrl [https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp] -secret 94e0097f6b1b889bb19386667909d373d762a5c08230963a7df0df5e35aa6540

          This is the log:


          Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
          INFO: Setting up agent: Jenkins Windows Slave
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener <init>
          INFO: Jenkins agent is running in headless mode.
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
          WARNING: Certificate validation for HTTPs endpoints is disabled
          May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
          INFO: Using Remoting version: 4.6
          May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
          WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\gianc\.jenkins\cache\jars
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Locating server among [https://jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]/]
          May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver openURLConnection
          WARNING: HTTPs certificate check is disabled for the endpoint.
          May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
          INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Agent discovery successful
           Agent address: jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]
           Agent port: 30500
           Identity: e6:20:0c:c5:02:da:ef:3e:ec:a1:d1:76:45:b3:f7:46
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Handshaking
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Connecting to jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]:30500
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Trying protocol: JNLP4-connect
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Protocol JNLP4-connect failed to establish channel
          java.nio.channels.ClosedChannelException
           at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doSend(ProtocolStack.java:694)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.doSend(AckFilterLayer.java:312)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.start(AckFilterLayer.java:187)
           at org.jenkinsci.remoting.protocol.ProtocolStack.init(ProtocolStack.java:202)
           at org.jenkinsci.remoting.protocol.ProtocolStack.access$700(ProtocolStack.java:107)
           at org.jenkinsci.remoting.protocol.ProtocolStack$Builder.build(ProtocolStack.java:555)
           at org.jenkinsci.remoting.engine.JnlpProtocol4Handler.connect(JnlpProtocol4Handler.java:181)
           at org.jenkinsci.remoting.engine.JnlpProtocolHandler.connect(JnlpProtocolHandler.java:157)
           at hudson.remoting.Engine.innerRun(Engine.java:739)
           at hudson.remoting.Engine.run(Engine.java:514)

          {{^^}}

          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener error
          SEVERE: The server rejected the connection: None of the protocols were accepted
          java.lang.Exception: The server rejected the connection: None of the protocols were accepted
           at hudson.remoting.Engine.onConnectionRejected(Engine.java:824)
           at hudson.remoting.Engine.innerRun(Engine.java:764)
           at hudson.remoting.Engine.run(Engine.java:514)

           

          I have read the source code

          [https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Engine.java]

          but i don't understand why it raise

           

          *failed to establish channel*

           

          I have attached the global security - agent config.

           
          gianca Giancarlo made changes -
          Description The windows agent doesn't connect to Jenkins server

          Step to reproduce

          1) download agent.jar from Jenkins server

          2) run in windows cmd:

          C:\tmp>java -jar agent.jar -jnlpUrl [https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp] -secret 94e0097f6b1b889bb19386667909d373d762a5c08230963a7df0df5e35aa6540

          This is the log:


          Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
          INFO: Setting up agent: Jenkins Windows Slave
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener <init>
          INFO: Jenkins agent is running in headless mode.
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
          WARNING: Certificate validation for HTTPs endpoints is disabled
          May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
          INFO: Using Remoting version: 4.6
          May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
          WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\gianc\.jenkins\cache\jars
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Locating server among [https://jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]/]
          May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver openURLConnection
          WARNING: HTTPs certificate check is disabled for the endpoint.
          May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
          INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Agent discovery successful
           Agent address: jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]
           Agent port: 30500
           Identity: e6:20:0c:c5:02:da:ef:3e:ec:a1:d1:76:45:b3:f7:46
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Handshaking
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Connecting to jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]:30500
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Trying protocol: JNLP4-connect
          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Protocol JNLP4-connect failed to establish channel
          java.nio.channels.ClosedChannelException
           at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doSend(ProtocolStack.java:694)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.doSend(AckFilterLayer.java:312)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.start(AckFilterLayer.java:187)
           at org.jenkinsci.remoting.protocol.ProtocolStack.init(ProtocolStack.java:202)
           at org.jenkinsci.remoting.protocol.ProtocolStack.access$700(ProtocolStack.java:107)
           at org.jenkinsci.remoting.protocol.ProtocolStack$Builder.build(ProtocolStack.java:555)
           at org.jenkinsci.remoting.engine.JnlpProtocol4Handler.connect(JnlpProtocol4Handler.java:181)
           at org.jenkinsci.remoting.engine.JnlpProtocolHandler.connect(JnlpProtocolHandler.java:157)
           at hudson.remoting.Engine.innerRun(Engine.java:739)
           at hudson.remoting.Engine.run(Engine.java:514)

          {{^^}}

          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener error
          SEVERE: The server rejected the connection: None of the protocols were accepted
          java.lang.Exception: The server rejected the connection: None of the protocols were accepted
           at hudson.remoting.Engine.onConnectionRejected(Engine.java:824)
           at hudson.remoting.Engine.innerRun(Engine.java:764)
           at hudson.remoting.Engine.run(Engine.java:514)

           

          I have read the source code

          [https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Engine.java]

          but i don't understand why it raise

           

          *failed to establish channel*

           

          I have attached the global security - agent config.

           
          The windows agent doesn't connect to Jenkins server

          Step to reproduce

          1) download agent.jar from Jenkins server

          2) run in windows cmd:

          C:\tmp>java -jar agent.jar -jnlpUrl [https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp] -secret 94e0097f6b1b889bb19386667909d373d762a5c08230963a7df0df5e35aa6540 -noCertificateCheck

          This is the log:

          Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
           INFO: Setting up agent: Jenkins Windows Slave
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener <init>
           INFO: Jenkins agent is running in headless mode.
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
           WARNING: Certificate validation for HTTPs endpoints is disabled
           May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
           INFO: Using Remoting version: 4.6
           May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
           WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\gianc\.jenkins\cache\jars
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Locating server among [https://jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]/]
           May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver openURLConnection
           WARNING: HTTPs certificate check is disabled for the endpoint.
           May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
           INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Agent discovery successful
           Agent address: jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]
           Agent port: 30500
           Identity: e6:20:0c:c5:02:da:ef:3e:ec:a1:d1:76:45:b3:f7:46
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Handshaking
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Connecting to jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]:30500
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Trying protocol: JNLP4-connect
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Protocol JNLP4-connect failed to establish channel
           java.nio.channels.ClosedChannelException
           at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doSend(ProtocolStack.java:694)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.doSend(AckFilterLayer.java:312)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.start(AckFilterLayer.java:187)
           at org.jenkinsci.remoting.protocol.ProtocolStack.init(ProtocolStack.java:202)
           at org.jenkinsci.remoting.protocol.ProtocolStack.access$700(ProtocolStack.java:107)
           at org.jenkinsci.remoting.protocol.ProtocolStack$Builder.build(ProtocolStack.java:555)
           at org.jenkinsci.remoting.engine.JnlpProtocol4Handler.connect(JnlpProtocol4Handler.java:181)
           at org.jenkinsci.remoting.engine.JnlpProtocolHandler.connect(JnlpProtocolHandler.java:157)
           at hudson.remoting.Engine.innerRun(Engine.java:739)
           at hudson.remoting.Engine.run(Engine.java:514)

          {{^^}}

          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener error
           SEVERE: The server rejected the connection: None of the protocols were accepted
           java.lang.Exception: The server rejected the connection: None of the protocols were accepted
           at hudson.remoting.Engine.onConnectionRejected(Engine.java:824)
           at hudson.remoting.Engine.innerRun(Engine.java:764)
           at hudson.remoting.Engine.run(Engine.java:514)

           

          I have read the source code

          [https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Engine.java]

          but i don't understand why it raise

           

          *failed to establish channel*

           

          I have attached the global security - agent config.

           
          jthompson Jeff Thompson added a comment -

          You can try hitting the agent connection port at https://jenkins.myurl.com:30500 (based on your image), and see what it says for Jenkins-Agent-Protocols. Otherwise I don't have any good suggestions.

          jthompson Jeff Thompson added a comment - You can try hitting the agent connection port at https://jenkins.myurl.com:30500 (based on your image), and see what it says for Jenkins-Agent-Protocols. Otherwise I don't have any good suggestions.
          gianca Giancarlo added a comment -

          I have an old good Jenkins 2.249.3

          if i try to connect on port 30500:

          telnet good-jenkins.myurl.com 30500
          Trying 192.168.45.110...
          Connected to good-jenkins.myurl.com.
          Escape character is '^]'.

          instead with the new release of Jenkins 2.277.3, it connects, but then the connection is immediately disconnected

          telnet bad-jenkins.myurl.com 30500
          Trying 192.168.43.49...
          Connected to bad-jenkins.myurl.com.
          Escape character is '^]'.
          Connection closed by foreign host.

          gianca Giancarlo added a comment - I have an old good Jenkins 2.249.3 if i try to connect on port 30500: telnet good-jenkins.myurl.com 30500 Trying 192.168.45.110... Connected to good-jenkins.myurl.com. Escape character is '^]'. instead with the new release of Jenkins 2.277.3, it connects, but then the connection is immediately disconnected telnet bad-jenkins.myurl.com 30500 Trying 192.168.43.49... Connected to bad-jenkins.myurl.com. Escape character is '^]'. Connection closed by foreign host.
          gianca Giancarlo made changes -
          Description The windows agent doesn't connect to Jenkins server

          Step to reproduce

          1) download agent.jar from Jenkins server

          2) run in windows cmd:

          C:\tmp>java -jar agent.jar -jnlpUrl [https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp] -secret 94e0097f6b1b889bb19386667909d373d762a5c08230963a7df0df5e35aa6540 -noCertificateCheck

          This is the log:

          Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
           INFO: Setting up agent: Jenkins Windows Slave
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener <init>
           INFO: Jenkins agent is running in headless mode.
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
           WARNING: Certificate validation for HTTPs endpoints is disabled
           May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
           INFO: Using Remoting version: 4.6
           May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
           WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\gianc\.jenkins\cache\jars
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Locating server among [https://jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]/]
           May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver openURLConnection
           WARNING: HTTPs certificate check is disabled for the endpoint.
           May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
           INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Agent discovery successful
           Agent address: jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]
           Agent port: 30500
           Identity: e6:20:0c:c5:02:da:ef:3e:ec:a1:d1:76:45:b3:f7:46
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Handshaking
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Connecting to jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]:30500
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Trying protocol: JNLP4-connect
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Protocol JNLP4-connect failed to establish channel
           java.nio.channels.ClosedChannelException
           at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doSend(ProtocolStack.java:694)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.doSend(AckFilterLayer.java:312)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.start(AckFilterLayer.java:187)
           at org.jenkinsci.remoting.protocol.ProtocolStack.init(ProtocolStack.java:202)
           at org.jenkinsci.remoting.protocol.ProtocolStack.access$700(ProtocolStack.java:107)
           at org.jenkinsci.remoting.protocol.ProtocolStack$Builder.build(ProtocolStack.java:555)
           at org.jenkinsci.remoting.engine.JnlpProtocol4Handler.connect(JnlpProtocol4Handler.java:181)
           at org.jenkinsci.remoting.engine.JnlpProtocolHandler.connect(JnlpProtocolHandler.java:157)
           at hudson.remoting.Engine.innerRun(Engine.java:739)
           at hudson.remoting.Engine.run(Engine.java:514)

          {{^^}}

          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener error
           SEVERE: The server rejected the connection: None of the protocols were accepted
           java.lang.Exception: The server rejected the connection: None of the protocols were accepted
           at hudson.remoting.Engine.onConnectionRejected(Engine.java:824)
           at hudson.remoting.Engine.innerRun(Engine.java:764)
           at hudson.remoting.Engine.run(Engine.java:514)

           

          I have read the source code

          [https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Engine.java]

          but i don't understand why it raise

           

          *failed to establish channel*

           

          I have attached the global security - agent config.

           
          The windows agent doesn't connect to Jenkins server

          Step to reproduce

          1) download agent.jar from Jenkins server

          2) run in windows cmd:

          C:\tmp>java -jar agent.jar -jnlpUrl [https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp] -secret 94e0097f6b1b889bb19386667909d373d762a5c08230963a7df0df5e35aa6540 -noCertificateCheck

          This is the log:

          Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
           INFO: Setting up agent: Jenkins Windows Slave
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener <init>
           INFO: Jenkins agent is running in headless mode.
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main createEngine
           WARNING: Certificate validation for HTTPs endpoints is disabled
           May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
           INFO: Using Remoting version: 4.6
           May 10, 2021 6:11:14 PM hudson.remoting.Engine startEngine
           WARNING: No Working Directory. Using the legacy JAR Cache location: C:\Users\gianc\.jenkins\cache\jars
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Locating server among [https://jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]/]
           May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver openURLConnection
           WARNING: HTTPs certificate check is disabled for the endpoint.
           May 10, 2021 6:11:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
           INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Agent discovery successful
           Agent address: jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]
           Agent port: 30500
           Identity: e6:20:0c:c5:02:da:ef:3e:ec:a1:d1:76:45:b3:f7:46
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Handshaking
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Connecting to jenkins.[myurl.com|https://jenkins.myurl.com/computer/Jenkins%20Windows%20Slave/jenkins-agent.jnlp]:30500
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Trying protocol: JNLP4-connect
           May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener status
           INFO: Protocol JNLP4-connect failed to establish channel
           java.nio.channels.ClosedChannelException
           at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doSend(ProtocolStack.java:694)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.doSend(AckFilterLayer.java:312)
           at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.start(AckFilterLayer.java:187)
           at org.jenkinsci.remoting.protocol.ProtocolStack.init(ProtocolStack.java:202)
           at org.jenkinsci.remoting.protocol.ProtocolStack.access$700(ProtocolStack.java:107)
           at org.jenkinsci.remoting.protocol.ProtocolStack$Builder.build(ProtocolStack.java:555)
           at org.jenkinsci.remoting.engine.JnlpProtocol4Handler.connect(JnlpProtocol4Handler.java:181)
           at org.jenkinsci.remoting.engine.JnlpProtocolHandler.connect(JnlpProtocolHandler.java:157)
           at hudson.remoting.Engine.innerRun(Engine.java:739)
           at hudson.remoting.Engine.run(Engine.java:514)

          {{^^}}

          May 10, 2021 6:11:14 PM hudson.remoting.jnlp.Main$CuiListener error
           SEVERE: The server rejected the connection: None of the protocols were accepted
           java.lang.Exception: The server rejected the connection: None of the protocols were accepted
           at hudson.remoting.Engine.onConnectionRejected(Engine.java:824)
           at hudson.remoting.Engine.innerRun(Engine.java:764)
           at hudson.remoting.Engine.run(Engine.java:514)

           

          I have read the source code

          [https://github.com/jenkinsci/remoting/blob/master/src/main/java/hudson/remoting/Engine.java]

          but i don't understand why it raise

           

          *failed to establish channel*

          It would be nice to implement in the source code the explanation of why the communication fails

           

          I have an old good Jenkins 2.249.3

          if i try to connect on port 30500:

          telnet good-jenkins.myurl.com 30500
          Trying 192.168.45.110...
          Connected to good-jenkins.myurl.com.
          Escape character is '^]'.

          instead with the new release of Jenkins 2.277.3, it connects, but then the connection is immediately disconnected

          telnet bad-jenkins.myurl.com 30500
          Trying 192.168.43.49...
          Connected to bad-jenkins.myurl.com.
          Escape character is '^]'.
          Connection closed by foreign host.

           

          I have attached the global security - agent config.

           
          gianca Giancarlo added a comment -

          I found the cause:
          it is a problem related to the new helm template

          Now we need to add a new parameter, to configure it correctly:

          controller:
            agentListenerPort: 30500
            agentListenerNodePort: 30500

          gianca Giancarlo added a comment - I found the cause: it is a problem related to the new helm template Now we need to add a new parameter, to configure it correctly: controller:   agentListenerPort: 30500   agentListenerNodePort: 30500
          gianca Giancarlo added a comment -

          I found the cause:
          it is a bad configuration in the new helm template

          Now we need to add a new parameter, to configure it correctly:

          controller:
            agentListenerPort: 30500
            agentListenerNodePort: 30500

          gianca Giancarlo added a comment - I found the cause: it is a bad configuration in the new helm template Now we need to add a new parameter, to configure it correctly: controller:   agentListenerPort: 30500   agentListenerNodePort: 30500
          gianca Giancarlo made changes -
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
          basil Basil Crow made changes -
          Status Fixed but Unreleased [ 10203 ] Closed [ 6 ]

          People

            jthompson Jeff Thompson
            gianca Giancarlo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: