windows - 无效 ID : Process leaked file descriptors. Jenkins

标签 windows git github jenkins jenkins-plugins

我已经设置了一个 Jenkins CI 解决方案(在 Windows 上),其中包含 3 个并行作业(使用 Multijob 插件),这些作业将 git 存储库(使用 Git 插件) check out 到各自的工作区中。 95% 的情况下,作业运行完美,但有时我会在一个或多个作业中收到以下错误消息:

Building on master in workspace C:\Program Files (x86)\Jenkins\jobs\PatchsetCPPCheck\workspace
Checkout:workspace / C:\Program Files (x86)\Jenkins\jobs\PatchsetCPPCheck\workspace - 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您将找到三个带有详细示例的解决方法来解决此问题,

  1. 'at' command可用于在后台启动进程。
  2. 使用包装器脚本并通过它启动您的程序。
  3. 对于 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 脚本)将在后台运行以确保当守护进程存在时,它会关闭所有文件描述符。

关于windows - 无效 ID : Process leaked file descriptors. Jenkins ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22660446/

相关文章:

javascript - IE8 将缓存中的动态 iframe 内容重新加载到错误的 iframe 中

windows - Azure 创建虚拟机 REST API 上出现 "An administrator password must be specified"错误

github - 从 Azure Pipeline 创建 GitHub PR 评论

git - 在 Branch master git status 上没有显示要提交的内容(创建/复制文件并使用 "git add"进行跟踪)

windows - 用于在 Windows 上运行的 NoSql DB 的 Erlang API

windows - 加入 AD Azure 域中的现有 Windows 服务器

git - 如何通过 git-config 配置统一差异上下文?

git - 管道和瓷器命令是什么?

git - 如何在特定文件中应用补丁 - git

git - 如何从 git 中删除 'XXX$1.class'?