Agent does not stay connected:Since updating to Jenkins 2.346.3

Dear Community

Since updating to Jenkins 2.346.3, the Agent connection has been dropping out after a few hours.

  • The connection method is as follows.
  1. The agent.jar is installed on a mac mini with macOS Monterey 12.4.
  2. java -jar /Users/build-user/Jenkins/agent.jar -jnlpUrl https://****/jenkins-agent.jnlp -secret **** -workDir "/Users/build-user/Jenkins" is running on a Unix agent, version 4.13.3.
  • The execution results are as follows
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main createEngine
情報: Setting up agent: ****
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener <init>
情報: Jenkins agent is running in headless mode.
8月 20, 2022 10:54:53 午前 hudson.remoting.Engine startEngine
情報: Using Remoting version: 4.13.3
8月 20, 2022 10:54:53 午前 org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
情報: Using /Users/build-user/Jenkins/remoting as a remoting work directory
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Locating server among [https://****/]
8月 20, 2022 10:54:53 午前 org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
情報: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
8月 20, 2022 10:54:53 午前 org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
情報: Remoting TCP connection tunneling is enabled. Skipping the TCP Agent Listener Port availability check
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Agent discovery successful
  Agent address: ****
  Agent port:    ****
  Identity:      ****
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Handshaking
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Connecting to ****:****
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Trying protocol: JNLP4-connect
8月 20, 2022 10:54:53 午前 org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run
情報: Waiting for ProtocolStack to start.
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Remote identity confirmed: ****
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Connected

After a few hours, it was suddenly Terminated.

8月 20, 2022 12:19:54 午後 hudson.remoting.jnlp.Main$CuiListener status
情報: Terminated
8月 20, 2022 12:20:04 午後 hudson.remoting.jnlp.Main$CuiListener status
情報: Performing onReconnect operation.
8月 20, 2022 12:20:04 午後 jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$EngineListenerAdapterImpl onReconnect
情報: Restarting agent via jenkins.slaves.restarter.UnixSlaveRestarter@7b0580cb
  • The Mac terminal display is as follows
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Connected
8月 20, 2022 12:19:54 午後 hudson.remoting.jnlp.Main$CuiListener status
情報: Terminated
8月 20, 2022 12:20:04 午後 hudson.remoting.jnlp.Main$CuiListener status
情報: Performing onReconnect operation.
8月 20, 2022 12:20:04 午後 jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$EngineListenerAdapterImpl onReconnect
情報: Restarting agent via jenkins.slaves.restarter.UnixSlaveRestarter@7b0580cb
/Users/build-user/Jenkins/start-up-jenkins.command: line 1:  9279 Killed: 9               java -jar /Users/build-user/Jenkins/agent.jar -jnlpUrl https://****/jenkins-agent.jnlp -secret **** -workDir "/Users/build-user/Jenkins"

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
  • The logs of Jenkins Controller in EC2 are as follows.
Connection was broken: java.nio.channels.ClosedChannelException
at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.onReadClosed(ChannelApplicationLayer.java:240)
at org.jenkinsci.remoting.protocol.ApplicationLayer.onRecvClosed(ApplicationLayer.java:221)
at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:825)
at org.jenkinsci.remoting.protocol.FilterLayer.onRecvClosed(FilterLayer.java:289)
at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.onRecvClosed(SSLEngineFilterLayer.java:177)
at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.switchToNoSecure(SSLEngineFilterLayer.java:279)
at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.processWrite(SSLEngineFilterLayer.java:501)
at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.processQueuedWrites(SSLEngineFilterLayer.java:244)
at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.doSend(SSLEngineFilterLayer.java:196)
at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.doCloseSend(SSLEngineFilterLayer.java:209)
at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doCloseSend(ProtocolStack.java:793)
at org.jenkinsci.remoting.protocol.ApplicationLayer.doCloseWrite(ApplicationLayer.java:172)
at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer$ByteBufferCommandTransport.closeWrite(ChannelApplicationLayer.java:342)
at hudson.remoting.Channel.close(Channel.java:1494)
at hudson.remoting.Channel.close(Channel.java:1447)
at hudson.slaves.SlaveComputer.closeChannel(SlaveComputer.java:923)
at hudson.slaves.SlaveComputer.access$100(SlaveComputer.java:112)
at hudson.slaves.SlaveComputer$2.run(SlaveComputer.java:803)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

I have not changed the Mac(agent) settings. I just updated jenkins(controller).

If anyone knows how to resolve this, please let me know.

did you download a new copy of agent.jar? I believe the remoting library upgraded in 2.346.3

Hi, Gavin

Thanks for your comment.

yes,I have changed from Jenkins 2.303.1 agent to Jenkins 2.346.3 agent.

We have changed the method to use websocket because reconnection of the agent had been a problem.
It now maintains the connection.

Thank you very much for viewing this page.