Hello,
There is a master machine and one slave machine. I am developing plugin that run 2 threads on the master node. Both threads call workspace.act() in parallel to perform some tasks on the slave node.
Is it correct when 2 threads try to execute some programs on the slave node through one channel?
I am asking that question because often the following exception happens for 2 threads simultaneous:
hudson.remoting.RequestAbortedException: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.Request.call(Request.java:174)
at hudson.remoting.Channel.call(Channel.java:665)
at hudson.FilePath.act(FilePath.java:841)
at hudson.FilePath.act(FilePath.java:825)
at ru.developonbox.hudson.plugins.PublisherManager$InnerThread$TaskThread.run(PublisherManager.java:214)
at java.lang.Thread.run(Thread.java:662)
Caused by: hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.Request.abort(Request.java:299)
at hudson.remoting.Channel.terminate(Channel.java:725)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:69)
Caused by: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2553)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1296)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at hudson.remoting.Command.readFrom(Command.java:90)
at hudson.remoting.ClassicCommandTransport.read(ClassicCommandTransport.java:59)
If "Restrict where this project can be run" field isn't set in Hudson project settings, i.e channel = Jenkins.MasterComputer.localChannel then the exception isn't thrown. Also when only 1 thread on the slave node the problem isn't reproducible.
Checked on Jenkins versions 1.491 and 1.504.