-
Bug
-
Resolution: Not A Defect
-
Critical
-
None
-
Jenkins 2.277.3
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.