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

winstone-jetty http/s timeout options are not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • winstone-jetty
    • None
    • Jenkins 2.401.3

      We are executing some groovy scripts via the scriptText API, we noticed that if the script takes longer than 5 mins to return a result we get a 504 Gateway Time-out error.

      Poking around online and in the mailing lists it appears the following options for winstone deal with setting the http/s idle timeout values:

      https://github.com/jenkinsci/winstone

      --httpKeepAliveTimeout   = how long idle HTTP keep-alive connections are kept around (in ms; default 30000)?
      
      --httpsKeepAliveTimeout  = how long idle HTTPS keep-alive connections are kept around (in ms; default 30000)?
      

      They also mention a default of 30000ms which corresponds to the 5 min timeout we are experiencing. I've tested by adding these options to our JENKINS_OPTS and setting a 10 min timeout but still the same 504 error is seen after 5 mins. I've also tested shorter timeouts of 30 seconds and 2mins, but I do not get the 504 error any sooner.

      Add options:

      export JENKINS_OPTS=--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=8080 --httpsKeepAliveTimeout=600000 --httpKeepAliveTimeout=600000 

      Confirm options:

      / # jps -lvm
      9077 jdk.jcmd/sun.tools.jps.Jps -lvm -Dapplication.home=/opt/java/openjdk -Xms8m -Djdk.module.main=jdk.jcmd
      7 /usr/share/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=8080 --httpsKeepAliveTimeout=600000 --httpKeepAliveTimeout=600000 -Duser.home=/var/jenkins_home -Djenkins.install.runSetupWizard=false ... 

       

      The following curl commands can be used to reproduce the issue:

      1. Create a groovy script which sleeps for >5mins:

      sleep(360000)
      println("slept 6mins")
      

      2. Run the groovy script using /scriptText API or simply in the /script web console.

      curl -b cookies.txt -u "user:pass" -X POST -H "$crumb" --data-urlencode "script=$(< ./sleepTest.groovy)" https://jenkinsURL/scriptText
      

      3. Returns below after 5 mins.

      <html>
      <head><title>504 Gateway Time-out</title></head>
      <body>
      <center><h1>504 Gateway Time-out</h1></center>
      </body>
      </html>
      

            Unassigned Unassigned
            jastec Jacob
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: