tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hgo...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_service.h
Date Mon, 23 Feb 2004 15:44:26 GMT
hgomez      2004/02/23 07:44:26

  Modified:    jk/native2 CHANGES.txt
               jk/native2/common jk_workerEnv.c jk_worker_ajp13.c
               jk/native2/include jk_service.h
  Log:
  Port jk recovery strategy.
  
  Need review and more tests
  
  Revision  Changes    Path
  1.13      +2 -1      jakarta-tomcat-connectors/jk/native2/CHANGES.txt
  
  Index: CHANGES.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/CHANGES.txt,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CHANGES.txt	23 Feb 2004 13:57:27 -0000	1.12
  +++ CHANGES.txt	23 Feb 2004 15:44:26 -0000	1.13
  @@ -11,6 +11,7 @@
       * Make default port configurable (9009 on Netware, 8009 elsewhere)
       * Fix problem when in Load-Balancing and POST [Henri Gomez].
       * Add recovery_opts (recovery strategy) which help make POST recovery configurable
[Henri Gomez].
  +    
   Changes with JK2 2.0.4:
       * Added the load balancer stickySession property. If set to 0
         requests with servlet SESSION ID's can be routed to any Tomcat
  
  
  
  1.63      +27 -10    jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c
  
  Index: jk_workerEnv.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- jk_workerEnv.c	25 Sep 2003 15:23:22 -0000	1.62
  +++ jk_workerEnv.c	23 Feb 2004 15:44:26 -0000	1.63
  @@ -468,7 +468,7 @@
       int rc;
       jk_handler_t **handlerTable=wEnv->handlerTable;
       int maxHandler=wEnv->lastMessageId;
  -
  +	int headeratclient=JK_FALSE;
       ep->currentRequest=req;
       
       /* Process reply - this is the main loop */
  @@ -484,15 +484,27 @@
                             ep->worker->channel->mbean->name);
           
           msg->reset(env, msg);
  -        
  +
  +		/* Check for reply in timeout */
  +		if ( ep->worker->reply_timeout != 0) {
  +		    if (ep->worker->channel->hasinput(env, ep->worker->channel, ep, ep->worker->reply_timeout)
!= JK_TRUE) {
  +	        	env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +	                      "workerEnv.processCallbacks() no reply after %d ms waiting\n", timeout);
  +	
  +	        	return JK_ERR;
  +	    	}
  +	    }
  +
           rc= ep->worker->channel->recv( env, ep->worker->channel,  ep,
                                          msg);
           if( rc!=JK_OK ) {
               env->l->jkLog(env, env->l, JK_LOG_ERROR,
                             "workerEnv.processCallbacks() Error reading reply\n");
  -            /* It may be the first receive, let the caller decide if it's ok to retry
  -             */
  -            /* ep->recoverable=JK_FALSE; */
  +
  +            /* Error is unrecoverable if tomcat failed (Tomcat allready got request) */
  +            if (ep->worker->recovery_opts & RECOVER_ABORT_IF_TCGETREQUEST)
  +                ep->recoverable=JK_FALSE;
  +                
               return rc;
           }
   
  @@ -537,16 +549,21 @@
                                              msg );
               if (rc < 0) {
                   env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                              "ajp14.processCallbacks() error sending response data\n");
  +                              "workerEnv.processCallbacks() error sending response data\n");
                   ep->recoverable = JK_FALSE;
                   return rc;
               }
               break;
           case JK_HANDLER_ERROR:
               /* Normal error ( for example writing to the client failed ).
  -             * The ajp connection is still in a stable state.
  +             * The ajp connection is still in a stable state but if by configuration
  +             * recoveryOpts is to 1 or 3, we should mark it at unrecoverable.
                */
  -            ep->recoverable = JK_TRUE;
  +            if (ep->worker->recovery_opts & RECOVER_ABORT_IF_TCSENDHEADER)
  +            	ep->recoverable = JK_FALSE;
  +            else
  +            	ep->recoverable = JK_TRUE;
  +            
               return rc;
           case JK_HANDLER_FATAL:
               /*
  @@ -557,7 +574,7 @@
           default:
               /* Unknown status */
               env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                          "ajp14.processCallbacks() unknonwn status %d\n", rc);
  +                          "workerEnv.processCallbacks() unknown status %d\n", rc);
               ep->recoverable = JK_FALSE; 
               return rc;
           }
  
  
  
  1.57      +2 -2      jakarta-tomcat-connectors/jk/native2/common/jk_worker_ajp13.c
  
  Index: jk_worker_ajp13.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_ajp13.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- jk_worker_ajp13.c	23 Feb 2004 13:57:27 -0000	1.56
  +++ jk_worker_ajp13.c	23 Feb 2004 15:44:26 -0000	1.57
  @@ -123,7 +123,7 @@
           return jk2_env_itoa( env, worker->reply_timeout);
       } else if (strcmp( name, "prepostTimeout" )==0 ) {
           return jk2_env_itoa( env, worker->prepost_timeout);
  -    } else if (strcmp( name, "recovery_opts" )==0 ) {
  +    } else if (strcmp( name, "recoveryOpts" )==0 ) {
           return jk2_env_itoa( env, worker->recovery_opts);
       } else if (strcmp( name, "disabled" )==0 ) {
           return jk2_env_itoa( env, bean->disabled );
  @@ -162,7 +162,7 @@
           ajp13->reply_timeout=atoi( value );
       } else if( strcmp( name, "prepostTimeout" )==0 ) {
           ajp13->prepost_timeout=atoi( value );
  -    } else if( strcmp( name, "recovery_opts" )==0 ) {
  +    } else if( strcmp( name, "recoveryOpts" )==0 ) {
           ajp13->recovery_opts=atoi( value );
       } else if( strcmp( name, "disabled" )==0 ) {
           mbean->disabled=atoi( value );
  
  
  
  1.22      +13 -1     jakarta-tomcat-connectors/jk/native2/include/jk_service.h
  
  Index: jk_service.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_service.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- jk_service.h	13 Feb 2004 08:40:42 -0000	1.21
  +++ jk_service.h	23 Feb 2004 15:44:26 -0000	1.22
  @@ -140,6 +140,18 @@
   #define RECO_INITED	0x01
   #define RECO_FILLED	0x02
   
  +/*
  + * RECOVERY STRATEGY
  + *
  + * The recovery strategy determine how web-server will handle tomcat crash after POST error.
  + * By default, we use the current strategy, which is to resend request to next tomcat.
  + * To abort if tomcat failed after receiving request, recovers_opts should be 1 or 3
  + * To abort if tomcat failed after sending headers to client, recovers_opts should be 2
or 3
  + */
  +
  +#define RECOVER_ABORT_IF_TCGETREQUEST  	 0x0001	/* DONT RECOVER IF TOMCAT FAIL AFTER RECEIVING
REQUEST */
  +#define RECOVER_ABORT_IF_TCSENDHEADER    0x0002	/* DONT RECOVER IF TOMCAT FAIL AFTER SENDING
HEADERS */
  +
       
   /*
    * The web server service 'class'.  An instance of this class is created
  
  
  

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


Mime
View raw message