在 Windows Server 2012 上安装了 Jenkins 1.651 主服务器和从服务器。从服务器专用于运行 Selenium 测试,但大多数时候它处于离线状态:
Build step 'Execute Windows batch command' marked build as failure
ERROR: slave-tester is offline; cannot locate jdk7
和
Apr 20, 2016 2:20:05 PM INFO jenkins.slaves.DefaultJnlpSlaveReceiver handle
Disconnecting slave-tester as we are reconnected from the current peer
Apr 20, 2016 2:20:17 PM WARNING org.jenkinsci.remoting.nio.NioChannelHub run
Communication problem
java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(Unknown Source)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.read(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at org.jenkinsci.remoting.nio.FifoBuffer$Pointer.receive(FifoBuffer.java:136)
at org.jenkinsci.remoting.nio.FifoBuffer.receive(FifoBuffer.java:306)
at org.jenkinsci.remoting.nio.NioChannelHub.run(NioChannelHub.java:561)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Apr 20, 2016 2:20:17 PM WARNING jenkins.slaves.JnlpSlaveAgentProtocol$Handler$1 onClosed
NioChannelHub keys=2 gen=88003: Computer.threadPoolForRemoting [#2] for slave-tester terminated
java.io.IOException: Connection aborted: org.jenkinsci.remoting.nio.NioChannelHub$MonoNioTransport@17d0b4b[name=xxx]
at org.jenkinsci.remoting.nio.NioChannelHub$NioTransport.abort(NioChannelHub.java:208)
at org.jenkinsci.remoting.nio.NioChannelHub.run(NioChannelHub.java:628)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(Unknown Source)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.read(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at org.jenkinsci.remoting.nio.FifoBuffer$Pointer.receive(FifoBuffer.java:136)
at org.jenkinsci.remoting.nio.FifoBuffer.receive(FifoBuffer.java:306)
at org.jenkinsci.remoting.nio.NioChannelHub.run(NioChannelHub.java:561)
... 6 more
从属日志:
<===[JENKINS REMOTING CAPACITY]===>Slave.jar version: 2.53.3
Slave.jar version: 2.53.3
This is a Windows slave
This is a Windows slave
Connection terminated
Connection terminated
ERROR: Failed to install restarter
hudson.remoting.RequestAbortedException: hudson.remoting.Channel$OrderlyShutdown
at hudson.remoting.Request.abort(Request.java:297)
at hudson.remoting.Channel.terminate(Channel.java:847)
at hudson.remoting.Channel$CloseCommand.execute(Channel.java:1080)
at hudson.remoting.Channel$1.handle(Channel.java:501)
at hudson.remoting.AbstractByteArrayCommandTransport$1.handle(AbstractByteArrayCommandTransport.java:61)
at org.jenkinsci.remoting.nio.NioChannelHub$2.run(NioChannelHub.java:594)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at ......remote call to slave-tester(Native Method)
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
at hudson.remoting.Request.call(Request.java:172)
at hudson.remoting.Channel.call(Channel.java:780)
at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller.install(JnlpSlaveRestarterInstaller.java:52)
at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller.access$000(JnlpSlaveRestarterInstaller.java:33)
at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$1.call(JnlpSlaveRestarterInstaller.java:39)
at jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$1.call(JnlpSlaveRestarterInstaller.java:36)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: hudson.remoting.Channel$OrderlyShutdown
at hudson.remoting.Channel$CloseCommand.execute(Channel.java:1080)
at hudson.remoting.Channel$1.handle(Channel.java:501)
at hudson.remoting.AbstractByteArrayCommandTransport$1.handle(AbstractByteArrayCommandTransport.java:61)
at org.jenkinsci.remoting.nio.NioChannelHub$2.run(NioChannelHub.java:594)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
... 4 more
Caused by: Command close created at
at hudson.remoting.Command.<init>(Command.java:56)
at hudson.remoting.Channel$CloseCommand.<init>(Channel.java:1074)
at hudson.remoting.Channel$CloseCommand.<init>(Channel.java:1072)
at hudson.remoting.Channel.close(Channel.java:1156)
at hudson.remoting.Channel.close(Channel.java:1138)
at hudson.remoting.Channel$CloseCommand.execute(Channel.java:1079)
at hudson.remoting.Channel$1.handle(Channel.java:501)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:60)
是什么原因导致了这个问题以及如何解决它?
答案1
类似问题
- https://issues.jenkins-ci.org/browse/JENKINS-27251
- https://issues.jenkins-ci.org/browse/JENKINS-6817
- https://issues.jenkins-ci.org/browse/JENKINS-28155
- https://issues.jenkins-ci.org/browse/JENKINS-28826
- https://issues.jenkins-ci.org/browse/JENKINS-22932
- https://bugreports.qt.io/browse/QTQAINFRA-928
- https://stackoverflow.com/questions/36743908/jenkins-slave-connection-aborted
- https://mailman.owncloud.org/pipermail/jenkins/2015-July/006091.html
- https://mailman.boum.org/pipermail/tails-dev/2014-December/007732.htm
可能的解决方案
基于此来源,堆栈跟踪的一部分:
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
在办公室遇到同样的问题,将 jdk7 升级到最新的 oracle-jdk8 可以解决问题。
如果问题仍然存在:
- 请准确指出问题发生的时间,以便可以重现该问题
- 请添加导致问题的构建的 Jenkins 构建日志。也许是作业执行的某个特定任务导致了问题。
- 在构建作业时查看 Windows 任务管理器
- 请添加一次成功构建的日志和一次失败构建的日志
答案2
我删除了解决我的问题的文件 rm -rf /var/lib/jenkins/secrets/jenkins.slaves.JnlpSlaveAgentProtocol.secret
信息:错误和输出日志都将打印到 /home/ubuntu/remoting <===[JENKINS REMOTING CAPACITY]===>channel started Remoting 版本:4.13 这是一个 Unix 代理 警告:发生了非法反射访问操作 警告:jenkins.slaves.StandardOutputSwapper$ChannelSwapper 对构造函数 java.io.FileDescriptor(int) 的非法反射访问 警告:请考虑将此问题报告给 jenkins.slaves.StandardOutputSwapper$ChannelSwapper 的维护人员 警告:使用 --illegal-access=warn 启用进一步非法反射访问操作的警告 警告:所有非法访问操作将在未来的版本中被拒绝 撤离的标准输出 错误:无法加载密钥:jenkins.slaves.JnlpSlaveAgentProtocol.secret java.lang.Error:无法加载密钥:jenkins.slaves.JnlpSlaveAgentProtocol.secret