You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kurt Miller <tr...@apache.org> on 2004/03/09 00:00:51 UTC

Re: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_lb.c

Could one of the more senior jtc committers review this for me please?

The problem was that jk_lb_refresh was being called for each channel
parsed and adding all the workers to the workersTable each time. The
result was that the first channel was added to the table n+1 times
(where n = total number of workers), the second channel was added n
times and the third channel n-1, etc. Consequently the table was
getting overrun.

I believe this problem may also account for the first channel(s)
getting more load because of the extra copies in the table.

-Kurt

----- Original Message ----- 
From: <tr...@apache.org>
To: <ja...@apache.org>
Sent: Monday, March 08, 2004 6:01 PM
Subject: cvs commit: jakarta-tomcat-connectors/jk/native2/common
jk_worker_lb.c


> truk        2004/03/08 15:01:07
>
>   Modified:    jk/native2/common jk_worker_lb.c
>   Log:
>   Fix bug 23483
>
>   Only add worker to the workerTable if it is not already there.
>   Add check for maximum workers too.
>
>   Revision  Changes    Path
>   1.38      +21 -5
jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c
>
>   Index: jk_worker_lb.c
>
===================================================================
>   RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c,v
>   retrieving revision 1.37
>   retrieving revision 1.38
>   diff -u -r1.37 -r1.38
>   --- jk_worker_lb.c 27 Feb 2004 08:34:18 -0000 1.37
>   +++ jk_worker_lb.c 8 Mar 2004 23:01:06 -0000 1.38
>   @@ -448,7 +448,8 @@
>            char *name = lb->lbWorkerMap->nameAt( env,
lb->lbWorkerMap, i);
>            jk_worker_t *w= env->getByName( env, name );
>            int level=0;
>   -        int pos=0;
>   +        int pos;
>   +        int workerCnt;
>
>            if( w== NULL ) {
>                env->l->jkLog(env, env->l, JK_LOG_ERROR,
>   @@ -463,12 +464,27 @@
>            /* It's like disabled */
>            if( level >= JK_LB_LEVELS ) continue;
>
>   -        pos=lb->workerCnt[level]++;
>   +        /* check if worker is already in the table */
>   +        workerCnt = lb->workerCnt[level];
>   +        for(pos = 0 ; pos < workerCnt ; pos++) {
>   +            if( lb->workerTables[level][pos] == w ) {
>   +                break;
>   +            }
>   +        }
>   +
>   +        if( pos == workerCnt ) {
>   +            if( pos == JK_LB_MAX_WORKERS ) {
>   +                env->l->jkLog(env, env->l, JK_LOG_ERROR,
>   +                              "lb_worker.init(): maximum lb
workers reached %s\n", name);
>   +                continue;
>   +            }
>   +            pos=lb->workerCnt[level]++;
>
>   -        lb->workerTables[level][pos]=w;
>   +            lb->workerTables[level][pos]=w;
>
>   -        w->lb_value = w->lb_factor;
>   -        w->in_error_state = JK_FALSE;
>   +            w->lb_value = w->lb_factor;
>   +            w->in_error_state = JK_FALSE;
>   +        }
>        }
>
>        return JK_OK;
>
>
>
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>


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