首页 > 解决方案 > Windows 从站处于挂起状态 - 使用 Azure VM 代理插件

问题描述

在我重新启动从属 Azure VM(维护)后,我的 Windows 从属被挂起,当从属重新启动并运行并成功连接到 Jenkins 时,挂起状态没有被删除,我遇到了一些奇怪的行为。

我已经复制了 3 次 - 每个虚拟机我一直在手动安装额外的软件,这需要重新启动,但在重新启动后,我安排的任何构建作业都会挂起消息“等待 windows 上的下一个可用执行程序”,奴隶节点在 Jenkins 中显示为在线,但旁边有“(暂停)”,然后最终 Azure VM 代理插件只是创建一个新 VM 并在其上运行构建。

从日志中提取:

2018 年 5 月 25 日下午 3:47:29 hudson.remoting.SynchronousCommandTransport$ReaderThread 运行严重:通道 slavew823810 java.io.IOException 中的 I/O 错误:在 hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport .java:77) 原因:java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3154) 处 java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2679) 处的 java.io.EOFException。 io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:862) at java.io.ObjectInputStream.(ObjectInputStream.java:358) at hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:48) at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport .java:35) 在哈德逊。远程处理.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:63)

<-- HTTP 失败:java.net.SocketException:连接重置 2018 年 5 月 25 日下午 3:47:34 okhttp3.internal.platform.Platform 日志信息:ALPN 回调已删除:SPDY 和 HTTP/2 已禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 3:47:35 com.microsoft.azure.vmagent.AzureVMManagementServiceDelegate virtualMachineExists 信息:AzureVMManagementServiceDelegate:virtualMachineExists:slavew823810 存在 2018 年 5 月 25 日下午 3:47:35 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask cleanDeployments 信息: AzureVMAgentCleanUpTask:cleanDeployments:清理部署 2018 年 5 月 25 日下午 3:47:35 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask cleanDeployments 信息:AzureVMAgentCleanUpTask:cleanDeployments:完成清理部署 2018 年 5 月 25 日下午 3:47:35 com.microsoft.azure .vmagent.AzureVMAgentCleanUpTask$2 调用信息:AzureVMAgentCleanUpTask:cleanVMs:关闭 slavew823810 2018 年 5 月 25 日下午 3:47:35 com.microsoft.azure.vmagent.AzureVMAgent 关闭信息:AzureVMAgent:关闭:为节点 slavew823810 添加挂起状态 2018 年 5 月 25 日下午 3:47:35 com .microsoft.azure.vmagent.AzureVMAgent 关闭信息:AzureVMAgent:关闭:关闭代理 slavew823810 2018 年 5 月 25 日下午 3:47:35 com.microsoft.azure.vmagent.AzureVMManagementServiceDelegate shutdownVirtualMachine 信息:AzureVMManagementServiceDelegate:shutdownVirtualMachine:调用 slavew823810 May 25 , 2018 下午 3:47:35 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask 执行信息:AzureVMAgentCleanUpTask:执行:结束 2018 年 5 月 25 日下午 3:47:35 hudson.model.AsyncPeriodicWork$1 运行信息:完成 Azure VM 代理清理任务. 389 毫秒 2018 年 5 月 25 日下午 3:47:35 okhttp3.internal.platform。平台日志信息:ALPN 回调已删除:SPDY 和 HTTP/2 已禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 3:49:09 hudson.model.AsyncPeriodicWork$1 运行信息:已启动 Azure VM 维护者池大小 2018 年 5 月 25 日下午 3:49:09 hudson.model.AsyncPeriodicWork$1 运行信息:已完成 Azure VM 维护者池大小. 1 毫秒 2018 年 5 月 25 日下午 3:51:04 hudson.model.AsyncPeriodicWork$1 运行信息:已启动 Azure VM 验证任务 2018 年 5 月 25 日下午 3:51:04 com.microsoft.azure.vmagent.AzureVMCloudVerificationTask getVirtualMachineCount 信息:AzureVMCloudVerificationTask: getVirtualMachineCount:从 2018 年 5 月 25 日下午 3:51:04 开始 com.microsoft.azure.vmagent.AzureVMCloudVerificationTask getVirtualMachineCount INFO:AzureVMCloudVerificationTask:getVirtualMachineCount:结束,云 Jenkins Azure Cloud 目前有 2 个虚拟机 2018 年 5 月 25 日 3:51:04 PM hudson.model.AsyncPeriodicWork$1 运行信息:完成 Azure VM 验证任务。39 毫秒 2018 年 5 月 25 日下午 3:52:34 hudson.model.AsyncPeriodicWork$1 运行信息:已启动 Azure VM 代理清理任务 2018 年 5 月 25 日下午 3:52:34 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask 执行信息:AzureVMAgentCleanUpTask :执行:开始 2018 年 5 月 25 日下午 3:52:34 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask 执行信息:AzureVMAgentCleanUpTask:执行:以 5 分钟超时运行 clean 2018 年 5 月 25 日下午 3:52:34 com.microsoft。 azure.vmagent.AzureVMAgentCleanUpTask cleanVMs 信息:AzureVMAgentCleanUpTask:cleanVMs:节点 slavew56f680 被阻止清理 2018 年 5 月 25 日下午 3:52:34 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask cleanVMs 信息:AzureVMAgentCleanUpTask:cleanVMs:节点 slavew823810 被阻止清理 5 月 25 日,2018 年 3 点 52 分:下午 34 点 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask cleanDeployments 信息:AzureVMAgentCleanUpTask:cleanDeployments:清理部署 2018 年 5 月 25 日下午 3:52:34 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask cleanDeployments 信息:AzureVMAgentCleanUpTask:cleanDeployments:完成清理部署 5 月2018 年 2 月 25 日下午 3:52:34 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask 执行信息:AzureVMAgentCleanUpTask:执行:结束 2018 年 5 月 25 日下午 3:52:34 hudson.model.AsyncPeriodicWork$1 运行信息:完成 Azure VM 代理清理任务。21 毫秒 2018 年 5 月 25 日下午 3:53:00 hudson.node_monitors.ResponseTimeMonitor$1 监视器警告:使 slavew56f680 脱机,因为它没有响应 2018 年 5 月 25 日下午 3:53:09 hudson.node_monitors.ResponseTimeMonitor$1 监视器警告:使 slavew56f680 脱机,因为它没有响应 2018 年 5 月 25 日下午 3:54:09 hudson.model.AsyncPeriodicWork$1 运行信息:已启动 Azure VM 维护者池大小 2018 年 5 月 25 日下午 3:54:09 hudson.model.AsyncPeriodicWork$1 运行信息:完成 Azure VM 维护者池大小。1 毫秒 2018 年 5 月 25 日下午 3:54:56 com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher 启动信息:AzureVMAgentSSHLauncher:启动:为代理 slavew56f680 调用的启动方法 2018 年 5 月 25 日下午 3:54:56 com.microsoft。 rest.interceptors.LoggingInterceptor 日志信息:<-- HTTP FAILED:java.net.SocketException:连接重置 2018 年 5 月 25 日下午 3:54:56 okhttp3.internal.platform.Platform 日志信息:ALPN 回调丢弃:SPDY 和 HTTP/ 2个被禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 3:54:56 com.microsoft.azure.vmagent。AzureVMAgentSSHLauncher:启动:启动代理:java -jar slave.jar 2018 年 5 月 25 日下午 3:55:07 com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher 启动信息:AzureVMAgentSSHLauncher:启动:连接成功 2018 年 5 月 25 日 3:55 :13 PM com.microsoft.azure.vmagent.remote.AzureVMAgentSSHLauncher 启动信息:AzureVMAgentSSHLauncher:启动:成功启动代理 2018 年 5 月 25 日下午 3:57:13 com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol 信息:ALPN 回调丢弃:SPDY 和 HTTP/2 被禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 3:57:18 com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol 信息:ALPN 回调已删除:SPDY 和 HTTP/2 已禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 3:57:34 完成清理部署 2018 年 5 月 25 日下午 3:57:34 com.microsoft.rest.interceptors.LoggingInterceptor 日志信息:<-- HTTP 失败:java.net.SocketException:连接重置 2018 年 5 月 25 日下午 3:57:34 okhttp3 .internal.platform.Platform 日志信息:ALPN 回调已删除:SPDY 和 HTTP/2 已禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 3:57:35 com.microsoft.azure.vmagent.AzureVMAgentCleanUpTask 执行信息:AzureVMAgentCleanUpTask:执行:结束 2018 年 5 月 25 日下午 3:57:35 hudson.model.AsyncPeriodicWork$1 运行信息:完成 Azure VM 代理清洁任务。240 毫秒 2018 年 5 月 25 日下午 3:59:09 hudson.model.AsyncPeriodicWork$1 运行信息:已启动 Azure VM 维护者池大小 2018 年 5 月 25 日下午 3:59:09 hudson.model.AsyncPeriodicWork$1 运行信息:已完成 Azure VM 维护者池大小。0 毫秒 2018 年 5 月 25 日下午 3:59:15 com.microsoft。AzureVMCloud 配置信息:AzureVMCloud:配置:异步配置完成,返回 1 个计划节点 2018 年 5 月 25 日下午 3:59:15 com.microsoft.azure.vmagent.AzureVMCloud$2 调用信息:找到现有节点,启动 VM slavew823810 May 2018 年 5 月 25 日下午 3:59:15 com.microsoft.azure.vmagent.AzureVMManagementServiceDelegate startVirtualMachine 信息:AzureVMManagementServiceDelegate:startVirtualMachine:slavew823810 2018 年 5 月 25 日下午 3:59:15 org.jenkinsci.plugins.cloudstats.CloudStatistics logTypeNotSupported 信息:不支持hudson.slaves.NodeProvisioner$PlannedNode 类的 cloud-stats 插件 2018 年 5 月 25 日下午 3:59:15 hudson.slaves.NodeProvisioner$StandardStrategyImpl 应用信息:开始从 Jenkins Azure Cloud 配置 slavew823810 和 1 个执行程序。剩余的超额工作量:-0.282 2018 年 5 月 25 日下午 3:59:24 com。成功启动代理 2018 年 5 月 25 日下午 4:00:13 com.microsoft.azure.vmagent.AzureVMCloud$2 调用信息:删除节点的挂起状态:slavew823810 2018 年 5 月 25 日下午 4:00:15 hudson.slaves.NodeProvisioner$2 运行信息:slavew823810 配置成功完成。我们现在有 3 台计算机 2018 年 5 月 25 日下午 4:00:31 com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol 信息:ALPN 回调已删除:SPDY 和 HTTP/2 已禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 4:00:44 org.jenkinsci.plugins.workflow.job.WorkflowRun 完成信息:tokio-utp/master #29 完成:失败 slavew823810 配置成功完成。我们现在有 3 台计算机 2018 年 5 月 25 日下午 4:00:31 com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol 信息:ALPN 回调已删除:SPDY 和 HTTP/2 已禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 4:00:44 org.jenkinsci.plugins.workflow.job.WorkflowRun 完成信息:tokio-utp/master #29 完成:失败 slavew823810 配置成功完成。我们现在有 3 台计算机 2018 年 5 月 25 日下午 4:00:31 com.squareup.okhttp.internal.Platform$JdkWithJettyBootPlatform getSelectedProtocol 信息:ALPN 回调已删除:SPDY 和 HTTP/2 已禁用。alpn-boot 在引导类路径上吗?2018 年 5 月 25 日下午 4:00:44 org.jenkinsci.plugins.workflow.job.WorkflowRun 完成信息:tokio-utp/master #29 完成:失败

