【问题标题】:Jenkins slave cannot connect with master: Incorrect acknowledgement sequenceJenkins slave 无法与 master 连接:不正确的确认顺序
【发布时间】:2017-06-22 11:57:05
【问题描述】:

将我们的 Jenkins 主安装更新到其最新的 LTS 版本 2.46.3 后,其中一个从属设备(Windows 7 机器,32 位)无法与主设备连接。

我们得到的错误是:

java -jar slave.jar -jnlpUrl https://<jenkins-name>/computer/<node-name>/slave-agent.jnlp -secret <secret-value>
Jun 22, 2017 1:19:05 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up slave: node-name
Jun 22, 2017 1:19:05 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Jun 22, 2017 1:19:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [https://<jenkins-name>/]
Jun 22, 2017 1:19:05 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP3-connect, JNLP-connect, CLI2-connect, Ping, CLI-connect, JNLP4-connect, JNLP2-c
onnect]
Jun 22, 2017 1:19:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
  Agent address: <jenkins-name>
  Agent port:    <jenkins-port>
  Identity:      <id:en:ti:ty>
Jun 22, 2017 1:19:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Jun 22, 2017 1:19:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to <jenkins-name>:9150
Jun 22, 2017 1:19:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
Jun 22, 2017 1:19:05 PM org.jenkinsci.remoting.protocol.impl.AckFilterLayer abort
WARNING: [JNLP4-connect connection to <our-proxy>/10.253.0.11:81] Incorrect acknowledgement sequence, expected 0x0003414333 got 0x4854545044
Jun 22, 2017 1:19:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Protocol JNLP4-connect encountered an unexpected exception
java.util.concurrent.ExecutionException: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowled
gement sent
        at org.jenkinsci.remoting.util.SettableFuture.get(SettableFuture.java:223)
        at hudson.remoting.Engine.innerRun(Engine.java:385)
        at hudson.remoting.Engine.run(Engine.java:287)
Caused by: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent
        at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.onRecvClosed(AckFilterLayer.java:280)
        at org.jenkinsci.remoting.protocol.FilterLayer.abort(FilterLayer.java:164)
        at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.abort(AckFilterLayer.java:130)
        at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.onRecv(AckFilterLayer.java:258)
        at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecv(ProtocolStack.java:669)
        at org.jenkinsci.remoting.protocol.NetworkLayer.onRead(NetworkLayer.java:136)
        at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer.access$2200(BIONetworkLayer.java:48)

我们花了很多时间试图解决这个问题。可惜没有成功。

您知道问题的原因以及解决方法吗?

【问题讨论】:

  • Jenkins 以前的版本是什么?您使用的身份验证机制是什么? LDAP ,内部数据库或其他什么?
  • 嘿@andreasgk,你解决这个问题了吗?我们遇到了完全相同的错误。

标签: jenkins jenkins-slave


【解决方案1】:

我们最近使用基于 AWS 的 Jenkins 使用 JNLP 进行远程集成测试解决了这个问题。远程从站将回调到 Jenkins 主站,后者因类似错误而失败。问题最终是针对 Jenkins Master 动态生成的 HTTP 类型的 AWS ELB(因为 Kubernetes ELB 配置程序目前不支持多协议 ELB)。我们必须手动将 ELB 的 JNLP 入口端口类型更改为 TCP,而 Web 界面入口“实例端口”是协议 HTTP,而“负载均衡器”是协议 HTTPS

