java.io.IOException:无法运行程序“ git”:error = 11,资源暂时不可用

问题描述

使用GOCD管道。我们有两个节点,其中一个克隆代码很好,而这个较旧的节点则不行。我们看到无法运行程序“ git”:error = 11,日志中的资源暂时不可用。我可以检查某些配置吗?

日志:

020-08-25 17:39:18,629 [loopThread] ERROR thoughtworks.go.work.DefaultGoPublisher:135 - Error while executing [git clone --branch=20.08_OMS_15.09_Endpoint git@github.comcast.com:TPP-Provisioning/PortOutGui.git /app/go-agent1/pipelines/PATGUI-build] 
 Make sure this command can execute manually.
java.lang.RuntimeException: Error while executing [git clone --branch=20.08_OMS_15.09_Endpoint git@example.com:TPP-Provisioning/PortOutGui.git /app/go-agent1/pipelines/PATGUI-build] 
 Make sure this command can execute manually.
    at com.thoughtworks.go.util.ExceptionUtils.bomb(ExceptionUtils.java:36)
    at com.thoughtworks.go.config.materials.git.GitMaterial.updateto(GitMaterial.java:159)
    at com.thoughtworks.go.domain.MaterialRevision.updateto(MaterialRevision.java:151)
    at com.thoughtworks.go.domain.materials.AbstractMaterialAgent.prepare(AbstractMaterialAgent.java:41)
    at com.thoughtworks.go.remote.work.BuildWork.prepareJob(BuildWork.java:193)
    at com.thoughtworks.go.remote.work.BuildWork.build(BuildWork.java:141)
    at com.thoughtworks.go.remote.work.BuildWork.doWork(BuildWork.java:96)
    at com.thoughtworks.go.agent.JobRunner.run(JobRunner.java:60)
    at com.thoughtworks.go.agent.AgentHTTPClientController.retrieveWork(AgentHTTPClientController.java:123)
    at com.thoughtworks.go.agent.AgentHTTPClientController.work(AgentHTTPClientController.java:99)
    at com.thoughtworks.go.agent.AgentController.loop(AgentController.java:78)
    at sun.reflect.GeneratedMethodAccessor12.invoke(UnkNown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
    at org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:65)
    at org.springframework.scheduling.timer.DelegatingTimerTask.run(DelegatingTimerTask.java:70)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: com.thoughtworks.go.util.command.CommandLineException: Error while executing [git clone --branch=20.08_OMS_15.09_Endpoint git@example.com:TPP-Provisioning/PortOutGui.git /app/go-agent1/pipelines/PATGUI-build] 
 Make sure this command can execute manually.
    at com.thoughtworks.go.util.ProcessManager.startProcess(ProcessManager.java:112)
    at com.thoughtworks.go.util.ProcessManager.createProcess(ProcessManager.java:64)
    at com.thoughtworks.go.util.command.CommandLine.createProcess(CommandLine.java:361)
    at com.thoughtworks.go.util.command.CommandLine.execute(CommandLine.java:354)
    at com.thoughtworks.go.util.command.CommandLine.run(CommandLine.java:513)
    at com.thoughtworks.go.domain.materials.SCMCommand.run(SCMCommand.java:34)
    at com.thoughtworks.go.domain.materials.git.GitCommand.clone(GitCommand.java:82)
    at com.thoughtworks.go.config.materials.git.GitMaterial.git(GitMaterial.java:247)
    at com.thoughtworks.go.config.materials.git.GitMaterial.updateto(GitMaterial.java:153)
    ... 17 more
Caused by: java.io.IOException: Cannot run program "git": error=11,Resource temporarily unavailable
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at com.thoughtworks.go.util.ProcessManager.startProcess(ProcessManager.java:105)
    ... 25 more
Caused by: java.io.IOException: error=11,Resource temporarily unavailable
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

GO CD构建:

20:21:26.207 [go] Job Started: 2020-08-25 20:21:26 UTC

20:21:26.207 [go] Start to prepare PATGUI-build/131/Execute_Script/1/build_job on exmaple-po-b4p.sys.comcast.net [/app/go-agent3]
20:21:26.212 [go] Start to update materials.

20:21:26.212 [go] Start updating files at revision 1c9e6a31946f62af1285305f338178d2a8fd13f2 from git@github.comcast.com:TPP-Provisioning/PortOutGui.git
20:21:26.214 Error while executing [git clone --branch=20.08_OMS_15.09_Endpoint git@example.com:TPP-Provisioning/PortOutGui.git /app/go-agent3/pipelines/PATGUI-build] 
 Make sure this command can execute manually.
20:21:26.231 [go] Job completed PATGUI-build/131/Execute_Script/1/build_job on exmaple-po-b4p.sys.comcast.net [/app/go-agent3]

解决方法

通过重新启动Go Agent解决了此问题。引起了一个新问题,但以下问题已解决。

  1. 登录GoCD UI。
  2. 点击“代理商”
  3. 选择需要重新启动的代理
  4. 单击“禁用”按钮
  5. 刷新页面。
  6. 您将看到该代理已禁用,并且在列表的最后一个
  7. 复制“代理商名称”。这是代理的主机。使用Cada凭据登录到此主机。
  8. 运行命令:sudo su-
  9. 现在执行:sudo /etc/init.d/go-agent1重新启动(注意:代理之后的最后一位将根据GoCD UI中的代理/“沙盒”值进行更改) 上面的命令将重新启动代理
  10. 现在返回GoCD UI,选择禁用的代理,然后单击“启用”。
  11. 刷新页面,代理应回到空闲状态。重新启动GoCD代理: