Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Issue: hudson.remoting.ChannelClosedException: channel is already closed

Tags:

jenkins

We are seeing hudson.remoting.ChannelClosedException: channel is already closed which is caused by java.net.SocketException: Connection reset. Any suggestions on how to fix it?

The full exception stacktrace:

[21-11-2013 14:29:54] FATAL: channel is already closed 
[21-11-2013 14:29:54] hudson.remoting.ChannelClosedException: channel is already closed 
[21-11-2013 14:29:54] at hudson.remoting.Channel.send(Channel.java:516) 
[21-11-2013 14:29:54] at hudson.remoting.Request.call(Request.java:129) 
[21-11-2013 14:29:54] at hudson.remoting.Channel.call(Channel.java:714) 
[21-11-2013 14:29:54] at hudson.Launcher$RemoteLauncher.kill(Launcher.java:887) 
[21-11-2013 14:29:54] at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:609) 
[21-11-2013 14:29:54] at com.tikal.jenkins.plugins.multijob.MultiJobBuild$MultiJobRunnerImpl.run(MultiJobBuild.java:67) 
[21-11-2013 14:29:54] at hudson.model.Run.execute(Run.java:1603) 
[21-11-2013 14:29:54] at hudson.model.Run.run(Run.java:1549) 
[21-11-2013 14:29:54] at com.tikal.jenkins.plugins.multijob.MultiJobBuild.run(MultiJobBuild.java:60) 
[21-11-2013 14:29:54] at hudson.model.ResourceController.execute(ResourceController.java:88) 
[21-11-2013 14:29:54] at hudson.model.Executor.run(Executor.java:247) 
[21-11-2013 14:29:54] Caused by: java.net.SocketException: Connection reset 
[21-11-2013 14:29:54] at java.net.SocketInputStream.read(Unknown Source) 
[21-11-2013 14:29:54] at java.net.SocketInputStream.read(Unknown Source) 
[21-11-2013 14:29:54] at java.io.BufferedInputStream.fill(Unknown Source) 
[21-11-2013 14:29:54] at java.io.BufferedInputStream.read(Unknown Source) 
[21-11-2013 14:29:54] at hudson.remoting.FlightRecorderInputStream.read(FlightRecorderInputStream.java:77) 
[21-11-2013 14:29:54] at java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source) 
[21-11-2013 14:29:54] at java.io.ObjectInputStream$BlockDataInputStream.peek(Unknown Source) 
[21-11-2013 14:29:54] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source) 
[21-11-2013 14:29:54] at java.io.ObjectInputStream.readObject0(Unknown Source) 
[21-11-2013 14:29:54] at java.io.ObjectInputStream.readObject(Unknown Source) 
[21-11-2013 14:29:54] at hudson.remoting.Command.readFrom(Command.java:92) 
[21-11-2013 14:29:54] at hudson.remoting.ClassicCommandTransport.read(ClassicCommandTransport.java:71) 
like image 652
KishoreRP Avatar asked Nov 22 '13 03:11

KishoreRP


2 Answers

As I know, that error can come when a build is running on a slave PC and the client stops... If it's not a master-slave problem, the see the full log of jenkins ( you can find it in Jenkins installation directory) and see what causes the problem ( can be a problem of heap or I don't know what cause the problem). Anyway, a restart of Jenkins can be a solution!

like image 153
23ars Avatar answered Oct 16 '22 16:10

23ars


You get this error for 2 reasons:

  1. The first time Jenkins tries to SSH on the remote node, the server prompts the user if he'd like to add the SHH key to its known keys. Normally, in a command prompt, you'd only answer YES and move on. But Jenkins will get stuck on this line. Then the connection attempt will fail. Solution: connect manually to the remote node from jenkins server using a command prompt once. Then you can answer YES manually. All future attempts from jenkins will work.

  2. The java agent stopped working for an obscure reason on the remote node. Solution: restart the java agent. Simple enough... but maybe not if you dont know how to restart it! I found that a simple way is to change the timeout value (connection timeout in seconds) on the node configuration. When saving the new value, you will actually restart the java agent!

like image 25
pmartin8 Avatar answered Oct 16 '22 18:10

pmartin8