tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r550221 - in /tomcat/connectors/trunk/jk: native/common/jk_ajp_common.c native/common/jk_ajp_common.h xdocs/miscellaneous/changelog.xml xdocs/reference/workers.xml
Date Sun, 24 Jun 2007 13:10:08 GMT
Author: rjung
Date: Sun Jun 24 06:10:07 2007
New Revision: 550221

URL: http://svn.apache.org/viewvc?view=rev&rev=550221
Log:
- Common: Add recovery options for recovering idempotent http methods
  HEAD and GET.
- Correct documentation for worker attributes retries and
  recovery_options.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
    tomcat/connectors/trunk/jk/xdocs/reference/workers.xml

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?view=diff&rev=550221&r1=550220&r2=550221
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sun Jun 24 06:10:07 2007
@@ -1604,6 +1604,20 @@
                         op->recoverable = JK_FALSE;
                 }
 
+                /*
+                 * We revert back to recoverable, if recovery_opts allow it for GET or HEAD
+                 */
+                if (op->recoverable == JK_FALSE) {
+                    if (p->worker->recovery_opts & RECOVER_ALWAYS_HTTP_HEAD) {
+                        if (!strcmp(s->method, "HEAD"))
+                            op->recoverable = JK_TRUE;
+                    }
+                    else if (p->worker->recovery_opts & RECOVER_ALWAYS_HTTP_GET)
{
+                        if (!strcmp(s->method, "GET"))
+                            op->recoverable = JK_TRUE;
+                    }
+                }
+
                 JK_TRACE_EXIT(l);
                 return JK_FALSE;
             }
@@ -1630,6 +1644,21 @@
                  */
                 if (p->worker->recovery_opts & RECOVER_ABORT_IF_TCGETREQUEST)
                     op->recoverable = JK_FALSE;
+
+                /*
+                 * We revert back to recoverable, if recovery_opts allow it for GET or HEAD
+                 */
+                if (op->recoverable == JK_FALSE) {
+                    if (p->worker->recovery_opts & RECOVER_ALWAYS_HTTP_HEAD) {
+                        if (!strcmp(s->method, "HEAD"))
+                            op->recoverable = JK_TRUE;
+                    }
+                    else if (p->worker->recovery_opts & RECOVER_ALWAYS_HTTP_GET)
{
+                        if (!strcmp(s->method, "GET"))
+                            op->recoverable = JK_TRUE;
+                    }
+                }
+
                 /*
                  * we want to display the webservers error page, therefore
                  * we return JK_FALSE
@@ -1662,6 +1691,20 @@
                 if (p->worker->recovery_opts & RECOVER_ABORT_IF_TCSENDHEADER)
                     op->recoverable = JK_FALSE;
 
+                /*
+                 * We revert back to recoverable, if recovery_opts allow it for GET or HEAD
+                 */
+                if (op->recoverable == JK_FALSE) {
+                    if (p->worker->recovery_opts & RECOVER_ALWAYS_HTTP_HEAD) {
+                        if (!strcmp(s->method, "HEAD"))
+                            op->recoverable = JK_TRUE;
+                    }
+                    else if (p->worker->recovery_opts & RECOVER_ALWAYS_HTTP_GET)
{
+                        if (!strcmp(s->method, "GET"))
+                            op->recoverable = JK_TRUE;
+                    }
+                }
+
                 JK_TRACE_EXIT(l);
                 return JK_FALSE;
             }
