Jenkins Windows 从机离线

use*_*435 4 jenkins

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

这个 Jenkins 服务器是一个新服务器,它取代了旧的 jenkins 服务器(大约 3 年前来自 Turnkey linux 的 debian wheezy)。该 Windows 从属服务器用于连接到该旧服务器。要删除此从站到旧服务器的连接,我执行了以下操作: 1. sc 删除
2. 删除文件夹 c:\jenkins 中的文件
3. 重新启动服务器
4. 从新的 jenkins 服务器启动从站,将文件复制到 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)
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

jenkins服务器上的错误表明该服务没有运行。在windows从机上,该服务正在运行。有什么问题以及如何解决?

谢谢。

小智 9

非常老的问题,但是如果您因为收到此错误而最终来到这里,请找到该jenkins_agent.pid文件并将其删除。它应该与其余的詹金斯从属文件位于同一文件夹中。此后服务应该会再次正常启动。