Jenkins Windows Slave离线

时间:2019-05-27 17:51:11

标签: jenkins

我在CentOS 7服务器上安装了Jenkins 2.164.3。
我有一个Java版本为1.8.0的Windows Server 2003从服务器。
我有3个linux奴隶成功工作。
从属服务器上的Windows服务已安装并正在运行。
使用以下启动方法“让jenkins作为Windows服务器将此Windows控件控制起来”来设置Windows从属服务器

此Jenkins服务器是一台新服务器,替代了旧的jenkins服务器(大约3年前从Turnkey linux上的debian wheezy)。该Windows从站用于连接到该旧服务器。要删除此从服务器上与旧服务器的连接,我执行了以下操作: 1. sc删除
2.删除文件夹c:\ jenkins
中的文件 3.重新启动服务器
4.从新的jenkins服务器启动启动的slave,它将文件复制到c:\ jenkins文件夹并安装服务。

在新的jenkins服务器上,我设置了Windows从属服务器,连接后,日志显示以下内容:

[2019-05-27 12:24:07] [windows-slaves] Connecting to 192.168.1.152
Checking if Java exists
java -version returned 1.8.0.
[2019-05-27 12:24:16] [windows-slaves] Copying jenkins-slave.xml
[2019-05-27 12:24:16] [windows-slaves] Copying slave.jar
[2019-05-27 12:24:16] [windows-slaves] Starting the service
[2019-05-27 12:24:16] [windows-slaves] Waiting for the service to become ready
ERROR: [2019-05-27 12:24:52] [windows-slaves] The service did not respond. Perhaps it failed to launch?
[2019-05-27 12:36:00] [windows-slaves] Connecting to 192.168.1.152
Checking if Java exists
java -version returned 1.8.0.
[2019-05-27 12:36:08] [windows-slaves] Copying jenkins-slave.xml
[2019-05-27 12:36:08] [windows-slaves] Copying slave.jar
[2019-05-27 12:36:08] [windows-slaves] Starting the service
ERROR: Unexpected error in launching an agent. This is probably a bug in Jenkins
org.jinterop.dcom.common.JIException: Service Already Running
    at org.jvnet.hudson.wmi.Win32Service$Implementation.start(Win32Service.java:149)
Caused: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.kohsuke.jinterop.JInteropInvocationHandler.invoke(JInteropInvocationHandler.java:140)
Caused: java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy90.start(Unknown Source)
    at hudson.os.windows.ManagedWindowsServiceLauncher.launch(ManagedWindowsServiceLauncher.java:342)
    at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:294)
    at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
    at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Windows从站是Windows Server 2003,该服务已安装并正在运行。

在日志文件C:\ Jenkins \ jenkins-slave.wrapper.log中,它具有以下内容:

2019-05-27 12:19:32,644 INFO  - Starting ServiceWrapper in the service mode
2019-05-27 12:19:32,659 INFO  - Starting javaw.exe -Xrs  -jar "C:\Jenkins\slave.jar" -tcp "C:\Jenkins\port.txt"
2019-05-27 12:19:32,675 INFO  - Extension loaded: killOnStartup
2019-05-27 12:19:32,675 DEBUG - Checking the potentially runaway process with PID=1408
2019-05-27 12:19:32,675 DEBUG - No runaway process with PID=1408. The process has been already stopped.
2019-05-27 12:19:32,675 INFO  - Starting javaw.exe -Xrs  -jar "C:\Jenkins\slave.jar" -tcp "C:\Jenkins\port.txt"
2019-05-27 12:19:32,691 INFO  - Started process 4084
2019-05-27 12:19:32,691 DEBUG - Forwarding logs of the process System.Diagnostics.Process (javaw) to winsw.SizeBasedRollingLogAppender
2019-05-27 12:19:32,691 INFO  - Recording PID of the started process:4084. PID file destination is C:\Jenkins\jenkins_agent.pid
2019-05-27 12:23:56,529 INFO  - Stopping jenkinsslave-C__Jenkins
2019-05-27 12:23:56,529 DEBUG - ProcessKill 4084
2019-05-27 12:23:56,561 INFO  - Stopping process 4084
2019-05-27 12:23:56,561 INFO  - Send SIGINT 4084
2019-05-27 12:23:56,561 WARN  - SIGINT to 4084 failed - Killing as fallback
2019-05-27 12:23:56,561 INFO  - Finished jenkinsslave-C__Jenkins
2019-05-27 12:23:56,561 DEBUG - Completed. Exit code is 0
2019-05-27 12:24:16,374 INFO  - Starting ServiceWrapper in the service mode
2019-05-27 12:24:16,390 INFO  - Starting javaw.exe -Xrs  -jar "C:\Jenkins\slave.jar" -tcp "C:\Jenkins\port.txt"
2019-05-27 12:24:16,405 INFO  - Extension loaded: killOnStartup
2019-05-27 12:24:16,405 DEBUG - Checking the potentially runaway process with PID=4084
2019-05-27 12:24:16,405 DEBUG - No runaway process with PID=4084. The process has been already stopped.
2019-05-27 12:24:16,405 INFO  - Starting javaw.exe -Xrs  -jar "C:\Jenkins\slave.jar" -tcp "C:\Jenkins\port.txt"
2019-05-27 12:24:16,421 INFO  - Started process 364
2019-05-27 12:24:16,421 DEBUG - Forwarding logs of the process System.Diagnostics.Process (javaw) to winsw.SizeBasedRollingLogAppender
2019-05-27 12:24:16,421 INFO  - Recording PID of the started process:364. PID file destination is C:\Jenkins\jenkins_agent.pid

jenkins服务器上的错误表明服务未运行。在Windows从属计算机上,服务正在运行。有什么问题,我该如何解决?

谢谢。

2 个答案:

答案 0 :(得分:1)

很老的问题,但是如果您因为收到此错误而结束这里,请找到 jenkins_agent.pid 文件并将其删除。它应该与您的 jenkins slave 文件的其余部分位于同一文件夹中。之后服务应该会再次正常启动。

答案 1 :(得分:0)

我知道这个问题很旧,您已经提出了很长的建议,但这也许会对某人有所帮助。我遇到了一个Windows从属服务器类似的问题,特别是我看到它经历了重启循环的过程,就像您以前一样:

2019-05-27 12:24:16,405 DEBUG - Checking the potentially runaway process with PID=4084
2019-05-27 12:24:16,405 DEBUG - No runaway process with PID=4084. The process has been already stopped.
2019-05-27 12:24:16,405 INFO  - Starting javaw.exe -Xrs  -jar "C:\Jenkins\slave.jar" -tcp "C:\Jenkins\port.txt"
2019-05-27 12:24:16,421 INFO  - Started process 364

为解决该问题,我检查了以下内容:

  • 查看Windows服务是否正在运行,将其循环
  • 除了检查C:\<path to jenkins>\jenkins-slave.wrapper.log之外,还请查看C:\<path to jenkins>\jenkins-slave.err.log
    • 错误日志是我发现问题的地方,我遇到了证书unable to find valid certificate的问题
  • 编辑C:\<path to jenkins>\jenkins-slave.xml文件并修复任何引起您麻烦的启动参数。确保检查Java路径和版本。
    • 在发生证书错误的情况下,我需要在参数中添加-noCertificateCheck,以便继续前进