Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66335

Failed to create a swam agent on jenkins. response code 411

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • swarm-plugin
    • None
    • Jenkins 2.289.2
      swam-plugin Version: 3.27
      swarm-client version: 3.27
    • 3.28

      After updating jenkins I see this error message when trying to run the swarm-client on a slave machine.

       

       

       

      Aug 09, 2021 11:01:03 AM hudson.plugins.swarm.Client logArguments
       INFO: Client invoked with: -name slave-abc -password ***** -retry 1 -url http://jenkins.sab.local -username ***** 
       Aug 09, 2021 11:01:03 AM hudson.plugins.swarm.Client run
       INFO: Connecting to Jenkins controller
       Aug 09, 2021 11:01:03 AM hudson.plugins.swarm.Client run
       INFO: Attempting to connect to http://jenkins.sab.local/
       Aug 09, 2021 11:01:04 AM hudson.plugins.swarm.Client run
       SEVERE: An error occurred
       hudson.plugins.swarm.RetryException: Failed to create a Swarm agent on Jenkins. Response code: 411
       <?xml version="1.0" encoding="iso-8859-1"?>
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
       <head>
       <title>411 Length Required</title>
       </head>
       <body>
       <h1>411 Length Required</h1>
       </body>
       </html>
      at hudson.plugins.swarm.SwarmClient.createSwarmAgent(SwarmClient.java:457)
       at hudson.plugins.swarm.Client.run(Client.java:204)
       at hudson.plugins.swarm.Client.main(Client.java:73)
      Aug 09, 2021 11:01:04 AM hudson.plugins.swarm.Client run
       SEVERE: Retry limit reached, exiting...
      

       

          [JENKINS-66335] Failed to create a swam agent on jenkins. response code 411

          Heiko Thiery added a comment -

          Version swarm-client-3.23.jar of the client seems to work well. All newer versions show the error above.

          Heiko Thiery added a comment - Version swarm-client-3.23.jar of the client seems to work well. All newer versions show the error above.

          Basil Crow added a comment -

          Cannot reproduce the problem with a fresh installation of Jenkins 2.289.2 and Swarm 3.27 (plugin and client). Please provide a list of steps to reproduce the problem from scratch.

          Basil Crow added a comment - Cannot reproduce the problem with a fresh installation of Jenkins 2.289.2 and Swarm 3.27 (plugin and client). Please provide a list of steps to reproduce the problem from scratch.

          Gavin Williams added a comment - - edited

          We've hit this issue aswell when deploying a Jenkins controller on Google Kubernetes Engine (GKE) and fronting it with a Google HTTPS Load Balancer using the `gce` Ingress class. 

          I've opened https://github.com/jenkinsci/swarm-plugin/pull/360 to specify an empty body for the request in order for the `Content-Length` header to be set.

          Gavin Williams added a comment - - edited We've hit this issue aswell when deploying a Jenkins controller on Google Kubernetes Engine (GKE) and fronting it with a Google HTTPS Load Balancer using the `gce` Ingress class.  I've opened https://github.com/jenkinsci/swarm-plugin/pull/360  to specify an empty body for the request in order for the `Content-Length` header to be set.

          Basil Crow added a comment -

          PR #360 has produced a build for testing here: https://ci.jenkins.io/job/Plugins/job/swarm-plugin/job/PR-360/6/artifact/client/target/swarm-client.jar

          fatmcgav and hthiery, can you please download this build, test it, and confirm that this build fixes the problem for both of you?

          Basil Crow added a comment - PR #360 has produced a build for testing here: https://ci.jenkins.io/job/Plugins/job/swarm-plugin/job/PR-360/6/artifact/client/target/swarm-client.jar fatmcgav and hthiery , can you please download this build, test it, and confirm that this build fixes the problem for both of you?

          Gavin Williams added a comment - - edited

          I can confirm that the build jar works as expected:

           

          ❯ java -jar swarm-client.jar -description "fatmcgav swarm test" -disableClientsUniqueId -executors 1 -fsroot jenkins -retry 6 -maxRetryInterval 160 -retryBackOffStrategy exponential -mode exclusive -username local-swarm -passwordFile swarm-password.txt -deleteExistingClients -name fatmcgav-swarm-test -master https://*** -username local-swarm -webSocket -labels swarm -labels x86_64
          Aug 25, 2021 4:15:00 PM hudson.plugins.swarm.Client logArguments
          INFO: Client invoked with: -deleteExistingClients true -description fatmcgav swarm test -disableClientsUniqueId true -executors 1 -fsroot jenkins -labels [swarm, x86_64] -maxRetryInterval 160 -mode exclusive -name fatmcgav-swarm-test -passwordFile ***** -retry 6 -retryBackOffStrategy EXPONENTIAL -url https://*** -username ***** -webSocket true
          Aug 25, 2021 4:15:00 PM hudson.plugins.swarm.Client run
          INFO: Connecting to Jenkins controller
          Aug 25, 2021 4:15:00 PM hudson.plugins.swarm.Client run
          INFO: Attempting to connect to https://***
          Aug 25, 2021 4:15:01 PM hudson.remoting.jnlp.Main createEngine
          INFO: Setting up agent: fatmcgav-swarm-test
          Aug 25, 2021 4:15:01 PM hudson.remoting.jnlp.Main$CuiListener <init>
          INFO: Jenkins agent is running in headless mode.
          Aug 25, 2021 4:15:01 PM hudson.remoting.Engine startEngine
          INFO: Using Remoting version: 4.10
          Aug 25, 2021 4:15:01 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
          INFO: Using jenkins/remoting as a remoting work directory
          Aug 25, 2021 4:15:01 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
          INFO: Both error and output logs will be printed to jenkins/remoting
          Aug 25, 2021 4:15:01 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: WebSocket connection open
          Aug 25, 2021 4:15:01 PM hudson.remoting.jnlp.Main$CuiListener status
          INFO: Connected
          

          Gavin Williams added a comment - - edited I can confirm that the build jar works as expected:   ❯ java -jar swarm-client.jar -description "fatmcgav swarm test" -disableClientsUniqueId -executors 1 -fsroot jenkins -retry 6 -maxRetryInterval 160 -retryBackOffStrategy exponential -mode exclusive -username local-swarm -passwordFile swarm-password.txt -deleteExistingClients -name fatmcgav-swarm-test -master https: //*** -username local-swarm -webSocket -labels swarm -labels x86_64 Aug 25, 2021 4:15:00 PM hudson.plugins.swarm.Client logArguments INFO: Client invoked with: -deleteExistingClients true -description fatmcgav swarm test -disableClientsUniqueId true -executors 1 -fsroot jenkins -labels [swarm, x86_64] -maxRetryInterval 160 -mode exclusive -name fatmcgav-swarm-test -passwordFile ***** -retry 6 -retryBackOffStrategy EXPONENTIAL -url https: //*** -username ***** -webSocket true Aug 25, 2021 4:15:00 PM hudson.plugins.swarm.Client run INFO: Connecting to Jenkins controller Aug 25, 2021 4:15:00 PM hudson.plugins.swarm.Client run INFO: Attempting to connect to https: //*** Aug 25, 2021 4:15:01 PM hudson.remoting.jnlp.Main createEngine INFO: Setting up agent: fatmcgav-swarm-test Aug 25, 2021 4:15:01 PM hudson.remoting.jnlp.Main$CuiListener <init> INFO: Jenkins agent is running in headless mode. Aug 25, 2021 4:15:01 PM hudson.remoting.Engine startEngine INFO: Using Remoting version: 4.10 Aug 25, 2021 4:15:01 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir INFO: Using jenkins/remoting as a remoting work directory Aug 25, 2021 4:15:01 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging INFO: Both error and output logs will be printed to jenkins/remoting Aug 25, 2021 4:15:01 PM hudson.remoting.jnlp.Main$CuiListener status INFO: WebSocket connection open Aug 25, 2021 4:15:01 PM hudson.remoting.jnlp.Main$CuiListener status INFO: Connected

          Logs from `3.27` jar for comparison:

           

           

          ❯ java -jar swarm-client-3.27.jar -description "fatmcgav swarm test" -disableClientsUniqueId -executors 1 -fsroot jenkins -retry 6 -maxRetryInterval 160 -retryBackOffStrategy exponential -mode exclusive -username local-swarm -passwordFile swarm-password.txt -deleteExistingClients -name fatmcgav-swarm-test -master https://*** -username local-swarm -webSocket -labels swarm -labels x86_64
          Aug 25, 2021 4:18:28 PM hudson.plugins.swarm.Client logArguments
          INFO: Client invoked with: -deleteExistingClients true -description fatmcgav swarm test -disableClientsUniqueId true -executors 1 -fsroot jenkins -labels [swarm, x86_64] -maxRetryInterval 160 -mode exclusive -name fatmcgav-swarm-test -passwordFile ***** -retry 6 -retryBackOffStrategy EXPONENTIAL -url https://*** -username ***** -webSocket true
          Aug 25, 2021 4:18:28 PM hudson.plugins.swarm.Client run
          INFO: Connecting to Jenkins controller
          Aug 25, 2021 4:18:28 PM hudson.plugins.swarm.Client run
          INFO: Attempting to connect to https://***
          Aug 25, 2021 4:18:29 PM hudson.plugins.swarm.Client run
          SEVERE: An error occurred
          hudson.plugins.swarm.RetryException: Failed to create a Swarm agent on Jenkins. Response code: 411
          <!DOCTYPE html>
          <html lang=en>
            <meta charset=utf-8>
            <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
            <title>Error 411 (Length Required)!!1</title>
            <style>
              *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
            </style>
            <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
            <p><b>411.</b> <ins>That’s an error.</ins>
            <p>POST requests require a <code>Content-length</code> header.  <ins>That’s all we know.</ins>        at hudson.plugins.swarm.SwarmClient.createSwarmAgent(SwarmClient.java:457)
                  at hudson.plugins.swarm.Client.run(Client.java:204)
                  at hudson.plugins.swarm.Client.main(Client.java:73)Aug 25, 2021 4:18:29 PM hudson.plugins.swarm.Client run
          WARNING: Remaining retries: 5
          Aug 25, 2021 4:18:29 PM hudson.plugins.swarm.Client run
          INFO: Retrying in 10 seconds
          
          

           

          Gavin Williams added a comment - Logs from `3.27` jar for comparison:     ❯ java -jar swarm-client-3.27.jar -description "fatmcgav swarm test" -disableClientsUniqueId -executors 1 -fsroot jenkins -retry 6 -maxRetryInterval 160 -retryBackOffStrategy exponential -mode exclusive -username local-swarm -passwordFile swarm-password.txt -deleteExistingClients -name fatmcgav-swarm-test -master https: //*** -username local-swarm -webSocket -labels swarm -labels x86_64 Aug 25, 2021 4:18:28 PM hudson.plugins.swarm.Client logArguments INFO: Client invoked with: -deleteExistingClients true -description fatmcgav swarm test -disableClientsUniqueId true -executors 1 -fsroot jenkins -labels [swarm, x86_64] -maxRetryInterval 160 -mode exclusive -name fatmcgav-swarm-test -passwordFile ***** -retry 6 -retryBackOffStrategy EXPONENTIAL -url https: //*** -username ***** -webSocket true Aug 25, 2021 4:18:28 PM hudson.plugins.swarm.Client run INFO: Connecting to Jenkins controller Aug 25, 2021 4:18:28 PM hudson.plugins.swarm.Client run INFO: Attempting to connect to https: //*** Aug 25, 2021 4:18:29 PM hudson.plugins.swarm.Client run SEVERE: An error occurred hudson.plugins.swarm.RetryException: Failed to create a Swarm agent on Jenkins. Response code: 411 <!DOCTYPE html> <html lang=en> <meta charset=utf-8> <meta name=viewport content= "initial-scale=1, minimum-scale=1, width=device-width" > <title>Error 411 (Length Required)!!1</title> <style> *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url( //www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px} </style> <a href= //www.google.com/><span id=logo aria-label=Google></span></a> <p><b>411.</b> <ins>That’s an error.</ins> <p>POST requests require a <code>Content-length</code> header. <ins>That’s all we know.</ins> at hudson.plugins.swarm.SwarmClient.createSwarmAgent(SwarmClient.java:457) at hudson.plugins.swarm.Client.run(Client.java:204) at hudson.plugins.swarm.Client.main(Client.java:73)Aug 25, 2021 4:18:29 PM hudson.plugins.swarm.Client run WARNING: Remaining retries: 5 Aug 25, 2021 4:18:29 PM hudson.plugins.swarm.Client run INFO: Retrying in 10 seconds  

          Basil Crow added a comment -

          Fixed in jenkinsci/swarm-plugin#360. Released in 3.28.

          Basil Crow added a comment - Fixed in jenkinsci/swarm-plugin#360 . Released in 3.28 .

            fatmcgav Gavin Williams
            hthiery Heiko Thiery
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: