加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – 无效的id:处理泄露的文件描述符.jenkins

发布时间:2020-12-14 05:42:54 所属栏目:Windows 来源:网络整理
导读:我已经设置了一个Jenkins CI解决方案(在 Windows上),该解决方案包含3个并行作业(使用Multijob插件),可以将git存储库(使用 Git-plugin)签出到各自的工作区中. 95%的时间,作业运行良好但有时我在一个或多个作业中收到以下错误消息: Building on master in wo
我已经设置了一个Jenkins CI解决方案(在 Windows上),该解决方案包含3个并行作业(使用Multijob插件),可以将git存储库(使用 Git-plugin)签出到各自的工作区中.
95%的时间,作业运行良好但有时我在一个或多个作业中收到以下错误消息:

Building on master in workspace C:Program Files (x86)JenkinsjobsPatchsetCPPCheckworkspace
Checkout:workspace / C:Program Files (x86)JenkinsjobsPatchsetCPPCheckworkspace - hudson.remoting.LocalChannel@1a046fe
Using strategy: Gerrit Trigger
Last Built Revision: Revision 2ff5e3449041916e21fe7a4833a2babcfef45225 (master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
Commencing build of Revision 1eec024d8a125a42b563011468bb19a87e1da2ea (master)
Checking out Revision 1eec024d8a125a42b563011468bb19a87e1da2ea (master)
Cleaning workspace
Resetting working tree
FATAL: Invalid id: Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
java.lang.IllegalArgumentException: Invalid id: Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
    at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:232)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.doRevList(CliGitAPIImpl.java:1278)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revList(CliGitAPIImpl.java:1264)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.isCommitInRepo(CliGitAPIImpl.java:1289)
    at hudson.plugins.git.GitAPI.isCommitInRepo(GitAPI.java:189)
    at hudson.plugins.git.GitSCM.computeChangeLog(GitSCM.java:1286)
    at hudson.plugins.git.GitSCM.access$1300(GitSCM.java:57)
    at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1251)
    at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1205)
    at hudson.FilePath.act(FilePath.java:905)
    at hudson.FilePath.act(FilePath.java:878)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1205)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1369)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:676)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:581)
    at hudson.model.Run.execute(Run.java:1593)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:242)

谁可以帮我这个事?

解决方法

如果您将检查 link given in your error message,您将找到三个解决此问题的详细示例的解决方法,

> ‘at’ command可用于在后台启动进程.
>使用包装器脚本并通过它启动程序.
>对于Windows XP及更高版本,将安排永久任务和强制
从ant脚本运行它.

编辑:

描述了这个问题的原因,

Jenkins and the child process are connected by three pipes
(stdin/stdout/stderr.) This allows Jenkins to capture the output from
the child process. Since the child process may write a lot of data to
the pipe and quit immediately after that,Jenkins needs to make sure
that it drained the pipes before it considers the build to be over.
Jenkins does this by waiting for EOF.

The complication happens when those file descriptors are inherited to
other processes. Let’s say the child process forks another process to
the background. The background process (AKA daemon) inherits all the
file descriptors of the parent,including the writing side of the
stdout/stderr pipes that connect the child process and Jenkins. If the
daemon forgets to close them,Jenkins won’t get EOF for pipes even
when the child process exits,because daemon still have those
descriptors open.
That’s how this problem happens.

A good daemon program closes all file descriptors to avoid problems like this (So that jenkins can read EOF)

为了防止守护程序具有打开的文件描述符,一个进程(这是您的解决方法,可以是在后台运行的shell / windows脚本)将在后台运行以确保守护进程存在时,它会关闭所有文件描述符.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读