如何解决Jenkins主节点无法重新启动的问题?

huangapple go评论85阅读模式
英文:

How to trowbleshoot an issue with Jenkins master, which cannot restart?

问题

Jenkins 在从URL重新启动后不会回来。但是当您登录到机器并查看jenkins服务时,它正在运行。这是jenkins.wrapper.log中可见的内容:

2023-05-23 08:21:04,574 调试 - 以CLI模式启动WinSW
2023-05-23 08:21:05,293 信息 - 使用id 'jenkins' 重新启动服务
2023-05-23 08:21:05,465 严重 - 未处理的异常
System.Exception: 无法调用重新启动: 193
   在 winsw.WrapperService.<Run>g__RestartSelf|33_6(<>c__DisplayClass33_0& )
   在 winsw.WrapperService.Run(String[] _args, ServiceDescriptor descriptor)
   在 winsw.WrapperService.Main(String[] args)*

只有在手动重新启动jenkins服务后,它才会恢复正常。

Jenkins用户也是我登录的Windows用户。

英文:

Jenkins doesn't come back after restart from the URL. But when you go on the machine and look at the jenkins service it is running. This is what can be seen in the jenkins.wrapper.log:

2023-05-23 08:21:04,574 DEBUG - Starting WinSW in the CLI mode
2023-05-23 08:21:05,293 INFO  - Restarting the service with id &#39;jenkins&#39;
2023-05-23 08:21:05,465 FATAL - Unhandled exception
System.Exception: Failed to invoke restart: 193
   at winsw.WrapperService.&lt;Run&gt;g__RestartSelf|33_6(&lt;&gt;c__DisplayClass33_0&amp; )
   at winsw.WrapperService.Run(String[] _args, ServiceDescriptor descriptor)
   at winsw.WrapperService.Main(String[] args)*

It comes back only after manual restart of the jenkins service.

The Jenkins user is also the Windows user with who I'm logged in.

答案1

得分: 1

您需要仔细检查 Jenkins 控制器的 XML 配置,该配置使用了 Windows Service Wrapper,如 这篇文章 中所示。

&lt;service&gt;
    &lt;id&gt;jenkins&lt;/id&gt;
    &lt;name&gt;Jenkins&lt;/name&gt;
    &lt;description&gt;此服务运行 Jenkins 自动化服务器。&lt;/description&gt;
    &lt;env name=&quot;JENKINS_HOME&quot; value=&quot;%LocalAppData%\Jenkins.jenkins&quot;/&gt;
    &lt;executable&gt;C:\Program Files\Java\jdk1.8.0_201\bin\java.exe&lt;/executable&gt;
    &lt;arguments&gt;-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle
    -jar &quot;C:\Program Files\Jenkins\jenkins.war&quot; --httpPort=8081 --webroot=&quot;%LocalAppData%\Jenkinswar&quot;&lt;/arguments&gt;
    &lt;logmode&gt;rotate&lt;/logmode&gt;

    &lt;onfailure action=&quot;restart&quot;/&gt;

    &lt;extensions&gt;
        &lt;extension enabled=&quot;true&quot; className=&quot;winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension&quot; id=&quot;killOnStartup&quot;&gt;
        &lt;pidfile&gt;%LocalAppData%\Jenkinsjenkins.pid&lt;/pidfile&gt;
        &lt;stopTimeout&gt;10000&lt;/stopTimeout&gt;
        &lt;stopParentFirst&gt;false&lt;/stopParentFirst&gt;
        &lt;/extension&gt;
    &lt;/extensions&gt;
&lt;/service&gt;

2020 年指出的

理论上,Jenkins 可以在支持 Java 8 或 Java 11 的任何地方运行,但实际上存在一些限制。

Jenkins 核心和一些插件包含本机代码,因此它们依赖于操作系统和平台。我们使用 Java Native Access 和 Java Native Runtime 库,这些库为低级操作提供广泛的平台支持,但某些通用库不涵盖的特定平台情况。

在 Windows 平台的情况下,我们使用 Windows Service Wrapper (WinSW) 和 Windows Process Management Library (WinP)。这些库依赖于特定的 Windows API 版本,以及在 Windows 服务的情况下,依赖于 .NET Framework。

因此,请仔细检查它们的版本(至少要使用 WinSW 2.9.0)。

您还可以访问 WinSW gitter 渠道 寻求帮助。

英文:

You would need to double check your XML configuration of the Jenkins controller Windows Service Wrapper, as illustrated in this article

&lt;service&gt;
    &lt;id&gt;jenkins&lt;/id&gt;
    &lt;name&gt;Jenkins&lt;/name&gt;
    &lt;description&gt;This service runs Jenkins automation server.&lt;/description&gt;
    &lt;env name=&quot;JENKINS_HOME&quot; value=&quot;%LocalAppData%\Jenkins.jenkins&quot;/&gt;
    &lt;executable&gt;C:\Program Files\Java\jdk1.8.0_201\bin\java.exe&lt;/executable&gt;
    &lt;arguments&gt;-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle
    -jar &quot;C:\Program Files\Jenkins\jenkins.war&quot; --httpPort=8081 --webroot=&quot;%LocalAppData%\Jenkinswar&quot;&lt;/arguments&gt;
    &lt;logmode&gt;rotate&lt;/logmode&gt;

    &lt;onfailure action=&quot;restart&quot;/&gt;

    &lt;extensions&gt;
        &lt;extension enabled=&quot;true&quot; className=&quot;winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension&quot; id=&quot;killOnStartup&quot;&gt;
        &lt;pidfile&gt;%LocalAppData%\Jenkinsjenkins.pid&lt;/pidfile&gt;
        &lt;stopTimeout&gt;10000&lt;/stopTimeout&gt;
        &lt;stopParentFirst&gt;false&lt;/stopParentFirst&gt;
        &lt;/extension&gt;
    &lt;/extensions&gt;
&lt;/service&gt;

As noted in 2020

> In theory, Jenkins can run everywhere where you can run Java 8 or Java 11, but, in practice, there are some limitations.
>
> The Jenkins core and some plugins contain native code, and hence they rely on operating systems and platforms. We use Java Native Access and Java Native Runtime libraries which provide wide platform support for low-level operations, but there are platform-specific cases not covered by such generic libraries.
>
> In the case of Windows platforms we use Windows Service Wrapper (WinSW) and Windows Process Management Library (WinP). These libraries depend on particular Windows API versions and, in the case of Windows services, on .NET Framework.

So double-check their version. (2.9.0 at least for WinSW).

The WinSW gitter channel can also help.

huangapple
  • 本文由 发表于 2023年5月29日 16:48:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76355880.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定