【讨论】:

  • JNLP 协议是二进制的,不是 HTTP;这并不明显,因为如果您向侦听器发送 GET 请求,则侦听器具有发送虚拟 HTTP 响应的特殊情况。您不能在 JNLP 侦听器前面放置 HTTP 代理。如果你这样做了,“Incorrect acknowledgement sequence”就是你碰巧得到的错误信息。
  • 嘿@mars64,你能给我一些帮助吗?我也有同样的情况。我正在尝试从我的入口控制器公开 JNLP
  • 供以后参考。经典负载均衡器无法使用代理协议。我在入口控制器中禁用了代理,现在一切正常
  • @jim-minter 你是对的!我提到这一点是因为我们在 AWS 上使用 Kubernetes 中的云提供商注释来配置 ELB,默认为 HTTP -- 每次重新配置服务时。 @BernardoVale - 很抱歉错过您的信息。听起来你已经解决了。祝你好运!
  • 在 elb 经典服务中遇到了这个确切的问题,并且 TCP 手动更改对我有用(谢谢)。我正在考虑将其切换到 ALB(入口)或 NLB 平衡器以使用新的注释和控制器,而不是现在的“旧版”ELB 版本。如果有人在我搞砸之前取得了成功,看到这个让我知道你是怎么做到的:D
【解决方案2】:

Jenkins 主实例是否在负载均衡器后面运行?当我的实例在 AWS 中的 Application Load Balancer 后面运行时,我遇到了同样的问题。

如果是这样,那么确认序列可能会因为负载均衡器中的不同协议而被修改。默认情况下,JNLP 需要在端口 50000 上建立 TCP 连接。

如果您的设置是在 AWS 上,您可以尝试在 Route53 中创建一个私有托管区域,并为您的 Jenkins 实例的私有 IP 地址创建一个别名记录。

例如:jenkins.example.com -> 你的 Jenkins 实例的私有 IP

然后,在 Jenkins UI -> 管理 Jenkins -> 配置系统 -> 管理节点和云 -> 配置云 ->(在高级设置下)

隧道连接通过:jenkins.example.com:50000

这避免了您的从代理必须通过负载均衡器才能连接到 Jenkins Master。

【讨论】:

  • 好主意,这给了我解决问题的提示。略有不同
【解决方案3】:

您需要检查节点的密钥是否完好。如果不正确,您必须下载 slave.jar 并使用新的 jar 文件从命令行运行代理。

java -jar slave.jar -jnlpUrl http://<ipaddress>:8080/computer/<computername>/slave-agent.jnlp -secret 340d54sdrgtjj334kelkahsdjkf83f1c5120dc2fb74939fcdb7f05e1926049f8d7991

还要检查安装的java版本是> 7

