mturk       2002/10/26 07:46:28

  Modified:    jk/native2/common jk_worker_jni.c jk_vm_default.c
  Log:
  Disable the jni worker and vm if the JVM called abort() in the
  previous child generation. This prevents ifinite loop trying to
  load wrong JVM on multi-process servers.
  
  Revision  Changes    Path
  1.31      +34 -3     jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c
  
  Index: jk_worker_jni.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- jk_worker_jni.c   14 Oct 2002 06:29:53 -0000      1.30
  +++ jk_worker_jni.c   26 Oct 2002 14:46:28 -0000      1.31
  @@ -216,8 +216,8 @@
       jstring stderr_name = NULL;
       jint rc = 0;
       char *str_config = NULL;
  -    jk_map_t *props=_this->workerEnv->initData;
  -    jk_vm_t *vm=_this->workerEnv->vm;
  +    jk_map_t *props;
  +    jk_vm_t *vm;
       jclass jstringClass;
       jarray jargs;
       int i=0;
  @@ -227,12 +227,25 @@
           return JK_ERR;
       }
   
  +    vm = _this->workerEnv->vm;
       if( vm == NULL ) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
                         "workerJni.init() No VM found\n");
           return JK_ERR;
       }
  +    /* XXX Allow only the first child to execute the worker 
  +     * The WM will be shared between processes.
  +    */
  +    if (_this->workerEnv->childId != 0) {
  +        env->l->jkLog(env, env->l, JK_LOG_INFO,
  +                      "workerJni.init() Skipping initialization for process %d 
%d\n",
  +                      _this->workerEnv->childId, _this->workerEnv->childProcessId);
  +                   
  +         _this->lb_disabled = JK_TRUE;        
  +        return JK_OK;
  +    }
       
  +    props=_this->workerEnv->initData;
       jniWorker = _this->worker_private;
       
       if( jniWorker->className==NULL )
  @@ -379,7 +392,7 @@
   {
       jk_worker_t *_this=bean->object;
       jni_worker_data_t *jniWorker;
  -    jk_vm_t *vm=_this->workerEnv->vm;
  +    jk_vm_t *vm;
       JNIEnv *jniEnv;
       jstring cmd_line = NULL;
       jstring stdout_name = NULL;
  @@ -392,6 +405,24 @@
           env->l->jkLog(env, env->l, JK_LOG_EMERG,
                         "In destroy, assert failed - invalid parameters\n");
           return JK_ERR;
  +    }
  +    vm = _this->workerEnv->vm;
  +    
  +    if( vm == NULL ) {
  +        env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                      "jni.destroy() No VM found\n");
  +        return JK_ERR;
  +    }
  +    
  +    /* XXX Allow only the first child to execute the worker 
  +     * The WM will be shared between processes.
  +    */
  +    if (_this->workerEnv->childId != 0) {
  +        env->l->jkLog(env, env->l, JK_LOG_INFO,
  +                      "workerJni.init() Skipping destroying for process %d %d\n",
  +                      _this->workerEnv->childId, _this->workerEnv->childProcessId);
  +                   
  +        return JK_OK;
       }
   
       jniWorker = _this->worker_private;
  
  
  
  1.25      +6 -1      jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c
  
  Index: jk_vm_default.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jk_vm_default.c   25 Oct 2002 06:52:54 -0000      1.24
  +++ jk_vm_default.c   26 Oct 2002 14:46:28 -0000      1.25
  @@ -655,6 +655,12 @@
       jk_vm_t *jkvm;
       jk_workerEnv_t *workerEnv;
       
  +    workerEnv=env->getByName( env, "workerEnv" );
  +    
  +    if (workerEnv->childGeneration > 0) {
  +        result->disabled = 1;
  +        return JK_OK;
  +    }
       jkvm = (jk_vm_t *)pool->calloc(env, pool, sizeof(jk_vm_t ));
   
       jkvm->pool=pool;
  @@ -671,7 +677,6 @@
       result->setAttribute=jk2_jk_vm_setProperty;
       jkvm->mbean=result;
   
  -    workerEnv=env->getByName( env, "workerEnv" );
       jkvm->properties=workerEnv->initData;
   
       workerEnv->vm=jkvm;
  
  
  

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

Reply via email to