Jenkins windows agent cannot connect

Hi, please help me look at my problem:

Jenkins controller is deployed on a Centos7 VM, the Java version is: java version “17.0.10” 2024-01-16 LTS,
The Agent is a Windows Server 2016, Java version is the same as the controller,
The firewall of the controller and the Agent are all turned off,
The Jenkins version is 2.426.3.

The logs of the Agent executing the connection to the controller are as follows:

PS C:\jenkins> java -jar agent.jar -jnlpUrl http://10.8.128.15:8080/computer/windows%5Fslave%5F16/jenkins-agent.jnlp -workDir "c:\jenkins"

2月 02, 2024 4:07:46 下午 org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

信息: Using c:\jenkins\remoting as a remoting work directory

2月 02, 2024 4:07:46 下午 org.jenkinsci.remoting.engine.WorkDirManager setupLogging

信息: Both error and output logs will be printed to c:\jenkins\remoting

2月 02, 2024 4:07:46 下午 hudson.remoting.jnlp.Main createEngine

信息: Setting up agent: windows_slave_16

2月 02, 2024 4:07:46 下午 hudson.remoting.Engine startEngine

信息: Using Remoting version: 3160.vd76b_9ddd10cc

2月 02, 2024 4:07:46 下午 org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

信息: Using c:\jenkins\remoting as a remoting work directory