【讨论】:

    【解决方案4】:

    当 Windows 更新或其他静默后台更新与从属设备的环境变量混淆时,我们就会遇到这种情况。 HTTPS_PROXYHTTP_PROXY 必须重新添加,一旦完成,我们就恢复了业务。

    【讨论】:

      【解决方案5】:

      消息:

      Incorrect acknowledgement sequence ...
      

      当我错误地将 Java 属性 hudson.TcpSlaveAgentListener.port 的值配置为与 Jenkins 使用的 HTTP 端口相同的端口号时,发生了这种情况。 TcpSlaveAgentListener javadoc 表示配置错误:

      除了 HTTP 端点,Jenkins 还运行 TcpSlaveAgentListener 来侦听 TCP 套接字。从历史上看,这用于来自代理的入站连接(因此得名),但随着时间的推移,它被扩展并变得通用,因此不同目的的多个协议可以在同一个套接字上共存。 (强调)

      如果 HTTP 端口是 8080,hudson.TcpSlaveAgentListener.port 也是 8080,那么我的 JNLP 代理无法连接。一旦我为 hudson.TcpSlaveAgentListener.port 分配了另一个值(如 50000)并重新启动 Jenkins,我的 JNLP 代理就能够连接。

      失败的 JNLP 代理上的堆栈跟踪是:

      INFO: Trying protocol: JNLP4-connect
      Mar 02, 2019 3:49:29 PM org.jenkinsci.remoting.protocol.impl.AckFilterLayer abort
      WARNING: [JNLP4-connect connection to agent.example.com/172.16.16.113:8080] Incorrect acknowledgement sequence, expected 0x000341434b got 0x485454502f
      Mar 02, 2019 3:49:29 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Protocol JNLP4-connect encountered an unexpected exception
      java.util.concurrent.ExecutionException: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent
              at org.jenkinsci.remoting.util.SettableFuture.get(SettableFuture.java:223)
              at hudson.remoting.Engine.innerRun(Engine.java:614)
              at hudson.remoting.Engine.run(Engine.java:474)
      Caused by: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent
              at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.onRecvClosed(AckFilterLayer.java:280)
              at org.jenkinsci.remoting.protocol.FilterLayer.abort(FilterLayer.java:164)
              at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.abort(AckFilterLayer.java:130)
              at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.onRecv(AckFilterLayer.java:258)
              at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecv(ProtocolStack.java:668)
              at org.jenkinsci.remoting.protocol.NetworkLayer.onRead(NetworkLayer.java:136)
              at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer.access$2200(BIONetworkLayer.java:48)
              at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader.run(BIONetworkLayer.java:283)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
              at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
              at java.lang.Thread.run(Unknown Source)
      
      Mar 02, 2019 3:49:29 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Connecting to testing-a.markwaite.net:8080
      Mar 02, 2019 3:49:29 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Server reports protocol JNLP4-plaintext not supported, skipping
      Mar 02, 2019 3:49:29 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Server reports protocol JNLP3-connect not supported, skipping
      Mar 02, 2019 3:49:29 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Server reports protocol JNLP2-connect not supported, skipping
      Mar 02, 2019 3:49:29 PM hudson.remoting.jnlp.Main$CuiListener status
      INFO: Server reports protocol JNLP-connect not supported, skipping
      Mar 02, 2019 3:49:29 PM hudson.remoting.jnlp.Main$CuiListener error
      SEVERE: The server rejected the connection: None of the protocols were accepted
      java.lang.Exception: The server rejected the connection: None of the protocols were accepted
              at hudson.remoting.Engine.onConnectionRejected(Engine.java:682)
              at hudson.remoting.Engine.innerRun(Engine.java:639)
              at hudson.remoting.Engine.run(Engine.java:474)
      

      【讨论】:

        【解决方案6】:

        我在gcp上遇到这种问题,jenkins master behind load balance,和Sidharth Ramesh回复的差不多。

        在配置 -> 管理 jenkins -> 配置全局安全,在“代理”部分,你必须配置一个特定的端口,不要随机选择。我选择50222为例,

        下面是代理协议:有一个“入站TCP代理协议/4(TLS加密)”复选框,我们必须启用。如果没有,则会出现错误消息:“服务器报告协议 jnlp4-connect 不支持跳过”

        打开从jenkins slave到jenkins master vm内部ip的端口的防火墙。

        享受

        【讨论】:

          【解决方案7】:

          我遇到了这个问题,我找到了解决方案。

          我通过 EKS 上的 jenkins helm chart 部署了 jenkins master, 并通过入口控制器暴露, 它在 ALB 后面。 我试图连接一个入站代理节点,但上面出现了这个错误。

          简单的解决方案:只需在代理节点配置中勾选“使用 WebSocket”选项 (管理 Jenkins ==> 管理节点和云 ==> 选择您的入站代理节点 ==> 配置 ==> 勾选“使用 WebSocket”)

          在我这样做之后 - 代理可以连接并且错误消失了。 这是最优雅的解决方案,我相信它也更安全,因为当你使用它时,你不需要保持 50000 tcp 端口打开,你可以继续使用 jenkins 的主端口(我猜通常是 443),

          注意:您确实需要确保代理可以访问 jenkins 主端口(通常是 443 或 80)。

          这就是我找到这个解决方案的方法:

          我发现了这个: https://docs.cloudbees.com/docs/cloudbees-ci/latest/cloud-setup-guide/configure-ports-jnlp-agents

          这导致我这样做: https://github.com/jenkinsci/jep/blob/master/jep/222/README.adoc

          他们在那里解释说,当您通过负载均衡器公开 jenkins 时,最好使用 websocket 选项(即使没有,使用 websocket 仍然更好,因为 websocket 比 jnlp 和额外的 tcp 端口更安全)

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2015-07-28
            • 1970-01-01
            • 2012-09-26
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2017-03-24
            • 1970-01-01
            相关资源
            最近更新 更多