3 Replies Latest reply on Feb 10, 2009 5:23 PM by triumphthepup

    How set request timeout?

    bunkenburg

      Hello people

      I am wondering how to set the request timeout for servlets in Apache+mod_jk+JBoss4.2.2.

      We are using Apache (prefork) 2.2 with mod_jk 1.2.25 on RedHat5, with JBoss 4.2.2. Sometimes our servlets take a long time in replying. I would like to configure a timeout. If a servlet takes too long, I would like a new entry in some error log and I would like the browser to receive a nice error page. Is it somehow possible to make the JBoss thread that is executing the long request stop or interrupt it?

      I have looked in the Apache 2.2 configuration, where I found TimeOut which limits the socket between the browser and Apache --- not what we want.

      I have looked in the doc for mod_jk where I found reply_timeout. I set it to 25 seconds, and that at least closes the connection to the browser. The browser receives nothing, that is a blank page. But the thread in JBoss is still working, and I cannot find how to log this timeout. Our system admins will have no idea theses timeouts are happening. If we had a servlet with an infinite loop, more and more JBoss would be lost executing the infinite loop.

      I have looked in the JBoss-Tomcat doc where I cannot find how to configure a request timeout.

      How can a configure a request timeout, ideally with some logging and an error page?

      Many thanks in advance.

        • 1. Re: How set request timeout?
          erasmomarciano

          you can set in worker.properis various kinf of timeout

          connect_timeout
          prepost_timeout
          reply_timeout


          you have look on this

          http://tomcat.apache.org/connectors-doc/reference/workers.html

          • 2. Re: How set request timeout?
            bunkenburg

            Thank you very much. I had also found those parameters, which limit the connection between the client and Apache. But they do not stop the execution within JBoss I assume.

            In fact, is there any way JBoss can stop execution of a timed-out request? What if I program an infinite loop in a servlet? Does that mean that JBoss loses one thread to a useless infinite execution every time some one calls that servlet? Apache gives them a time-out, but the JBoss thread continues I suppose.

            Is there a way to make JBoss stop execution of requests that have timed out?

            Thanks in advance for any help.

            • 3. Re: How set request timeout?
              triumphthepup

              I'm now searching for the same functionality that bunkenburg described. Is there a way to set a request time in Tomcat? It would essentially be what maxIdleTime does for Jetty. [1]

              I'm looking for a global time out that will kill a Tomcat request thread if it has not responded by a certain timeout. I see the mod_jk settings mentioned above, but I have the same issue with them, which is that JBoss/Tomcat will still be trying to process the request, long after the client is gone.

              Does something like this even exist in Tomcat?

              I see connectionTimeout in server.xml but I realize that's not what I'm after.

              Cheers,
              Richard Taylor
              PIER Sytems, Inc.

              [1] - http://docs.codehaus.org/display/JETTY/Configuring+Connectors