costin      02/05/29 10:51:23

  Modified:    jk/native2 build.xml
               jk/native2/common jk_channel_un.c jk_config.c jk_env.c
                        jk_shm.c jk_worker_status.c
               jk/native2/include jk_env.h
               jk/native2/jni jk_jni_aprImpl.c
               jk/native2/server/apache2 mod_jk2.c
  Log:
  A bunch of changes - mostly to get around the shm behavior on HPUX.
  
  On some HPUX-es ( and possibly other platforms ) the mmap will fail if the
  child is mapping the same file. The solution is to map in the parent and
  inherit it in the child. That's what we do - using the top apr pool
  to store a note with the shm pointer.
  
  I also added a command to jkstatus to allow reseting the endpoint counters
  ( for tunning you typically run few 1000s requests to 'warm up' the server,
  and then do the real tests - the jkstatus gives a very good info on how
  much time is spent on server - and how much is in jk versus tomcat )
  
  Revision  Changes    Path
  1.31      +2 -18     jakarta-tomcat-connectors/jk/native2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- build.xml 23 May 2002 23:30:52 -0000      1.30
  +++ build.xml 29 May 2002 17:51:23 -0000      1.31
  @@ -214,23 +214,6 @@
           
           <defineset refid="jk2-defs"/>
   
  -        <!--
  -        <defineset id="jk2-defs">
  -           <define name="_REENTRANT" />
  -           <define name="CHUNK_SIZE" value="4096" />
  -           <define name="USE_APACHE_MD5" />
  -           <define name="HAS_APR" />
  -           <define name="HAVE_JNI" />
  -
  -           <define name="HPUX11" if="hpux" />
  -           <define name="WIN32" if="win32" />
  -           <define name="_WINDOWS" if="win32" />
  -           <define name="_MBCS" if="win32" />
  -           <define name="_USRDLL" if="win32" />
  -           <define name="MOD_JK2_EXPORTS" if="win32" />
  -        </defineset>
  -        -->
  -
           <syslibset libs="libhttpd" if="win32" />
           <syslibset libs="libapr" if="win32" />
           <syslibset libs="libaprutil" if="win32" />
  @@ -318,6 +301,7 @@
         <import fileName="gdi32.lib" if="win32" />
         <import fileName="winspool.lib" if="win32" />
         <import fileName="comdlg32.lib" if="win32" /-->
  +
         <linkOpt value="/libpath:&quot;${apr.lib}&quot;" if="win32" />
         <linkOpt value="/libpath:&quot;${apr-util.lib}&quot;" if="win32" />
         <linkOpt value="/libpath:&quot;${apache2.home}/lib&quot;" if="win32" />
  @@ -379,7 +363,7 @@
         <def name="XP_NETWARE" if="netware"
           info="Building for NetWare platform" />
         <def name="HAS_APR"
  -        info="JNI is no based on APR" />
  +        info="JNI is now based on APR" />
         <def name="HAVE_JNI" />
              
         <import fileName="${novellndk.home}/imports/clib.imp" if="netware" />
  
  
  
  1.9       +0 -1      jakarta-tomcat-connectors/jk/native2/common/jk_channel_un.c
  
  Index: jk_channel_un.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_un.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- jk_channel_un.c   28 May 2002 22:40:25 -0000      1.8
  +++ jk_channel_un.c   29 May 2002 17:51:23 -0000      1.9
  @@ -214,7 +214,6 @@
           */
   
       }
  -    fprintf(stderr, "init %p %d %d\n", socketInfo, socketInfo->listenSocket, 
ch->serverSide );
   
       return rc;
   }
  
  
  
  1.23      +3 -3      jakarta-tomcat-connectors/jk/native2/common/jk_config.c
  
  Index: jk_config.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_config.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- jk_config.c       29 May 2002 00:10:17 -0000      1.22
  +++ jk_config.c       29 May 2002 17:51:23 -0000      1.23
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: General purpose config object                                 *
    * Author:      Gal Shachor <[EMAIL PROTECTED]>                           *
  - * Version:     $Revision: 1.22 $                                           *
  + * Version:     $Revision: 1.23 $                                           *
    ***************************************************************************/
   
   #include "jk_global.h"
  @@ -519,14 +519,14 @@
   
       if( cfg->file==NULL ) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                      "config.update(): No config file" );
  +                      "config.update(): No config file\n" );
           return JK_ERR;
       }
   
       rc=stat(cfg->file, &statbuf);
       if (rc == -1) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                      "config.update(): Can't find config file %s", cfg->file );
  +                      "config.update(): Can't find config file %s\n", cfg->file );
           return JK_ERR;
       }
       
  
  
  
  1.32      +8 -1      jakarta-tomcat-connectors/jk/native2/common/jk_env.c
  
  Index: jk_env.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_env.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- jk_env.c  29 May 2002 00:10:17 -0000      1.31
  +++ jk_env.c  29 May 2002 17:51:23 -0000      1.32
  @@ -58,7 +58,9 @@
   #include "jk_global.h"
   #include "jk_env.h"
   #include "jk_objCache.h"
  +#ifdef HAS_APR
   #include "apr_general.h"
  +#endif
   
   jk_env_t *jk_env_globalEnv;
   void *jkGlobalAprPool;
  @@ -96,6 +98,10 @@
   #endif
   }
   
  +static void JK_METHOD jk2_env_setAprPool( jk_env_t *env, void *aprPool ) {
  +    jkGlobalAprPool=aprPool;
  +}
  +
   /** Public method, creates/get the global env
    */
   jk_env_t* JK_METHOD jk2_env_getEnv( char *id, jk_pool_t *pool ) {
  @@ -136,6 +142,7 @@
           env->jkClearException=parentEnv->jkClearException;
           env->jkException=parentEnv->jkException;
           env->getAprPool=parentEnv->getAprPool;
  +        env->setAprPool=parentEnv->setAprPool;
       
           env->_registry=parentEnv->_registry;
           env->_objects=parentEnv->_objects;
  @@ -312,7 +319,6 @@
       
       for( i=jk_env_globalEnv->_objects->size( env, jk_env_globalEnv->_objects ) - 1; 
i>=0 ; i-- ) {
           if( jk_env_globalEnv->_objects->valueAt( env, jk_env_globalEnv->_objects, i 
) == result ) {
  -            fprintf( stderr, "Component id %s= %d\n", result->name, i );
               result->objId=i;
               break;
           }
  @@ -495,6 +501,7 @@
       env->jkClearException=jk_env_jkClearException;
       env->jkException=jk_env_jkException;
       env->getAprPool=jk2_env_getAprPool;
  +    env->setAprPool=jk2_env_setAprPool;
   
       env->id=0;
       
  
  
  
  1.21      +22 -2     jakarta-tomcat-connectors/jk/native2/common/jk_shm.c
  
  Index: jk_shm.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_shm.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- jk_shm.c  28 May 2002 22:46:00 -0000      1.20
  +++ jk_shm.c  29 May 2002 17:51:23 -0000      1.21
  @@ -120,6 +120,22 @@
       if( globalShmPool==NULL )
           return JK_FALSE;
   
  +    /* Check if the scoreboard is in a note. That's the only way we
  +       can get HP-UX to work
  +    */
  +    apr_pool_userdata_get( & shm->image, "mod_jk_shm",globalShmPool );
  +    if( shm->image!=NULL ) {
  +        shm->head = (jk_shm_head_t *)shm->image;
  +
  +        env->l->jkLog(env, env->l, JK_LOG_ERROR, 
  +                      "shm.create(): GLOBAL_SHM  %p\n", shm->image );
  +        fprintf( stderr, "GLOBAL SHM: %p\n", shm->image );
  +        return JK_OK;
  +    } else {
  +        env->l->jkLog(env, env->l, JK_LOG_ERROR, 
  +                      "shm.create(): NO GLOBAL_SHM  %p\n", shm->image );
  +    }
  +    
   
       /* First make sure the file exists and is big enough
        */
  @@ -180,14 +196,18 @@
           apr_strerror( rc, error, 256 );
           
           env->l->jkLog(env, env->l, JK_LOG_ERROR, 
  -                      "shm.create(): error attaching shm, will create %s %d %p 
%s\n",
  -                      shm->fname, rc, globalShmPool, error );
  +                      "shm.create(): error creating %s %d %d %p %s\n",
  +                      shm->fname, finfo.size, rc, globalShmPool, error );
           shm->privateData=NULL;
           return rc;
       }
   
       shm->privateData=aprMmap;
  +
       apr_mmap_offset(& shm->image, aprMmap, (apr_off_t)0);
  +
  +    apr_pool_userdata_set( shm->image, "mod_jk_shm", NULL, globalShmPool );
  +        
       shm->head = (jk_shm_head_t *)shm->image;
   
       if( shm->image==NULL ) {
  
  
  
  1.25      +47 -4     jakarta-tomcat-connectors/jk/native2/common/jk_worker_status.c
  
  Index: jk_worker_status.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_status.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jk_worker_status.c        19 May 2002 21:40:09 -0000      1.24
  +++ jk_worker_status.c        29 May 2002 17:51:23 -0000      1.25
  @@ -209,6 +209,8 @@
   
       s->jkprintf(env, s, "<h2>Scoreboard info (ver=%d slots=%d)</h2>\n", 
                   wenv->shm->head->lbVer, wenv->shm->head->lastSlot );
  +
  +    s->jkprintf(env, s, "<a href='jkstatus?scoreboard.reset'>reset</a>\n");
                   
       s->jkprintf(env, s, "<table border>\n");
   
  @@ -236,9 +238,9 @@
               /* XXX Add info about number of slots */
               for( j=0; j<slot->structCnt ; j++ ) {
                   jk_stat_t *statArray=(jk_stat_t *)data;
  -                jk_stat_t stat=statArray[j];
  +                jk_stat_t *stat=statArray + j;
                                
  -                jk2_worker_status_displayStat( env, s, &stat,
  +                jk2_worker_status_displayStat( env, s, stat,
                                                  &totalReq, &totalErr, &totalTime, 
&maxTime);
               }
   
  @@ -283,7 +285,8 @@
               s->jkprintf(env, s, "<p>%s information, using getAttribute() </p>\n", 
type);
               
               s->jkprintf(env, s, "<table border>\n");
  -            s->jkprintf(env, s, "<tr><th>name</th>\n");
  +            s->jkprintf(env, s, "<tr><th>id</th>\n");
  +            s->jkprintf(env, s, "<th>name</th>\n");
               for( j=0; mbean->getAttributeInfo[j] != NULL; j++ ) {
                   char *pname=mbean->getAttributeInfo[j];
                   
  @@ -292,7 +295,7 @@
               needHeader = JK_FALSE;
           } 
           
  -        s->jkprintf(env, s, "</tr><tr><td>%s</td>\n", mbean->localName);
  +        s->jkprintf(env, s, "</tr><tr><td>%d</td><td>%s</td>\n", mbean->id, 
mbean->localName);
           for( j=0; mbean->getAttributeInfo[j] != NULL; j++ ) {
               char *pname=mbean->getAttributeInfo[j];
   
  @@ -305,6 +308,42 @@
       }
   }
   
  +static void jk2_worker_status_resetScoreboard(jk_env_t *env, jk_ws_service_t *s,
  +                                              jk_workerEnv_t *wenv)
  +{
  +    int i, j;
  +    
  +    if( wenv->shm==NULL || wenv->shm->head==NULL) {
  +        return;
  +    }
  +    
  +    for( i=1; i < wenv->shm->head->lastSlot; i++ ) {
  +        jk_shm_slot_t *slot= wenv->shm->getSlot( env, wenv->shm, i );
  +        
  +        if( slot==NULL ) continue;
  +        
  +        if( strncmp( slot->name, "epStat", 6 ) == 0 ) {
  +            /* This is an endpoint slot */
  +            void *data=slot->data;
  +
  +            for( j=0; j<slot->structCnt ; j++ ) {
  +                jk_stat_t *statArray=(jk_stat_t *)data;
  +                jk_stat_t *stat=statArray + j;
  +
  +                stat->reqCnt=0;
  +                stat->errCnt=0;
  +#ifdef HAS_APR
  +                stat->totalTime=0;
  +                stat->maxTime=0;
  +#endif
  +                env->l->jkLog(env, env->l, JK_LOG_INFO, "reset() %s %p %p %p %d %d 
%d %d\n",
  +                              slot->name, data, statArray, stat, i, j, 
stat->reqCnt, stat->errCnt );
  +            }
  +        }
  +    }
  +    
  +}
  +
   /** That's the 'bulk' data - everything that was configured, after substitution
    */
   static void jk2_worker_status_displayActiveProperties(jk_env_t *env, 
jk_ws_service_t *s,
  @@ -396,6 +435,10 @@
        */
       if( s->query_string == NULL ) {
           s->query_string="get=*";
  +    }
  +
  +    if( strcmp( s->query_string, "scoreboard.reset" ) == 0 ) {
  +        jk2_worker_status_resetScoreboard(env, s, s->workerEnv );
       }
   
       w->workerEnv->config->update( env, w->workerEnv->config, &didUpdate );
  
  
  
  1.18      +1 -0      jakarta-tomcat-connectors/jk/native2/include/jk_env.h
  
  Index: jk_env.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_env.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- jk_env.h  29 May 2002 00:10:18 -0000      1.17
  +++ jk_env.h  29 May 2002 17:51:23 -0000      1.18
  @@ -222,6 +222,7 @@
       /** If APR is used, return a global pool
        */
       void *(JK_METHOD *getAprPool)(jk_env_t *env );
  +    void (JK_METHOD *setAprPool)(jk_env_t *env, void *aprPool );
       
       /* private */
       struct jk_map *_registry;
  
  
  
  1.28      +2 -2      jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c
  
  Index: jk_jni_aprImpl.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jni_aprImpl.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- jk_jni_aprImpl.c  29 May 2002 00:10:18 -0000      1.27
  +++ jk_jni_aprImpl.c  29 May 2002 17:51:23 -0000      1.28
  @@ -134,7 +134,7 @@
   
           env->l=jkb->object;
           env->l->name="stderr";
  -        env->l->level=JK_LOG_DEBUG_LEVEL;
  +        env->l->level=JK_LOG_INFO_LEVEL;
           env->alias( env, "logger.file:", "logger");
   
           jkb=env->createBean2( env, env->globalPool,"workerEnv", "");
  @@ -565,7 +565,7 @@
           return JK_ERR;
       }
   
  -    env->l->jkLog(env, env->l, JK_LOG_INFO,
  +    env->l->jkLog(env, env->l, JK_LOG_DEBUG,
                     "jkInvoke() component dispatch %d %d %p\n", rc, code, 
bean->invoke);
   
       if( bean->invoke != NULL ) {
  
  
  
  1.28      +4 -2      jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c
  
  Index: mod_jk2.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- mod_jk2.c 29 May 2002 14:30:07 -0000      1.27
  +++ mod_jk2.c 29 May 2002 17:51:23 -0000      1.28
  @@ -59,7 +59,7 @@
    * Description: Apache 2 plugin for Jakarta/Tomcat                         *
    * Author:      Gal Shachor <[EMAIL PROTECTED]>                           *
    *                 Henri Gomez <[EMAIL PROTECTED]>                               *
  - * Version:     $Revision: 1.27 $                                           *
  + * Version:     $Revision: 1.28 $                                           *
    ***************************************************************************/
   
   /*
  @@ -444,11 +444,13 @@
       
       rc=jk2_apache2_isValidating( plog, &gPool );
   
  +    env->setAprPool(env, gPool);
  +    fprintf( stderr, "XXX Gpool %p\n", gPool );
  +    
       if( rc == JK_OK && gPool != NULL ) {
           /* This is the first step */
           env->l->jkLog(env, env->l, JK_LOG_INFO,
                         "mod_jk.post_config() first invocation\n");
  -        
           
           apr_pool_userdata_set( "INITOK", "mod_jk_init", NULL, gPool );
           return OK;
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to