Jenkins setup:
Jenkins Version: 2.4.14.3 lts
codebuilder-cloud plugin Version: 1.0
Jenkins controller inside ECS with and NLB in front of it which opens port 50000 and 443.
Agents running inside the code build environment using the above cloud plugin
Agent image: GitHub - felipecrs/jenkins-agent-dind: A full fledged Docker in Docker image to act as a Jenkins Agent.
I am using the code-builder cloud plugin to spin up cloud agents inside the aws codebuid project, So everything is working fine when I’m running a pipeline in inside the code build agents, but when I run multiple pipelines which spins up multiple builds(different machine) concurrently, I am getting the following error. I don’t have any idea why this is happening. Please answer the following questions
- What is the root cause for this error?
- Can multiple agents connect to the controller simultaneously?
- We are running it in front of an NLB, from what I understand it is connecting via TCP, so It can have multiple connections concurrently, right?
- Does it have anything to do with my agent image?
- Does it got something to do with my plugin, have anyone experienced this with multiple concurrent agents with any other agents/clouds environment?
NB: Attaching an issue with similar error
Kubernetes Cloud Configuration in Jenkins: Continuous Pod Creation and Unknown Client Name Error
[Container] 2023/11/06 11:39:22.756991 Entering phase BUILD
[Container] 2023/11/06 11:39:22.757392 Running command jenkins-agent -noreconnect -workDir "$CODEBUILD_SRC_DIR" -url "https://jenkins.company.com/" "b1e2fc7f68d64b95efd137be92bfbf4bd81a04262487d3ad2f858517a6127432" "cs-v3-stage-codebuild-jenkins-agents.cb-QYWz" || exit 0
Oct 25, 2023 6:03:22 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
26INFO: Using /codebuild/output/src2970242947/src/remoting as a remoting work directory
27Oct 25, 2023 6:03:22 AM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
28INFO: Both error and output logs will be printed to /codebuild/output/src2970242947/src/remoting
29Oct 25, 2023 6:03:22 AM hudson.remoting.Launcher createEngine
30INFO: Setting up agent: jenkins-cluster.cb-QYWz
31Oct 25, 2023 6:03:22 AM hudson.remoting.Engine startEngine
32INFO: Using Remoting version: 3180.v3dd999d24861
33Oct 25, 2023 6:03:22 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
34INFO: Using /codebuild/output/src2970242947/src/remoting as a remoting work directory
35Oct 25, 2023 6:03:22 AM hudson.remoting.Launcher$CuiListener status
36INFO: Locating server among [https://jenkins.company.com/]
37Oct 25, 2023 6:03:22 AM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
38INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
39Oct 25, 2023 6:03:22 AM hudson.remoting.Launcher$CuiListener status
40INFO: Agent discovery successful
41 Agent address: jenkins.company.com
42 Agent port: 50000
43 Identity: 61:6e:d8:76:ee:42:68:dd:3e:36:b2:f9:ef:43:a9:21
44Oct 25, 2023 6:03:22 AM hudson.remoting.Launcher$CuiListener status
45INFO: Handshaking
46Oct 25, 2023 6:03:23 AM hudson.remoting.Launcher$CuiListener status
47INFO: Connecting to jenkins.company.com:50000
48Oct 25, 2023 6:03:23 AM hudson.remoting.Launcher$CuiListener status
49INFO: Server reports protocol JNLP4-connect-proxy not supported, skipping
50Oct 25, 2023 6:03:23 AM hudson.remoting.Launcher$CuiListener status
51INFO: Trying protocol: JNLP4-connect
52Oct 25, 2023 6:03:23 AM org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run
53INFO: Waiting for ProtocolStack to start.
54Oct 25, 2023 6:03:23 AM hudson.remoting.Launcher$CuiListener status
55INFO: Remote identity confirmed: 61:6e:d8:76:ee:42:68:dd:3e:36:b2:f9:ef:43:a9:21
56Oct 25, 2023 6:03:23 AM org.jenkinsci.remoting.protocol.impl.ConnectionHeadersFilterLayer onRecv
57INFO: [JNLP4-connect connection to jenkins.company.com/44.209.70.84:50000] Local headers refused by remote: Unknown client name: jenkins-cluster.cb-QYWz
58Oct 25, 2023 6:03:23 AM hudson.remoting.Launcher$CuiListener status
59INFO: Protocol JNLP4-connect encountered an unexpected exception
60java.util.concurrent.ExecutionException: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Unknown client name: jenkins-cluster.cb-QYWz
61 at org.jenkinsci.remoting.util.SettableFuture.get(SettableFuture.java:223)
62 at hudson.remoting.Engine.innerRun(Engine.java:824)
63 at hudson.remoting.Engine.run(Engine.java:545)
64Caused by: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Unknown client name: jenkins-cluster.cb-QYWz
65 at org.jenkinsci.remoting.protocol.impl.ConnectionHeadersFilterLayer.newAbortCause(ConnectionHeadersFilterLayer.java:380)
66 at org.jenkinsci.remoting.protocol.impl.ConnectionHeadersFilterLayer.onRecvClosed(ConnectionHeadersFilterLayer.java:435)
67 at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:825)
68 at org.jenkinsci.remoting.protocol.FilterLayer.onRecvClosed(FilterLayer.java:289)
69 at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.onRecvClosed(SSLEngineFilterLayer.java:168)
70 at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:825)
71 at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:155)
72 at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer.access$700(BIONetworkLayer.java:51)
73 at org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader.run(BIONetworkLayer.java:257)
74 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
75 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
76 at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:127)
77 at java.base/java.lang.Thread.run(Thread.java:833)
78 Suppressed: java.nio.channels.ClosedChannelException
79 ... 7 more
80
81Oct 25, 2023 6:03:23 AM hudson.remoting.Launcher$CuiListener status
82INFO: reconnect rejected, sleeping 10s:
83java.lang.Exception: The server rejected the connection: None of the protocols were accepted
84 at hudson.remoting.Engine.onConnectionRejected(Engine.java:903)
85 at hudson.remoting.Engine.innerRun(Engine.java:850)
86 at hudson.remoting.Engine.run(Engine.java:545)```