从日志中可以看出,在 3:47,我手动重新启动了从节点“slavew56f680”。

到 3 点 54 分,从节点重新启动并运行,所以我点击启动代理,它连接成功(但在 UI 中它仍然显示已暂停)。

3 点 57 分,我点击构建一个作业,期待暂停状态被移除,作业在这个从属服务器上运行。

在 3:59,它移动到另一个从属设备(“slavew823810”)上,将其上线并在其上运行作业。

在这个特定的示例中,slavew823810 是之前发生过这种情况的 Windows 从站,我只是从未删除过它,而是将其重新启动。如果我删除了它,那么它将创建一个新的 Windows 从属 VM。

有人见过这个吗?知道如何阻止这种情况发生或删除暂停状态吗?

Jenkins 版本是 2.107.3 我的 master (Linux) 和 slave (Windows) 都在 Azure 上。

在此先感谢斯蒂芬。

更新

在周末让我的奴隶断电后,我在 Azure 中启动它们,然后在 Jenkins 中连接(但说已暂停)我开始构建作业 - 结果是,经过长时间的延迟,它创建了另一台 Windows 从属机器来运行该作业。我现在有 3 个 Windows 从站。我希望它会使用前两台机器中的一台,这样我就不会被阻止,因为它们已经更新了我需要的额外软件和补丁。

标签: azurejenkinsjenkins-pluginsjenkins-pipeline

解决方案


尝试系统 groovy 命令(或类似 Azure VM 的命令):

Jenkins.instance.getNode('Node-Name').getComputer().setAcceptingTasks(true)

似乎没有其他方便的方法可以解除挂起。

将节点设置为:

可用性:“根据计划让该代理上线

然后在它们仍处于停机时间窗口时将它们翻转回“尽可能保持此从属联机”。节点在线但已挂起。

找不到有关此的任何文档或为什么没有 GUI 切换选项,例如脱机或断开连接/启动。


推荐阅读