@@ -1832,7 +1875,7 @@
         err = ajp_send_request(e, s, l, p, op);
         if (err == JK_TRUE) {
 
-            /* If we have the no recoverable error, it's probably because
+            /* If we have an unrecoverable error, it's probably because
              * the sender (browser) stopped sending data before the end
              * (certainly in a big post)
              */
@@ -1908,7 +1951,7 @@
                 }
             }
             else {
-                /* if we can't get reply, check if no recover flag was set
+                /* if we can't get reply, check if unrecoverable flag was set
                  * if is_recoverable_error is cleared, we have started
                  * receiving upload data and we must consider that
                  * operation is no more recoverable

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h?view=diff&rev=550221&r1=550220&r2=550221
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h Sun Jun 24 06:10:07 2007
@@ -197,9 +197,11 @@
 #define AJP_DEF_RECOVERY_OPTS     (0)   /* NO RECOVERY / NO    */
 #define AJP_DEF_SOCKET_TIMEOUT    (0)  /* No timeout */
 
-#define RECOVER_ABORT_IF_TCGETREQUEST    0x0001 /* DONT RECOVER IF TOMCAT FAIL AFTER RECEIVING
REQUEST */
-#define RECOVER_ABORT_IF_TCSENDHEADER    0x0002 /* DONT RECOVER IF TOMCAT FAIL AFTER SENDING
HEADERS */
+#define RECOVER_ABORT_IF_TCGETREQUEST    0x0001 /* DON'T RECOVER IF TOMCAT FAILS AFTER RECEIVING
REQUEST */
+#define RECOVER_ABORT_IF_TCSENDHEADER    0x0002 /* DON'T RECOVER IF TOMCAT FAILS AFTER SENDING
HEADERS */
 #define RECOVER_ABORT_IF_CLIENTERROR     0x0004 /* CLOSE THE SOCKET IN CASE OF CLIENT ERROR
*/
+#define RECOVER_ALWAYS_HTTP_HEAD         0x0008 /* RECOVER HTTP HEAD REQUESTS, EVEN IF ABORT
OPTIONS ARE SET */
+#define RECOVER_ALWAYS_HTTP_GET          0x0010 /* RECOVER HTTP GET REQUESTS, EVEN IF ABORT
OPTIONS ARE SET */
 
 #define JK_MAX_HTTP_STATUS_FAILS   32   /* Should be enough for most 400 and 500 statuses
*/
 

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=550221&r1=550220&r2=550221
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun Jun 24 06:10:07 2007
@@ -27,6 +27,14 @@
   <br />
   <subsection name="Native">
     <changelog>
+      <update>
+      Common: Add recovery options for recovering idempotent http methods
+      HEAD and GET. (rjung)
+      </update>
+      <fix>
+      Correct documentation for worker attributes retries and
+      recovery_options. (rjung)
+      </fix>
       <fix>
       Make writing log lines and line endings more atomic. (rjung)
       </fix>

Modified: tomcat/connectors/trunk/jk/xdocs/reference/workers.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/workers.xml?view=diff&rev=550221&r1=550220&r2=550221
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/reference/workers.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/reference/workers.xml Sun Jun 24 06:10:07 2007
@@ -149,12 +149,6 @@
 </p>
 </directive>
 
-<directive name="retries" default="2" required="false">
-The number of retries that the worker will try in case of error returned from remote
-Tomcat. If the number of retries set is greater than two (the default value), on
-each retry after default an extra wait of 100ms will be inserted.
-</directive>
-
 <directive name="connection_pool_size" default="see text" required="false">
 This defines the number of connections made to the AJP backend that
 are maintained as a connection pool.
@@ -283,7 +277,7 @@
 Tomcat worker. If sticky_session is set to <b>True</b> or <b>1</b>
sessions are sticky, otherwise
 sticky_session is set to <b>False</b>. Set sticky_session to <b>False</b>
when Tomcat
 is using a Session Manager which can persist session data across multiple
-instances of Tomcat. By default sticky_session is set to True.
+instances of Tomcat.
 </directive>
 
 <directive name="sticky_session_force" default="False" required="false">
@@ -361,6 +355,18 @@
 </p>
 </directive>
 
+<directive name="retries" default="2" required="false">
+<warn>This directive also exists for normal workers.
+For those it has a <a href="#Advanced worker directives">different meaning</a>.</warn>
+If the load balancer can not get a free connection for a member worker
+from the pool, it will try again a number of times given by <b>retries</b>.
+Before each retry, it will make a small pause, starting with 50 milliseconds
+and doubling before each retry until a maximum of 100 milliseconds.
+<p>
+Until version <b>1.2.16</b> the default value was 3.
+</p>
+</directive>
+
 <directive name="secret" default="" required="false">
 Set a default secret word for all defined workers.
 See worker secret attribute description for more info.
@@ -571,27 +577,40 @@
 </p>
 </directive>
 
-<directive name="recovery_options" default="0" required="false">
-Only used for a member worker of a load balancer.
+<directive name="retries" default="2" required="false">
+<warn>This directive also exists for load balancer workers.
+For those it has a <a href="#Load balancing directives">different meaning</a>.</warn>
+The maximum number of times that the worker will send a request to Tomcat
+in case of a communication error. Each retry will be done over another
+connection. The first time already gets counted, so retries=2 means
+one retry after error. If the value is greater than the default value, on
+each additional retry an extra wait of 100ms will be inserted.
+<p>
+See also the attribute <b>recovery_options</b> for a more fine-grained control
+of retries.
+</p>
 <p>
-Recovery options property told webserver how to handle recovery when
-it detect that tomcat failed.
-By default, webserver will forward the request to another tomcat in LB mode
-(or to another ajp thread in ajp13 mode).
-values are : 0 (full recovery), 1 (don't recover if tomcat failed after getting the request),
-2 (don't recover if tomcat failed after sending the headers to client), 3 (don't recover
if tomcat failed
-getting the request or after sending the headers to client).
-</p>
-<p>
-This features has been added in <b>jk 1.2.6</b> to avoid problem with hung/broken
tomcat's
-and works on all servlet engines supporting ajp13.
-Full recovery by default.
-</p>
-<p>If the value 4 is added to the recovery options, the connection
-between the webserver and tomcat will be closed if the client connection
-to the webserver is terminated during the request/response cycle. This allows
-to inform the servlet engine about broken client connections during lengthy operations.
-This feature has been added in <b>jk 1.2.16</b>
+Until version <b>1.2.16</b> the default value was 3.
+</p>
+</directive>
+
+<directive name="recovery_options" default="0" required="false">
+Recovery options influence, how we should handle retries,
+in case we detect a problem with Tomcat.
+How often we will retry is controlled by the attribute <b>retries</b>.
+<p>
+This attribute is a bit mask. The following bits are allowed:<br/>
+1: don't recover if tomcat failed after getting the request<br/>
+2: don't recover if tomcat failed after sending the headers to client<br/>
+4: close the connection to tomcat, if we detect an error when writing back
+the answer to the client (browser)<br/>
+8: always recover requests for HTTP method HEAD (even if Bits 1 or 2 are set)<br/>
+16: always recover requests for HTTP method GET (even if Bits 1 or 2 are set)<br/>
+</p>
+<p>
+This features has been added in <b>jk 1.2.6</b>.
+Option 4 has been added in version <b>1.2.16</b>,
+options 8 and 16 in version <b>1.2.24</b>.
 </p>
 </directive>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message