cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_jni.c jk_vm_default.c jk_channel_jni.c

2002-11-06 Thread mturk
mturk   2002/11/06 08:32:25

  Modified:jk/native2/common jk_worker_jni.c jk_vm_default.c
jk_channel_jni.c
  Log:
  Fix the JNI disabling for multi-process servers, moving disabled from
  factory to the init.
  Also, check if the JVM aborted.
  
  Revision  ChangesPath
  1.33  +9 -9  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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- jk_worker_jni.c   31 Oct 2002 11:55:36 -  1.32
  +++ jk_worker_jni.c   6 Nov 2002 16:32:25 -   1.33
   -234,6 +234,15 
   return JK_ERR;
   }
   
  +/* Allow only the first child to execute the worker */
  +if (_this-workerEnv-childId != 0) {
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  workerJni.Init() Skipping initialization for the %d %d\n,
  +  _this-workerEnv-childId, 
  +  _this-workerEnv-childProcessId);
  +return JK_ERR;
  +}
  +
   props=_this-workerEnv-initData;
   jniWorker = _this-worker_private;
   
   -462,15 +471,6 
   }
   
   wEnv = env-getByName( env, workerEnv );
  -/* Allow only the first child to execute the worker */
  -if (wEnv-childId != 0) {
  -env-l-jkLog(env, env-l, JK_LOG_INFO,
  -  workerJni.factory() Skipping initialization for the %d %d\n,
  -  wEnv-childId, wEnv-childProcessId);
  -result-disabled = 1;  
  -return JK_OK;
  -}
  -
   
   /* No singleton - you can have multiple jni workers,
running different bridges or starting different programs inprocess*/
  
  
  
  1.27  +9 -4  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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- jk_vm_default.c   31 Oct 2002 11:55:36 -  1.26
  +++ jk_vm_default.c   6 Nov 2002 16:32:25 -   1.27
   -193,14 +193,18 
   {
   jk2_jni_error_signaled = JK_TRUE;
   jk2_jni_error_code = code;
  -
  +
  +#ifdef DEBUG
   fprintf(stderr, JVM error hook called %d\n, code);
  +#endif
   }
   
   static void jk2_jni_abort_hook()
   {
   jk2_jni_abort_signaled = JK_TRUE;
  +#ifdef DEBUG
   fprintf(stderr, JVM abort hook\n);
  +#endif
   } 
   
   /** Load the VM. Must be called after init.
   -276,7 +280,8 
   int err;
   JavaVM *jvm = (JavaVM *)jkvm-jvm;
   
  - if( jvm == NULL ) return NULL;
  + if (jvm == NULL || jk2_jni_abort_signaled)
  + return NULL;
   
   #if defined LINUX  defined APACHE2_SIGHACK
   /* [V] This message is important. If there are signal mask issues,*
   -324,7 +329,7 
   int err;
   JavaVM *jvm = (JavaVM *)jkvm-jvm;
   
  -if( jvm == NULL ) {
  +if (jvm == NULL || jk2_jni_abort_signaled) {
   return;
   }
   
   -608,7 +613,7 
   int err;
   JavaVM *jvm = (JavaVM *)jkvm-jvm;
   
  -if( jvm == NULL ) {
  +if (jvm == NULL || jk2_jni_abort_signaled) {
   return;
   }
   
  
  
  
  1.37  +5 -5  jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c
  
  Index: jk_channel_jni.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- jk_channel_jni.c  31 Oct 2002 11:55:36 -  1.36
  +++ jk_channel_jni.c  6 Nov 2002 16:32:25 -   1.37
   -129,6 +129,11 
   jk_channel_t *jniW=jniWB-object;
   jk_workerEnv_t *wEnv=jniW-workerEnv;
   
  +if (wEnv-childId != 0) {
  +if( jniW-worker != NULL )
  +jniW-worker-mbean-disabled=JK_TRUE;
  +return JK_ERR;
  +}
   if( wEnv-vm == NULL ) {
   env-l-jkLog(env, env-l, JK_LOG_INFO,
 channel_jni.init() no VM found\n );
   -628,11 +633,6 
   
   
   wEnv = env-getByName( env, workerEnv );
  -if (wEnv-childId != 0) {
  -result-disabled = 1;  
  -return JK_OK;
  -}
  -
   ch=(jk_channel_t *)pool-calloc(env, pool, sizeof( jk_channel_t));
   
   ch-recv= jk2_channel_jni_recv;
  
  
  

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




cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_jni.c jk_vm_default.c jk_channel_jni.c

2002-10-31 Thread mturk
mturk   2002/10/31 03:55:36

  Modified:jk/native2/common jk_worker_jni.c jk_vm_default.c
jk_channel_jni.c
  Log:
  Fix the disabling of the JNI in the multiprocess servers.
  Question: Can we disable the JNI if there is more then one child process?
  
  Revision  ChangesPath
  1.32  +14 -24jakarta-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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- jk_worker_jni.c   26 Oct 2002 14:46:28 -  1.31
  +++ jk_worker_jni.c   31 Oct 2002 11:55:36 -  1.32
   -233,17 +233,6 
 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;
   -414,17 +403,6 
   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;
   
   if (jniWorker-hook  JK2_WORKER_HOOK_CLOSE) {
   -475,13 +453,25 
   {
   jk_worker_t *_this;
   jni_worker_data_t *jniData;
  -
  +jk_workerEnv_t *wEnv;
  +
   if(name==NULL) {
   env-l-jkLog(env, env-l, JK_LOG_EMERG, 
 jni.factory() NullPointerException name==null\n);
   return JK_ERR;
   }
   
  +wEnv = env-getByName( env, workerEnv );
  +/* Allow only the first child to execute the worker */
  +if (wEnv-childId != 0) {
  +env-l-jkLog(env, env-l, JK_LOG_INFO,
  +  workerJni.factory() Skipping initialization for the %d %d\n,
  +  wEnv-childId, wEnv-childProcessId);
  +result-disabled = 1;  
  +return JK_OK;
  +}
  +
  +
   /* No singleton - you can have multiple jni workers,
running different bridges or starting different programs inprocess*/
   
   -513,7 +503,7 
   result-setAttribute = jk2_jni_worker_setProperty;
   _this-mbean=result;
   
  -_this-workerEnv=env-getByName( env, workerEnv );
  +_this-workerEnv = wEnv;
   _this-workerEnv-addWorker( env, _this-workerEnv, _this );
   
   return JK_OK;
  
  
  
  1.26  +4 -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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- jk_vm_default.c   26 Oct 2002 14:46:28 -  1.25
  +++ jk_vm_default.c   31 Oct 2002 11:55:36 -  1.26
   -657,7 +657,10 
   
   workerEnv=env-getByName( env, workerEnv );
   
  -if (workerEnv-childGeneration  0) {
  +/* TODO: use timeframe for child generation
  + * 
  +*/
  +if (workerEnv-childGeneration  10) {
   result-disabled = 1;
   return JK_OK;
   }
  
  
  
  1.36  +7 -1  jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c
  
  Index: jk_channel_jni.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- jk_channel_jni.c  26 Sep 2002 10:39:57 -  1.35
  +++ jk_channel_jni.c  31 Oct 2002 11:55:36 -  1.36
   -626,6 +626,13 
   jk_workerEnv_t *wEnv;
   jk_channel_jni_private_t *jniPrivate;
   
  +
  +wEnv = env-getByName( env, workerEnv );
  +if (wEnv-childId != 0) {
  +result-disabled = 1;  
  +return JK_OK;
  +}
  +
   ch=(jk_channel_t *)pool-calloc(env, pool, sizeof( jk_channel_t));
   
   ch-recv= jk2_channel_jni_recv;
   -649,7 +656,6 
   result-object= ch;
   result-init= jk2_channel_jni_init; 
   
  -

cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_jni.c jk_vm_default.c

2002-10-26 Thread mturk
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  ChangesPath
  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 -  1.30
  +++ jk_worker_jni.c   26 Oct 2002 14:46:28 -  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 -  1.24
  +++ jk_vm_default.c   26 Oct 2002 14:46:28 -  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