tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: svn commit: r611696 - in /tomcat/connectors/trunk/jk: native/apache-1.3/ native/apache-2.0/ native/common/ xdocs/generic_howto/ xdocs/miscellaneous/ xdocs/reference/
Date Mon, 14 Jan 2008 11:19:34 GMT
Hi Peter,

sometimes the nice things are the easy ones :)

In fact I *don't* want to open a can of worms by letting the web server 
overwrite many worker attributes, but reply_timeout is the one with a 
very strong dependency on the URL. All others, except maybe for 
fail_on_status are not really request dependant.

Have fun!

Rainer

Peter Rossbach schrieb:
> Hi Rainer,
> 
> many thanks for that cool feature ;-)
> 
> Peter
> 
> 
> Am 14.01.2008 um 03:28 schrieb rjung@apache.org:
> 
>> Author: rjung
>> Date: Sun Jan 13 18:28:27 2008
>> New Revision: 611696
>>
>> URL: http://svn.apache.org/viewvc?rev=611696&view=rev
>> Log:
>> Allow dynamic setting of reply timeout using the httpd environment
>> variable JK_REPLY_TIMEOUT.
>>
>> Modified:
>>     tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
>>     tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
>>     tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
>>     tomcat/connectors/trunk/jk/native/common/jk_service.h
>>     tomcat/connectors/trunk/jk/native/common/jk_util.c
>>     tomcat/connectors/trunk/jk/xdocs/generic_howto/timeouts.xml
>>     tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
>>     tomcat/connectors/trunk/jk/xdocs/reference/workers.xml
>>
>> Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?rev=611696&r1=611695&r2=611696&view=diff

>>
>> ============================================================================== 
>>
>> --- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
>> +++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Sun Jan 13 
>> 18:28:27 2008
>> @@ -70,6 +70,7 @@
>>  #define JK_ENV_SESSION              ("SSL_SESSION_ID")
>>  #define JK_ENV_KEY_SIZE             ("SSL_CIPHER_USEKEYSIZE")
>>  #define JK_ENV_CERTCHAIN_PREFIX     ("SSL_CLIENT_CERT_CHAIN_")
>> +#define JK_ENV_REPLY_TIMEOUT        ("JK_REPLY_TIMEOUT")
>>  #define JK_ENV_WORKER_NAME          ("JK_WORKER_NAME")
>>  #define JK_NOTE_WORKER_NAME         ("JK_WORKER_NAME")
>>  #define JK_NOTE_WORKER_TYPE         ("JK_WORKER_TYPE")
>> @@ -610,6 +611,7 @@
>>      int size;
>>      request_rec *r = private_data->r;
>>      char *ssl_temp = NULL;
>> +    const char *reply_timeout = NULL;
>>
>>      /* Copy in function pointers (which are really methods) */
>>      s->start_response = ws_start_response;
>> @@ -639,6 +641,10 @@
>>          s->flush_packets = 1;
>>      if (conf->options & JK_OPT_FLUSHEADER)
>>          s->flush_header = 1;
>> +
>> +    reply_timeout = apr_table_get(r->subprocess_env, 
>> "JK_REPLY_TIMEOUT");
>> +    if (reply_timeout)
>> +        s->reply_timeout = atoi(reply_timeout);
>>
>>      if (conf->options & JK_OPT_DISABLEREUSE)
>>          s->disable_reuse = 1;
>>
>> Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?rev=611696&r1=611695&r2=611696&view=diff

