Jenkins 2.346.3へのアップデート後にagentの接続が維持されない

662 views
Skip to first unread message

r-ninomiya

unread,
Aug 20, 2022, 12:54:53 AM8/20/22
to 日本Jenkinsユーザー会
日本Jenkinsユーザー会の皆さま。

初めまして。
今回初投稿になりますので、不足情報や要領を得ない点もあるかと存じますがご容赦いただけますと幸いです。

  • 質問内容
先日、Jenkins 2.346.3にアップデートしてから、それまで接続が維持されていたagentが数時間で切れるようになりました。

  • 接続方法は以下の通りです。
  1. agent.jarをmac mini(macOS Monterey 12.4)に設置しています。
  2. Unix agent, version 4.13.3を使い、java -jar /Users/build-user/Jenkins/agent.jar -jnlpUrl https://****/jenkins-agent.jnlp -secret **** -workDir "/Users/build-user/Jenkins" を実行しています。
  • 上記の実行結果は以下の通りです。
```
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main createEngine
情報: Setting up agent: ****
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener <init>
情報: Jenkins agent is running in headless mode.
8月 20, 2022 10:54:53 午前 hudson.remoting.Engine startEngine
情報: Using Remoting version: 4.13.3
8月 20, 2022 10:54:53 午前 org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
情報: Using /Users/build-user/Jenkins/remoting as a remoting work directory
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Locating server among [https://****/]
8月 20, 2022 10:54:53 午前 org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
情報: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
8月 20, 2022 10:54:53 午前 org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
情報: Remoting TCP connection tunneling is enabled. Skipping the TCP Agent Listener Port availability check
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Agent discovery successful
  Agent address: ****
  Agent port:    ****
  Identity:      ****
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Handshaking
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Connecting to ****:****
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Trying protocol: JNLP4-connect
8月 20, 2022 10:54:53 午前 org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run
情報: Waiting for ProtocolStack to start.
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Remote identity confirmed: ****
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Connected
```

数時間後に突然接続が切れ、再接続されません。

```
8月 20, 2022 12:19:54 午後 hudson.remoting.jnlp.Main$CuiListener status
情報: Terminated
8月 20, 2022 12:20:04 午後 hudson.remoting.jnlp.Main$CuiListener status
情報: Performing onReconnect operation.
8月 20, 2022 12:20:04 午後 jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$EngineListenerAdapterImpl onReconnect
情報: Restarting agent via jenkins.slaves.restarter.UnixSlaveRestarter@7b0580cb
```

  • Macのターミナルでは以下の表示がありました。
```
8月 20, 2022 10:54:53 午前 hudson.remoting.jnlp.Main$CuiListener status
情報: Connected
8月 20, 2022 12:19:54 午後 hudson.remoting.jnlp.Main$CuiListener status
情報: Terminated
8月 20, 2022 12:20:04 午後 hudson.remoting.jnlp.Main$CuiListener status
情報: Performing onReconnect operation.
8月 20, 2022 12:20:04 午後 jenkins.slaves.restarter.JnlpSlaveRestarterInstaller$EngineListenerAdapterImpl onReconnect
情報: Restarting agent via jenkins.slaves.restarter.UnixSlaveRestarter@7b0580cb
/Users/build-user/Jenkins/start-up-jenkins.command: line 1:  9279 Killed: 9               java -jar /Users/build-user/Jenkins/agent.jar -jnlpUrl https://****/jenkins-agent.jnlp -secret **** -workDir "/Users/build-user/Jenkins"

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
```

  • EC2のJenkins Controllerのログは以下の通りです。
```
Connection was broken: java.nio.channels.ClosedChannelException at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.onReadClosed(ChannelApplicationLayer.java:240) at org.jenkinsci.remoting.protocol.ApplicationLayer.onRecvClosed(ApplicationLayer.java:221) at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:825) at org.jenkinsci.remoting.protocol.FilterLayer.onRecvClosed(FilterLayer.java:289) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.onRecvClosed(SSLEngineFilterLayer.java:177) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.switchToNoSecure(SSLEngineFilterLayer.java:279) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.processWrite(SSLEngineFilterLayer.java:501) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.processQueuedWrites(SSLEngineFilterLayer.java:244) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.doSend(SSLEngineFilterLayer.java:196) at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.doCloseSend(SSLEngineFilterLayer.java:209) at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doCloseSend(ProtocolStack.java:793) at org.jenkinsci.remoting.protocol.ApplicationLayer.doCloseWrite(ApplicationLayer.java:172) at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer$ByteBufferCommandTransport.closeWrite(ChannelApplicationLayer.java:342) at hudson.remoting.Channel.close(Channel.java:1494) at hudson.remoting.Channel.close(Channel.java:1447) at hudson.slaves.SlaveComputer.closeChannel(SlaveComputer.java:923) at hudson.slaves.SlaveComputer.access$100(SlaveComputer.java:112) at hudson.slaves.SlaveComputer$2.run(SlaveComputer.java:803) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)
```

Mac(agent)の設定は変更しておらず、jenkins(controller)のアップデートだけ実行しました。

解決方法等をご存知の方がいらっしゃいましたら、ご教示いただければ幸いです。

よろしくお願いいたします。

r-ninomiya

unread,
Aug 24, 2022, 5:05:15 AM8/24/22
to 日本Jenkinsユーザー会
agentの再接続が問題になっていましたので、websocketを使用する方法にして接続を維持するようにいたしました。

閲覧してくださった方ありがとうございました。

2022年8月20日土曜日 13:54:53 UTC+9 r-ninomiya:
Reply all
Reply to author
Forward
0 new messages