Issue
On operations center instances, controllers are failing to connect using inbound TCP.
On controllers, if you find that agents configured to connect using inbound TCP are failing to connect with the following error, it’s likely that the TCP agent listener port has terminated:
May 26, 2023 11:29:37 A.M. hudson.remoting.jnlp.Main$CuiListener status INFO: Trying protocol: JNLP4-connect May 26, 2023 11:29:37 A.M. org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run INFO: Waiting for ProtocolStack to start. May 26, 2023 11:29:37 A.M. hudson.remoting.jnlp.Main$CuiListener status INFO: Protocol JNLP4-connect encountered an unexpected exception java.util.concurrent.ExecutionException: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent at org.jenkinsci.remoting.util.SettableFuture.get(SettableFuture.java:223) at hudson.remoting.Engine.innerRun(Engine.java:809) at hudson.remoting.Engine.run(Engine.java:543) Caused by: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.onRecvClosed(AckFilterLayer.java:280) at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:825) at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:155) at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer.access$1000(BIONetworkLayer.java:51) at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader.run(BIONetworkLayer.java:274) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125) at java.base/java.lang.Thread.run(Thread.java:829) May 26, 2023 11:29:37 A.M. hudson.remoting.jnlp.Main$CuiListener status INFO: reconnect rejected, sleeping 10s: java.lang.Exception: The server rejected the connection: None of the protocols were accepted at hudson.remoting.Engine.onConnectionRejected(Engine.java:888) at hudson.remoting.Engine.innerRun(Engine.java:835) at hudson.remoting.Engine.run(Engine.java:543)
Note that if you simply do not have the inbound TCP port enabled, you will encounter the message:
May 25, 2023 5:14:56 P.M. hudson.remoting.jnlp.Main$CuiListener status INFO: Locating server among [JENKINS_URL] May 25, 2023 5:14:56 P.M. hudson.remoting.jnlp.Main$CuiListener error SEVERE: JENKINS_URL/tcpSlaveAgentListener/ is invalid: 404 Not Found java.io.IOException: JENKINS_URL/tcpSlaveAgentListener/ is invalid: 404 Not Found at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:221) at hudson.remoting.Engine.innerRun(Engine.java:755) at hudson.remoting.Engine.run(Engine.java:543)
Resolution
-
First go to
Manage Jenkins
→Configure Global Security
→TCP port for inbound agents
and ensure it is enabled. -
If it is not enabled, set it to a fixed port, such as
50000
(or any available port that is open between the two machines), then try the connection again. -
If it is already enabled, it is possible that the
TCP agent listener port
thread terminated unexpectedly. To check if that is the case, go toJENKINS_URL/threadDump
and search in your browser for the textTCP agent listener port
, you should see that thread inRUNNABLE
state. -
If you do not see that thread, you could be impacted by JENKINS-70334 or JENKINS-59910.
BEE-29155
JENKINS-70334 is fixed in Jenkins 2.388 and CloudBees CI 2.387.1.2
.