>>
>> ============================================================================== 
>>
>> --- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
>> +++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Sun Jan 13 
>> 18:28:27 2008
>> @@ -112,6 +112,7 @@
>>  #define JK_ENV_SESSION              ("SSL_SESSION_ID")
>>  #define JK_ENV_KEY_SIZE             ("SSL_CIPHER_USEKEYSIZE")
>>  #define JK_ENV_CERTCHAIN_PREFIX     ("SSL_CLIENT_CERT_CHAIN_")
>> +#define JK_ENV_REPLY_TIMEOUT        ("JK_REPLY_TIMEOUT")
>>  #define JK_ENV_WORKER_NAME          ("JK_WORKER_NAME")
>>  #define JK_NOTE_WORKER_NAME         ("JK_WORKER_NAME")
>>  #define JK_NOTE_WORKER_TYPE         ("JK_WORKER_TYPE")
>> @@ -621,10 +622,10 @@
>>  static int init_ws_service(apache_private_data_t * private_data,
>>                             jk_ws_service_t *s, jk_server_conf_t * conf)
>>  {
>> +    int size;
>>      request_rec *r = private_data->r;
>> -
>>      char *ssl_temp = NULL;
>> -    int size;
>> +    const char *reply_timeout = NULL;
>>
>>      /* Copy in function pointers (which are really methods) */
>>      s->start_response = ws_start_response;
>> @@ -652,6 +653,10 @@
>>          s->flush_packets = 1;
>>      if (conf->options & JK_OPT_FLUSHEADER)
>>          s->flush_header = 1;
>> +
>> +    reply_timeout = apr_table_get(r->subprocess_env, 
>> "JK_REPLY_TIMEOUT");
>> +    if (reply_timeout)
>> +        s->reply_timeout = atoi(reply_timeout);
>>
>>      if (conf->options & JK_OPT_DISABLEREUSE)
>>          s->disable_reuse = 1;
>>
>> Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=611696&r1=611695&r2=611696&view=diff

>>
>> ============================================================================== 
>>
>> --- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
>> +++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sun Jan 
>> 13 18:28:27 2008
>> @@ -1815,10 +1815,14 @@
>>      /* Start read all reply message */
>>      while (1) {
>>          int rc = 0;
>> +        /* Allow to overwrite reply_timeout on a per URL basis via 
>> service struct */
>> +        int reply_timeout = s->reply_timeout;
>>
>> +        if (reply_timeout < 0)
>> +            reply_timeout = p->worker->reply_timeout;
>>          /* If we set a reply timeout, check if something is available */
>> -        if (p->worker->reply_timeout > 0) {
>> -            if (jk_is_input_event(p->sd, p->worker->reply_timeout, l) ==
>> +        if (reply_timeout > 0) {
>> +            if (jk_is_input_event(p->sd, reply_timeout, l) ==
>>                  JK_FALSE) {
>>                  p->last_errno = errno;
>>                  jk_log(l, JK_LOG_ERROR,
>>
>> Modified: tomcat/connectors/trunk/jk/native/common/jk_service.h
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_service.h?rev=611696&r1=611695&r2=611696&view=diff

>>
>> ============================================================================== 
>>
>> --- tomcat/connectors/trunk/jk/native/common/jk_service.h (original)
>> +++ tomcat/connectors/trunk/jk/native/common/jk_service.h Sun Jan 13 
>> 18:28:27 2008
>> @@ -222,6 +222,11 @@
>>      int flush_header;
>>
>>      /*
>> +     * If >= 0, overwrite the worker reply_timeout
>> +     */
>> +    int reply_timeout;
>> +
>> +    /*
>>       * JK_TRUE if response headers have been sent back
>>       */
>>      int response_started;
>>
>> Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?rev=611696&r1=611695&r2=611696&view=diff

>>
>> ============================================================================== 
>>
>> --- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
>> +++ tomcat/connectors/trunk/jk/native/common/jk_util.c Sun Jan 13 
>> 18:28:27 2008
>> @@ -1867,6 +1867,7 @@
>>      s->reco_status = RECO_NONE;
>>      s->flush_packets = JK_FALSE;
>>      s->flush_header = JK_FALSE;
>> +    s->reply_timeout = -1;
>>      s->response_started = JK_FALSE;
>>      s->http_response_status = JK_HTTP_OK;
>>      s->uw_map = NULL;
>>
>> Modified: tomcat/connectors/trunk/jk/xdocs/generic_howto/timeouts.xml
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/generic_howto/timeouts.xml?rev=611696&r1=611695&r2=611696&view=diff

>>
>> ============================================================================== 
>>
>> --- tomcat/connectors/trunk/jk/xdocs/generic_howto/timeouts.xml 
>> (original)
>> +++ tomcat/connectors/trunk/jk/xdocs/generic_howto/timeouts.xml Sun 
>> Jan 13 18:28:27 2008
>> @@ -248,6 +248,17 @@
>>  millisecond value.
>>  </p>
>>  <p>
>> +In combination with Apache httpd, you can also set a more flexible 
>> reply_timeout
>> +using an httpd environment variable. If you set the variable 
>> JK_REPLY_TIMEOUT
>> +to some integer value, this value will be used instead of the value in
>> +the worker configuration. This way you can set reply timeouts more 
>> flexible
>> +with mod_setenvif and mod_rewrite depending on URI, query string etc.
>> +If the environment variable JK_REPLY_TIMEOUT is not set, or is set to a
>> +negative value, the default reply timeout of the worker will be used. If
>> +JK_REPLY_TIMEOUT contains the value "0", then the reply timeout will 
>> be disabled
>> +for the request.
>> +</p>
>> +<p>
>>  In combination with a load balancing worker, JK will disable a member
>>  worker of the load balancer if a reply timeout fires. The worker will 
>> then
>>  no longer be used until it gets recovered during the next automatic
>>
>> Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?rev=611696&r1=611695&r2=611696&view=diff

>>
>> ============================================================================== 
>>
>> --- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml 
>> (original)
>> +++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun 
>> Jan 13 18:28:27 2008
>> @@ -44,6 +44,10 @@
>>    <subsection name="Native">
>>      <changelog>
>>        <update>
>> +        Apache: Allow dynamic setting of reply timeout using the 
>> environment
>> +        variable JK_REPLY_TIMEOUT. (rjung)
>> +      </update>
>> +      <update>
>>          Status: Add manageability for ajp parameters of ajp
>>          workers and ajp lb members. (rjung)
>>        </update>
>>
>> Modified: tomcat/connectors/trunk/jk/xdocs/reference/workers.xml
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/workers.xml?rev=611696&r1=611695&r2=611696&view=diff

>>
>> ============================================================================== 
>>
>> --- tomcat/connectors/trunk/jk/xdocs/reference/workers.xml (original)
>> +++ tomcat/connectors/trunk/jk/xdocs/reference/workers.xml Sun Jan 13 
>> 18:28:27 2008
>> @@ -658,8 +658,12 @@
>>  If you set a reply_timeout, adjust it carefully if you have long 
>> running servlets.
>>  </p>
>>  <p>
>> +The reply_timeout can be overwritten using the Apache httpd 
>> environment variable
>> +JK_REPLY_TIMEOUT.
>> +</p>
>> +<p>
>>  This features has been added in <b>jk 1.2.6</b> to avoid problem with

>> hung Tomcat's and works on all
>> -servlet engines supporting ajp13.
>> +servlet engines supporting ajp13. The variable JK_REPLY_TIMEOUT has 
>> been added in version 1.2.27.
>>  </p>
>>  </directive>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>>
> 
> 

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


Mime
View raw message