【问题标题】:ERROR: Connection was broken: java.nio.channels.ClosedChannelException when using Jenkins in Kubernetes错误:连接断开:在 Kubernetes 中使用 Jenkins 时出现 java.nio.channels.ClosedChannelException
【发布时间】:2020-08-03 11:16:31
【问题描述】:

当我在 kubernetes v1.18 的 Jenkins 2.235.3 中构建我的项目时,它会抛出这个错误:

 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 43ae2828ca05ec071a50e42edd2a842b7ff9cc52 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 43ae2828ca05ec071a50e42edd2a842b7ff9cc52 # timeout=10
Commit message: "[feature] delete unused article"
 > git rev-list --no-walk 43ae2828ca05ec071a50e42edd2a842b7ff9cc52 # timeout=10
Unpacking https://nodejs.org/dist/v14.7.0/node-v14.7.0-linux-x64.tar.gz to /home/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS-14.7.0 on default-dvn8k
Agent went offline during the build
ERROR: Connection was broken: java.nio.channels.ClosedChannelException
    at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
    at org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
    at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:795)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Build step 'Execute NodeJS script' marked build as failure
Finished: FAILURE

我正在尝试在 Jenkins 的 pod 中使用此命令下载节点包:

wget -c https://nodejs.org/dist/v14.7.0/node-v14.7.0-linux-x64.tar.gz

它工作正常。那么我的项目有什么问题呢?如何让它发挥作用?

【问题讨论】:

    标签: kubernetes


    【解决方案1】:

    看起来您的 Jenkins 是从属设备(Kubernetes pod)在构建期间离线 (❓)。

    获取从属 pod:

    $ kubectl get pods --all-namespaces | grep slave
    

    然后查看日志:

    $ kubectl -n <namespace> logs <pod-name>
    

    描述 pod 以查看事件。

    $ kubectl -n <namespace> describe pod <pod-name>
    

    网络问题❓?Connection was broken: java.nio.channels.ClosedChannelException

    检查您的所有 pod 是否都在 CrashBackoffLoop

    $ kubectl get pods --all-namespaces | grep Crash
    

    ✌️

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-26
      • 1970-01-01
      • 2015-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多