2月 02, 2024 4:07:46 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Locating server among [http://10.8.128.15:8080/]

2月 02, 2024 4:07:46 下午 org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve

信息: Remoting server accepts the following protocols: [JNLP4-connect, Ping]

2月 02, 2024 4:07:46 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Agent discovery successful

Agent address: 10.8.128.15

Agent port: 18080

Identity: 4d:0f:50:41:6f:ad:da:95:ce:ca:d6:62:7b:ec:08:6d

2月 02, 2024 4:07:46 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Handshaking

2月 02, 2024 4:07:46 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Connecting to 10.8.128.15:18080

2月 02, 2024 4:07:46 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Trying protocol: JNLP4-connect

2月 02, 2024 4:07:51 下午 org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run

信息: Waiting for ProtocolStack to start.

2月 02, 2024 4:07:51 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Remote identity confirmed: 4d:0f:50:41:6f:ad:da:95:ce:ca:d6:62:7b:ec:08:6d

2月 02, 2024 4:07:51 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Connected

2月 02, 2024 4:07:52 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Terminated

2月 02, 2024 4:08:02 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Performing onReconnect operation.

2月 02, 2024 4:08:02 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: onReconnect operation completed.

2月 02, 2024 4:08:02 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Locating server among [http://10.8.128.15:8080/]

2月 02, 2024 4:08:02 下午 org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve

信息: Remoting server accepts the following protocols: [JNLP4-connect, Ping]

2月 02, 2024 4:08:02 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Agent discovery successful

Agent address: 10.8.128.15

Agent port: 18080

Identity: 4d:0f:50:41:6f:ad:da:95:ce:ca:d6:62:7b:ec:08:6d

2月 02, 2024 4:08:02 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Handshaking

2月 02, 2024 4:08:02 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Connecting to 10.8.128.15:18080

2月 02, 2024 4:08:02 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Trying protocol: JNLP4-connect

2月 02, 2024 4:08:06 下午 org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run

信息: Waiting for ProtocolStack to start.

2月 02, 2024 4:08:06 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Remote identity confirmed: 4d:0f:50:41:6f:ad:da:95:ce:ca:d6:62:7b:ec:08:6d

2月 02, 2024 4:08:06 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Connected

2月 02, 2024 4:08:07 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Terminated

2月 02, 2024 4:08:07 下午 hudson.remoting.Request$2 run

信息: Failed to send back a reply to the request UserRequest:jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$FindEffectiveRestarters@520568d1: hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel@1b8728d7:JNLP4-connect connection to 10.8.128.15/10.8.128.15:18080": chann

el is already closed

2月 02, 2024 4:08:17 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Performing onReconnect operation.

2月 02, 2024 4:08:17 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: onReconnect operation completed.

2月 02, 2024 4:08:17 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Locating server among [http://10.8.128.15:8080/]

2月 02, 2024 4:08:17 下午 org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve

信息: Remoting server accepts the following protocols: [JNLP4-connect, Ping]

2月 02, 2024 4:08:17 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Agent discovery successful

Agent address: 10.8.128.15

Agent port: 18080

Identity: 4d:0f:50:41:6f:ad:da:95:ce:ca:d6:62:7b:ec:08:6d

2月 02, 2024 4:08:17 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Handshaking

2月 02, 2024 4:08:17 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Connecting to 10.8.128.15:18080

2月 02, 2024 4:08:17 下午 hudson.remoting.jnlp.Main$CuiListener status

信息: Trying protocol: JNLP4-connect

PS C:\jenkins>

The logs of the controller are as follows:

Inbound agent connected from 10.8.128.16/10.8.128.16:1243
Remoting version: 3160.vd76b_9ddd10cc
Launcher: JNLPLauncher
Communication Protocol: JNLP4-connect
This is a Windows agent
ERROR: Failed to install restarter
java.nio.channels.ClosedChannelException
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.8.128.16/10.8.128.16:1243
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787)
		at hudson.remoting.Request.call(Request.java:199)
		at hudson.remoting.Channel.call(Channel.java:1002)
		at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$Install.install(JnlpSlaveRestarterInstaller.java:71)
		at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$Install.call(JnlpSlaveRestarterInstaller.java:60)
		at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$Install.call(JnlpSlaveRestarterInstaller.java:49)
		at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
		at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
Caused: hudson.remoting.RequestAbortedException
	at hudson.remoting.Request.abort(Request.java:346)
	at hudson.remoting.Channel.terminate(Channel.java:1083)
	at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.onReadClosed(ChannelApplicationLayer.java:241)
	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:343)
	at hudson.remoting.Channel.close(Channel.java:1497)
	at hudson.remoting.Channel.close(Channel.java:1450)
	at hudson.slaves.SlaveComputer.closeChannel(SlaveComputer.java:943)
	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:759)
	at jenkins.slaves.DefaultJnlpSlaveReceiver.afterChannel(DefaultJnlpSlaveReceiver.java:176)
	at org.jenkinsci.remoting.engine.JnlpConnectionState.fire(JnlpConnectionState.java:337)
	at org.jenkinsci.remoting.engine.JnlpConnectionState.fireAfterChannel(JnlpConnectionState.java:428)
	at org.jenkinsci.remoting.engine.JnlpProtocol4Handler$Handler.lambda$onChannel$0(JnlpProtocol4Handler.java:335)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
	at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:842)
ERROR: Connection terminated
java.nio.channels.ClosedChannelException
	at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.onReadClosed(ChannelApplicationLayer.java:241)
	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:343)
	at hudson.remoting.Channel.close(Channel.java:1497)
	at hudson.remoting.Channel.close(Channel.java:1450)
	at hudson.slaves.SlaveComputer.closeChannel(SlaveComputer.java:943)
	at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:759)
	at jenkins.slaves.DefaultJnlpSlaveReceiver.afterChannel(DefaultJnlpSlaveReceiver.java:176)
	at org.jenkinsci.remoting.engine.JnlpConnectionState.fire(JnlpConnectionState.java:337)
	at org.jenkinsci.remoting.engine.JnlpConnectionState.fireAfterChannel(JnlpConnectionState.java:428)
	at org.jenkinsci.remoting.engine.JnlpProtocol4Handler$Handler.lambda$onChannel$0(JnlpProtocol4Handler.java:335)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
	at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:842)

solution: upgrade to the latest LTS version of Jenkins and utilize SSH to connect the agent.