tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Le Huy <lehu...@gmail.com>
Subject tomcat connector - jk_status does not update shm correctly
Date Sun, 25 Mar 2012 21:00:59 GMT
Hi

I am facing problem in using jkstatus to update subworker lb_factor,
it seems that after changing it, the mod_jk balancer does not change
anything

Looking at source code in trunk, I think that there is bug , I
include herewith the 2 changes that I think will fix the problem,

1) I move update_mult() a head of  jk_lb_push() in update_worker() so
the lb_mult of sub worker can be persisted to shm
2) I reverse the condition using to guard of update shm of subworkder
in jk_lb_push()


Can someone review it ? to be honest I am not very familiar with the code base.



Index: native/common/jk_status.c
===================================================================
--- native/common/jk_status.c   (revision 1305015)
+++ native/common/jk_status.c   (working copy)
@@ -4161,6 +4161,9 @@
                if (rv & JK_STATUS_NEEDS_ADDR_PUSH) {
                    aw->addr_sequence++;
                }
+                if (rv & JK_STATUS_NEEDS_UPDATE_MULT)
+                    /* Recalculate the load multiplicators wrt. lb_factor */
+                    update_mult(lb, l);
                if (rv & (JK_STATUS_NEEDS_PUSH | JK_STATUS_NEEDS_ADDR_PUSH)) {
                    wr->sequence++;
                    lb->sequence++;
@@ -4168,9 +4171,6 @@
                }
                if (rv & JK_STATUS_NEEDS_RESET_LB_VALUES)
                    reset_lb_values(lb, l);
-                if (rv & JK_STATUS_NEEDS_UPDATE_MULT)
-                    /* Recalculate the load multiplicators wrt. lb_factor */
-                    update_mult(lb, l);
                if (rc == JK_FALSE) {
                    jk_log(l, JK_LOG_ERROR,
                           "Status worker '%s' failed updating sub
worker '%s' (at least partially).%s",
Index: native/common/jk_lb_worker.c
===================================================================
--- native/common/jk_lb_worker.c        (revision 1305015)
+++ native/common/jk_lb_worker.c        (working copy)
@@ -370,7 +370,7 @@

    for (i = 0; i < p->num_of_workers; i++) {
        lb_sub_worker_t *w = &p->lb_workers[i];
-        if (w->sequence < w->s->h.sequence) {
+        if (w->sequence > w->s->h.sequence) {
            jk_worker_t *jw = w->worker;
            ajp_worker_t *aw = (ajp_worker_t *)jw->worker_private;

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


Mime
View raw message