Bug 46109

Summary: The reply_timeout counter doesn't decay, when Busyness is specified to lb method.
Product: Tomcat Connectors Reporter: Eiji Takahashi <mashmk02>
Component: CommonAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: patch to decay_load

Description Eiji Takahashi 2008-10-28 05:36:21 UTC
Created attachment 22784 [details]
patch to decay_load

The reply_timeout counter is not cleared by 0 when the worker becomes force
recovery state.

In addition, the counter doesn't decay because the following codes are not executed when Busyness is specified to method directive.
Therefore, it is easy to become an error state.
-----jk_lb_worker.c
600:    if (p->lbmethod != JK_LB_METHOD_BUSYNESS) {
601:        for (i = 0; i < p->num_of_workers; i++) {
602:            lb_sub_worker_t *w = &p->lb_workers[i];
603:            ajp_worker_t *aw = (ajp_worker_t *)w->worker->worker_private;
604:            w->s->lb_value >>= exponent;
605:            if (w->s->lb_value > curmax) {
606:                curmax = w->s->lb_value;
607:            }
608:            aw->s->reply_timeouts >>= exponent;
609:        }
610:    }
---

I think that to decay the counter is nice idea for Busyness method as well as in the case of other methods. 
How about as follows?

Index: mod_jk-head/native/common/jk_lb_worker.c
===================================================================
--- mod_jk-head/native/common/jk_lb_worker.c	(revision 708408)
+++ mod_jk-head/native/common/jk_lb_worker.c	(working copy)
@@ -597,16 +597,16 @@
     jk_uint64_t curmax = 0;
 
     JK_TRACE_ENTER(l);
-    if (p->lbmethod != JK_LB_METHOD_BUSYNESS) {
-        for (i = 0; i < p->num_of_workers; i++) {
-            lb_sub_worker_t *w = &p->lb_workers[i];
-            ajp_worker_t *aw = (ajp_worker_t *)w->worker->worker_private;
+    for (i = 0; i < p->num_of_workers; i++) {
+        lb_sub_worker_t *w = &p->lb_workers[i];
+        ajp_worker_t *aw = (ajp_worker_t *)w->worker->worker_private;
+        if (p->lbmethod != JK_LB_METHOD_BUSYNESS) {
             w->s->lb_value >>= exponent;
             if (w->s->lb_value > curmax) {
                 curmax = w->s->lb_value;
             }
-            aw->s->reply_timeouts >>= exponent;
         }
+        aw->s->reply_timeouts >>= exponent;
     }
     JK_TRACE_EXIT(l);

regards.
Comment 1 Rainer Jung 2008-10-28 12:27:32 UTC
Fixed in revision 708643.
I also included a fix for the forced recovery case.
Unfortunately this bug is not only in 1.2.27-dev, it was already part of 1.2.26
Thanks as always.