Closed channel exception

Hi Team,

Hope you all are doing well.

I have done setup Jenkins and Jenkins Slave. Same setup is working in one window server and not working in another window server. There are few test jobs running on Jenkins slave. After executing few test cases it is giving following exception:
TC02-Checkbox is Checked FATAL: command execution failed
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)
at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:80)
at jenkins.websocket.Jetty10Provider$2.onWebSocketClose(Jetty10Provider.java:149)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.notifyOnClose(JettyWebSocketFrameHandler.java:308)


Caused: java.io.IOException: Backing channel ‘robot_slave’ is disconnected.

at hudson.remoting.RemoteInvocationHandler.channelOrFail(RemoteInvocationHandler.java:215)
at hudson.remoting.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:285)
at com.sun.proxy.$Proxy76.isAlive(Unknown Source)
at hudson.Launcher$RemoteLauncher$ProcImpl.isAlive(Launcher.java:1215)

Caused: hudson.remoting.ChannelClosedException: Channel “hudson.remoting.Channel@1b5a9b08:robot_slave”: Remote call on robot_slave failed. The channel is closing down or has closed down
at hudson.remoting.Channel.call(Channel.java:993)
at hudson.FilePath.act(FilePath.java:1186)
at hudson.FilePath.act(FilePath.java:1175)
at hudson.FilePath.delete(FilePath.java:1722)

I guess this connection exception comes because of time out. Please help to resolve this. Thanks

Hi @Shashi,

As a reminder, the term “slave” to refer to an agent has been deprecated since 2016. Please refer to On Jenkins Terminology Updates for more details. We request you update your post.

Thanks,
Bruno Verachten

Hi @poddingue

Thanks for the update. Agent is giving following error-
FATAL: command execution failed
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)

Please guide.

Thanks

1 Like

Thanks for the feedback.
Are your controller and agent running the same Java version?

Yes same java version.

FATAL: command execution failed
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)
at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:88)
at jenkins.websocket.Jetty10Provider$2.onWebSocketClose(Jetty10Provider.java:143)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.notifyOnClose(JettyWebSocketFrameHandler.java:308)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.onClosed(JettyWebSocketFrameHandler.java:292)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.lambda$closeConnection$0(WebSocketCoreSession.java:272)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1450)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1487)
at org.eclipse.jetty.websocket.core.server.internal.AbstractHandshaker$1.handle(AbstractHandshaker.java:212)
at org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession.lambda$closeConnection$1(WebSocketCoreSession.java:272)

Which is?
And what is the Jenkins version you’re running by the way?

Thanks.

Java version- C:\Program Files\Amazon Corretto\jdk11.0.17_8
Jenkins version- Jenkins 2.375.2

After executing some test cases then giving channelclosedexception.
TC03-Label Configuration Check | PASS |

TC04-Check F6 existing in RF Packing Qty Scan id=ord_0

2302061656

PASS
TC05-The Menu of Packing Outgoing Label Exists FATAL: command execution failed
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)
at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:88)
at jenkins.websocket.Jetty10Provider$2.onWebSocketClose(Jetty10Provider.java:143)
at org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler.notifyOnClose(JettyWebSocketFrameHandler.java:308)

Is it possible this comes because of timeout? Thanks

1 Like

We are using Java version- C:\Program Files\Amazon Corretto\jdk11.0.17_8
Jenkins version- Jenkins 2.375.2 and I set connectiontimeout=“600000”
but still giving same exception-

FATAL: command execution failed
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)
at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:88)
at jenkins.websocket.Jetty10Provider$2.onWebSocketClose(Jetty10Provider.java:143)

Please suggest do I need to set any timeout.

1 Like

Hi Poddingue,

We are using Java version- C:\Program Files\Amazon Corretto\jdk11.0.17_8
Jenkins version- Jenkins 2.375.2 and I set connectiontimeout=“600000”
but still giving same exception-

FATAL: command execution failed
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)
at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:88)
at jenkins.websocket.Jetty10Provider$2.onWebSocketClose(Jetty10Provider.java:143)

Please suggest do I need to set any timeout.

1 Like

Thanks for the information.
You told us about your JDK version and Jenkins version on the controller, but what it the JDK version on your agents?

Hi @poddingue

JDK version on agent is also same jdk11.0.17_8.

1 Like

Thanks.
Is there any difference between the machine on which Jenkins is running fine, and the machine on which you have problems?
Is there a different network configuration between the two machines?
Are they on the same network?
What kind of network appliances do you have between your controller and your agent?
Is there a different firewall running on your two Jenkins controllers? Are the rules the same?

Hi

Jenkins master and agent are in same machine. Now exception is:

FATAL: Unable to delete script file C:\Users\ROBOT_~1\AppData\Local\Temp\jenkins4680287152008561667.bat
java.nio.channels.ClosedChannelException
at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:153)
at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:88)
at jenkins.websocket.Jetty10Provider$2.onWebSocketClose(Jetty10Provider.java:143)

1 Like

It is running on prem VM machine. It is a windows system. Please let me know which firewall rules I need to check.

Could it be linked to [JENKINS-1948] Intermittent slave disconnections with secondary symptoms - Jenkins Jira ?
Please add your logs and comments there.

Struggling to get my first Windows agents to stay connected. Getting following:

Inbound agent connected from <blah>
Remoting version: 3107.v665000b_51092
Launcher: JNLPLauncher
Communication Protocol: WebSocket
This is a Windows agent
Agent successfully connected and online
ERROR: Connection terminated
java.nio.channels.ClosedChannelException
	at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:157)
	at jenkins.websocket.WebSockets$1.onWebSocketClose(WebSockets.java:88)
	at jenkins.websocket.WebSockets$1.onWebSocketError(WebSockets.java:94)
	at jenkins.websocket.Jetty10Provider$2.onWebSocketError(Jetty10Provider.java:174)
<snip>

Same issues with trying to connect two different nodes, all three boxes are Windows Server 2016 using JDK 11.0.19. The agents appear as online, I start a build and they die almost immediately (54 seconds is the longest lived). The nodes also die and restart just sitting at idle. Agents are configured to run/restart as a Windows Service.