Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_mt.h jk_util.c

2004-11-12 Thread NormW
Mladen Turk wrote:
NormW wrote:
+#if !defined(__NOVELL_LIBC__)
+#define getpid()   ((pid_t)GetThreadGroupID())
+#endif

Committed, thanks!
Can you confirm that we can compile on Netware now?
Regards,
Mladen.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.
Good morning,
Pleased to advise that all builds fine for NetWare with AP1.3,3.0 and 2.1.
Any progress on some docs? Would like to start some testing in earnest.
Regards,
Norm
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


DO NOT REPLY [Bug 32211] - tomcat-5.0 realm-howto refers to Tomcat 4

2004-11-12 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32211

tomcat-5.0 realm-howto refers to Tomcat 4

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||WONTFIX



--- Additional Comments From [EMAIL PROTECTED]  2004-11-12 19:42 ---
For documentation fixes, please post one email with a patch on tomcat-dev.
Please don't file 20 bugs.

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



DO NOT REPLY [Bug 32211] New: - tomcat-5.0 realm-howto refers to Tomcat 4

2004-11-12 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32211

tomcat-5.0 realm-howto refers to Tomcat 4

   Summary: tomcat-5.0 realm-howto refers to Tomcat 4
   Product: Tomcat 5
   Version: Unknown
  Platform: All
OS/Version: All
Status: NEW
  Severity: Minor
  Priority: Other
 Component: Unknown
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


The Tomcat 5.0 realm-howto document, at
, in section `
Standard Realm Implementations', subsection `JAASRealm', twice refers to Tomcat
4 instead of Tomcat 5.

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



DO NOT REPLY [Bug 32210] New: - tomcat-5.0 realm-howto describes wrong className for JAASRealm

2004-11-12 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32210

tomcat-5.0 realm-howto describes wrong className for JAASRealm

   Summary: tomcat-5.0 realm-howto describes wrong className for
JAASRealm
   Product: Tomcat 5
   Version: Unknown
  Platform: All
OS/Version: All
Status: NEW
  Severity: Normal
  Priority: Other
 Component: Unknown
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


The Tomcat 5.0 realm-howto document, at
, in section `
Standard Realm Implementations', subsection `JAASRealm', states that in order to
use the JAASRealm, one should specify the value
``org.apache.catalina.realm.MemoryRealm'' for the className attribute of the
Realm element of $CATALINA_HOME/conf/server.xml.  The correct value is
``org.apache.catalina.realm.JAASRealm''.

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



DO NOT REPLY [Bug 32209] New: - tomcat-5.0 realm-howto inconsistent on description of standard plug-ins

2004-11-12 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32209

tomcat-5.0 realm-howto inconsistent on description of standard plug-ins

   Summary: tomcat-5.0 realm-howto inconsistent on description of
standard plug-ins
   Product: Tomcat 5
   Version: Unknown
  Platform: All
OS/Version: All
Status: NEW
  Severity: Normal
  Priority: Other
 Component: Unknown
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]


The Tomcat 5.0 realm-howto document, at
, in section
`Overview', subsection `What is a realm?', states that ``three standard plug-ins
are provided'', then lists four plugins (DataSourceRealm, JDBCRealm, JNDIRealm,
MemoryRealm).  Then, under section `Standard Realm Implementations', the
document describes five plug-ins (JDBCRealm, DataSourceRealm, JNDIRealm,
MemoryRealm, JAASRealm).

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



IIS 6.0, SSL, and Tomcat 5.0 set up problem.

2004-11-12 Thread charles doweary
I am running IIS 6.0 with Tomcat 5.0 on Windows Server 2003, and I am having 
a problem getting SSL to work.  The following instructions are a portion of 
the article titled "TOMCAT and SSL", and I have a questions about  "Do: 
keytool -genkey -alias tomcat -keyalg RSA".

Where is this command typed into the system?
Where do I key this information into the system?
Are the commands entered in DOS?
I have JSSE installed and the 3 jar files are in place in my CLASSPATH and 
in JAVA_HOME.

IIS has a wizard that I use to create certificates and it does not permit me 
to enter the keytool parameters.

I guess my next questions are:
How do I created a certificate in my environment without using the wizard?
Have the steps changed to get SSL to work in version 6.0 of IIS and version 
5.0.28 of Tomcat?
And if so, what steps do I now need to take to set this up properly?

Your help in my setup issue is greatly apprieciated.
DIRECT SSL
Generate a SSL certificate (RSA) for tomcat
I succeed (at least) with my IBM JDK 1.3 after:
jsse jars MUST BE IN BOTH CLASSPATH and $JAVA_HOME/jre/lib/ext (JAVA > 1.2)
from server.xml doc.You _need_ to set up a server certificate if you want 
this to work, and you need JSSE.
Add JSSE jars to CLASSPATH
Edit $JAVA_HOME/jre/lib/security/java.security
Add: security.provider.2=com.sun.net.ssl.internal.ssl.Provider
Do: keytool -genkey -alias tomcat -keyalg RSA
RSA is essential to work with Netscape and IIS. Use "changeit" as password 
(or add keypass attribute). You don't need to sign the certificate. You can 
set parameter keystore and keypass if you want to change the default 
($HOME/.keystore with changeit)
I suggest you install jcert.jar, jnet.jar and jsse.jar in 
$JAVA_HOME/jre/lib/ext and then add them to your CLASSPATH export

CLASSPATH=$JAVA_HOME/jre/lib/ext/jcert.jar:$CLASSPATH
export CLASSPATH=$JAVA_HOME/jre/lib/ext/jnet.jar:$CLASSPATH
export CLASSPATH=$JAVA_HOME/jre/lib/ext/jsse.jar:$CLASSPATH
You could also copy the 3 jars into $TOMCAT_HOME/lib/ so they are under the 
existing CLASSPATH at tomcat startup (tomcat.sh).


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


cvs commit: jakarta-tomcat-connectors/jk/native/iis jk_isapi_plugin.c

2004-11-12 Thread mturk
mturk   2004/11/12 10:45:24

  Modified:jk/native/apache-1.3 mod_jk.c
   jk/native/apache-2.0 mod_jk.c
   jk/native/common jk_ajp_common.c jk_service.h jk_util.c
jk_util.h
   jk/native/iis jk_isapi_plugin.c
  Log:
  Added custom 'retries' for worker, so we don't depend on
  default setting. If set to a number grater then 3, it will sleep
  for 100ms on retry greater then 3 and then try again.
  
  Revision  ChangesPath
  1.52  +3 -1  jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c
  
  Index: mod_jk.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- mod_jk.c  12 Nov 2004 08:42:47 -  1.51
  +++ mod_jk.c  12 Nov 2004 18:45:24 -  1.52
  @@ -1554,6 +1554,8 @@
   
   jk_init_ws_service(&s);
   
  +/* Update retries for this worker */
  +s.retries = worker->retries;
   s.ws_private = &private_data;
   s.pool = &private_data.p;
   #ifndef NO_GETTIMEOFDAY
  
  
  
  1.101 +5 -2  jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
  
  Index: mod_jk.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- mod_jk.c  12 Nov 2004 09:02:04 -  1.100
  +++ mod_jk.c  12 Nov 2004 18:45:24 -  1.101
  @@ -1732,7 +1732,9 @@
   }
   
   if (worker) {
  +#ifndef NO_GETTIMEOFDAY
   struct timeval tv_begin, tv_end;
  +#endif
   int rc = JK_FALSE;
   apache_private_data_t private_data;
   jk_ws_service_t s;
  @@ -1744,7 +1746,8 @@
   private_data.r = r;
   
   jk_init_ws_service(&s);
  -
  +/* Update retries for this worker */
  +s.retries = worker->retries;
   s.ws_private = &private_data;
   s.pool = &private_data.p;
   #ifndef NO_GETTIMEOFDAY
  
  
  
  1.63  +39 -5 
jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c
  
  Index: jk_ajp_common.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- jk_ajp_common.c   12 Nov 2004 12:47:37 -  1.62
  +++ jk_ajp_common.c   12 Nov 2004 18:45:24 -  1.63
  @@ -35,6 +35,24 @@
   #include "novsock2.h"
   #endif
   
  +/* Sleep for 100ms */
  +static void jk_sleep_def()
  +{
  +#ifdef OS2
  +DosSleep(100);
  +#elif defined(BEOS)
  +snooze(100 * 1000);
  +#elif defined(NETWARE)
  +delay(100);
  +#elif defined(WIN32)
  +Sleep(100);
  +#else
  +struct timeval tv;
  +tv.tv_usec = 100 * 1000;
  +tv.tv_sec = 0;
  +select(0, NULL, NULL, NULL, &tv);
  +#endif
  +} 
   
   const char *response_trans_headers[] = {
   "Content-Type",
  @@ -1442,8 +1460,6 @@
   return JK_FALSE;
   }
   
  -#define JK_RETRIES 3
  -
   /*
* service is now splitted in ajp_send_request and ajp_get_reply
* much more easier to do errors recovery
  @@ -1497,7 +1513,7 @@
* JK_RETRIES could be replaced by the number of workers in
* a load-balancing configuration 
*/
  -for (i = 0; i < JK_RETRIES; i++) {
  +for (i = 0; i < s->retries; i++) {
   /*
* We're using reqmsg which hold initial request
* if Tomcat is stopped or restarted, we will pass reqmsg
  @@ -1546,6 +1562,10 @@
   jk_log(l, JK_LOG_INFO,
  "Receiving from tomcat failed, "
  "recoverable operation attempt=%d\n", i);
  +/* Check for custom retries */
  +if (i >= JK_RETRIES) {
  +jk_sleep_def();
  +}
   }
   }
   
  @@ -1562,8 +1582,8 @@
   }
   else {
   jk_log(l, JK_LOG_INFO,
  -   "sending request to tomcat failed in send loop. "
  -   "retry=%d\n", i);
  +   "Sending request to tomcat failed,  "
  +   "recoverable operation attempt=%d\n", i);
   }
   
   }
  @@ -1728,6 +1748,20 @@
  "setting recovery opts to %d\n",
  p->recovery_opts);
   
  +pThis->retries =
  +jk_get_worker_retries(props, p->name,
  +  JK_RETRIES);
  +if (pThis->retries < 1) {
  +jk_log(l, JK_LOG_INFO,
  +   "number of r

Bug in JNDIRealm, Login fails if slash character in distinguished name, Fix [Auf Viren geprüft]

2004-11-12 Thread Frerk . Meyer
Problem:
JNDIRealm fails with javax.naming.InvalidNameException: Invalid name:
"uid=TestUser,ou=Test/QA,o=Development"
or any other DN with a slash character.

Background and cause:
A slash character is a perfectly valid character in LDAP object names or
class LdapName.
It even doesn't have to be escaped, in contrast to '+' or '\' for example.
The problem is caused only in Java and Tomcat because of JNDI.
In JNDI directory names are of class CompositeName with seperator '/' and
Ldap directory names are of class LdapName with seperator ','.
The JNDIRealm uses only InitialDirContext instead of InitialLdapContext
and it uses only Name instead of LdapName. But ctx.getNameParser("")
returns an LdapNameParser and parser.parse() returns LdapNames.
So LdapNames and CompositeNames become mangled.

Original Code from JNDIRealm in getUserBySearch():

// Get the entry's distinguished name
NameParser parser = context.getNameParser("");
Name contextName = parser.parse(context.getNameInNamespace());
Name baseName = parser.parse(userBase);
Name entryName = parser.parse(result.getName()); // BUG:
InvalidNameException throw if slash is parsed
Name name = contextName.addAll(baseName);
name = name.addAll(entryName);
String dn = name.toString();

 My quick (and ugly) fix:

  //Get the entry's distinguished name
   NameParser parser = ctx.getNameParser("");
   Name contextName = parser.parse(ctx.getNameInNamespace
());
   Name baseName = parser.parse(searchbase);
   String rdn = sr.getName();
   // delete surrunding double quotes if any
   int rdnEnd = rdn.length()-1;
   if (rdnEnd>0) {
if (rdn.charAt(0) == '"' && rdn.charAt(rdnEnd) ==
'"') {
  rdn = rdn.substring(1,rdnEnd);
}
   }
   Name entryName = parser.parse(rdn);
   Name name = contextName.addAll(baseName);
   name = name.addAll(entryName);
   String dn = name.toString();

Explanation:
If there is one or more slash characters in the getName() string, then the
whole string is embedded in
double quotes. I simply delete them and everything works. If I use

Alternative:
If I use

  rdn = (string) LdapName.unescapeAttributeValue(rdn);

instead, it doesn't work, because the escape character '\' in front of
',' or '+' is deleted too which causes other exceptions.

I didn't dare to introduce any of the javax.naming.ldap.*; Classes which
might provide
for more elegant solutions but tried to solve it with the
javax.naming.directory.*; classes.

With Java 5 it definitly gets more elegant because then we don't have only
LdapName
and String but also RDNs which are relative distinguished names. They are
the equivalent to
components of CompsiteNames and don't fiddle with slashes.


Frerk Meyer

EDEKA Aktiengesellschaft
GB Datenverarbeitung
Frerk Meyer
CC Web Technologien
New-York-Ring 6
22297 Hamburg
Tel: 040/6377 - 3272
Fax: 040/6377 - 41268
mailto:[EMAIL PROTECTED]




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



Re: Question about new mod_jk jk_lb_worker.c

2004-11-12 Thread Peter Rossbach
Hello Mladen,
I have two use case for the Multi Cluster Routing:
Use Case 1: More Scaling cluster
=
A tomcat standard we replicated the session to all tomcat node at a cluster.
This replication strategie not scale very well, but when we split
the tomcat nodes to some domain  and the lb knows that, the system scale 
better.

   Apache 1
   domain and cluster 1
worker   w1.1 for T1.1
worker   w1.2 for T1.2
worker   w1.3 for T1.3
  domain and cluster 2
worker   w2.1 for T2.1
worker   w2.2 for T2.2
worker   w2.3 for T2.3
  When a worker w1 at domain 1 failed the  made the next try to w1.2 
and w1.3,
  only this worker fail also, the balancer give the w2.x worker a 
chance. Ok, the client
  lose the session but than you have really hardware problems...

Use Case 2: Switch smoothly to next software generation ( preferred domain)

Release a new software at runtime without drop the current user sessions.
Start complete new tomcat instances with new application release.
Say the Loadbalancer that all new sessions start to domain 2 workers,
but as you lost a worker at domain 1 (old release) switch to worker at 
same domain.

Apache 1
   domain and cluster 1  ( Software Release 1)
worker   w1.1 for T1.1
worker   w1.2 for T1.2
worker   w1.3 for T1.3
  domain and cluster 2 ( Software Release 2) - preferred
worker   w2.1 for T2.1
worker   w2.2 for T2.2
worker   w2.3 for T2.3
  Both use case work perfect with the mod_jk2 level concept, with a 
little patch.
  Only the level limit is a real problem for scaling well..

---
I check also the newest jk_lb_worker and it works fine for me...
The increment technic is simple and powerful :-)
Some examples
w1+ w2   lb_factor 1 lb_value 0
   values after calc
   request  |   w1   w2|  comment
   1   |0*   2   |w1 get the Session
   2   |0 0* |w2 get the Session
   3   |0 0* |w2 get the Session, w1 is in 
error state

w1 lb_factor 3 lb_value 0
w2 lb_factor 1 lb_value 0
  values after calc
   request   |  w1   w2   |comment
   1|   -1*   1| w1 get the Session
   2|   -2*   2| w1 get the Session
   3|   -3 3| w1 get the Session, w1 is 
first lb worker
   4|   0 0*| w2 get the Session
   5|   -1*   1| w1 get the Session
   6|   -1 0*  | w2 get the Session, w1 is in error
   7|   -1 0*  | w2 get the Session, w1 is in error
   7|   -1*   1| w1 get the Session, w1 recover

great.
regards
peter
Mladen Turk schrieb:
Rainer Jung wrote:
I include my original posting.
Hi Rainer,
First of all thank you for ideas.
They are great!
1) Limiting new application sessions if load is to high.
There is a problem with that. I made a implementation counting the
number of busy childs/threads from scoreboard (took me entire day),
but again we should count the number of connections to tomcat, cause
the apache might be serving static content.
Anyhow the idea is great and I'll implement it in the new mod_proxy
for Apache 2.2 where we have extra slots in the scoreboard.
Sad but we can not do that inside mod_jk unless we implement our
own shared memory, that was prover to be bogus in jk2.

2) Multi-Cluster-Routing
Can you write some use case for that and perhaps some simple algo
too. What about sticky-sessions and forcing failower if we do not have
session replication?
3) Idle connection disconnect
Use worker mpm. We just can not make maintainer thread for
non-treaded mpm's like apache1.2 or prefork.

4) Open Problem
I didn't check your new code, but at least before there was the 
problem, that a recovered worker that was offline a long time (in 
means of load) 

This should work now with the latest patches.
Best regards,
Mladen.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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


cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c

2004-11-12 Thread mturk
mturk   2004/11/12 04:47:37

  Modified:jk/native/common jk_ajp_common.c
  Log:
  Log retry instead of err.
  TODO: we should make the number of retries configurable.
  
  Revision  ChangesPath
  1.62  +2 -2  
jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c
  
  Index: jk_ajp_common.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- jk_ajp_common.c   11 Nov 2004 18:26:57 -  1.61
  +++ jk_ajp_common.c   12 Nov 2004 12:47:37 -  1.62
  @@ -1563,7 +1563,7 @@
   else {
   jk_log(l, JK_LOG_INFO,
  "sending request to tomcat failed in send loop. "
  -   "err=%d\n", i);
  +   "retry=%d\n", i);
   }
   
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_logger.h

2004-11-12 Thread mturk
mturk   2004/11/12 04:41:41

  Modified:jk/native/common jk_logger.h
  Log:
  Allow tracing without defining maintainer-mode.
  
  Revision  ChangesPath
  1.17  +20 -9 jakarta-tomcat-connectors/jk/native/common/jk_logger.h
  
  Index: jk_logger.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_logger.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- jk_logger.h   11 Nov 2004 17:02:25 -  1.16
  +++ jk_logger.h   12 Nov 2004 12:41:41 -  1.17
  @@ -84,17 +84,28 @@
   
   #define JK_LOG_REQUEST __FILE__,0,NULL,JK_LOG_REQUEST_LEVEL
   
  -/* Debug level is compile time only 
  +#if defined(JK_PRODUCTION)
  +/* TODO: all DEBUG messages should be compiled out
  + * when this define is in place.
*/
  -#if defined (DEBUG) || defined(_DEBUG)
  -#define JK_TRACE1
  -#define JK_TRACE_ENTER(l) jk_log((l), JK_LOG_TRACE, "enter\n")
  -#define JK_TRACE_EXIT(l)  jk_log((l), JK_LOG_TRACE, "exit\n")
  -#else
  -#define JK_TRACE0
  +#define JK_IS_PRODUCTION1
   #define JK_TRACE_ENTER(l)
   #define JK_TRACE_EXIT(l)
  -#endif
  +#else
  +#define JK_IS_PRODUCTION0
  +#define JK_TRACE_ENTER(l)   \
  +do {\
  +if ((l) && (l)->level == JK_LOG_TRACE_LEVEL) {  \
  +jk_log((l), JK_LOG_TRACE, "enter\n");   \
  +} } while (0)
  +
  +#define JK_TRACE_EXIT(l)\
  +do {\
  +if ((l) && (l)->level == JK_LOG_TRACE_LEVEL) {  \
  +jk_log((l), JK_LOG_TRACE, "exit\n");\
  +} } while (0)
  +
  +#endif  /* JK_PRODUCTION */
   
   #define JK_LOG_NULL_PARAMS(l) jk_log((l), JK_LOG_ERROR, "NULL parameters\n")
   
  
  
  

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



Re: Question about new mod_jk jk_lb_worker.c

2004-11-12 Thread Mladen Turk
Rainer Jung wrote:
I include my original posting.
Hi Rainer,
First of all thank you for ideas.
They are great!
1) Limiting new application sessions if load is to high.
There is a problem with that. I made a implementation counting the
number of busy childs/threads from scoreboard (took me entire day),
but again we should count the number of connections to tomcat, cause
the apache might be serving static content.
Anyhow the idea is great and I'll implement it in the new mod_proxy
for Apache 2.2 where we have extra slots in the scoreboard.
Sad but we can not do that inside mod_jk unless we implement our
own shared memory, that was prover to be bogus in jk2.

2) Multi-Cluster-Routing
Can you write some use case for that and perhaps some simple algo
too. What about sticky-sessions and forcing failower if we do not have
session replication?
3) Idle connection disconnect
Use worker mpm. We just can not make maintainer thread for
non-treaded mpm's like apache1.2 or prefork.

4) Open Problem
I didn't check your new code, but at least before there was the problem, 
that a recovered worker that was offline a long time (in means of load) 
This should work now with the latest patches.
Best regards,
Mladen.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-connectors/jk/native/iis jk_isapi_plugin.c

2004-11-12 Thread mturk
mturk   2004/11/12 03:56:18

  Modified:jk/native/iis jk_isapi_plugin.c
  Log:
  Use new trace macros and native types where possible.
  Clean up log messages.
  
  Revision  ChangesPath
  1.28  +67 -64jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c
  
  Index: jk_isapi_plugin.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- jk_isapi_plugin.c 9 Nov 2004 12:17:44 -   1.27
  +++ jk_isapi_plugin.c 12 Nov 2004 11:56:18 -  1.28
  @@ -19,7 +19,8 @@
* Author:  Gal Shachor <[EMAIL PROTECTED]>   *
* Author:  Larry Isaacs <[EMAIL PROTECTED]>   *
* Author:  Ignacio J. Ortega <[EMAIL PROTECTED]>   *
  - * Version: $Revision$   *
  + * Author:  Mladen Turk <[EMAIL PROTECTED]> *
  + * Version: $Revision$  *
***/
   
   // This define is needed to include wincrypt,h, needed to get client 
certificates
  @@ -71,7 +72,7 @@
   #define BAD_PATH-2
   #define MAX_SERVERNAME  128
   
  -#define JK_TOLOWER(x)   ((char)tolower((unsigned char)(x)))
  +#define JK_TOLOWER(x)   ((char)tolower((BYTE)(x)))
   
   #define GET_SERVER_VARIABLE_VALUE(name, place)  \
 do {  \
  @@ -112,7 +113,7 @@
   static jk_logger_t *logger = NULL;
   static char *SERVER_NAME = "SERVER_NAME";
   static char *SERVER_SOFTWARE = "SERVER_SOFTWARE";
  -
  +static char *CONTENT_TYPE = "Content-Type:text/html\r\n\r\n";
   
   static char extension_uri[INTERNET_MAX_URL_LENGTH] =
   "/jakarta/isapi_redirect.dll";
  @@ -135,7 +136,7 @@
   jk_pool_t p;
   
   int request_started;
  -unsigned bytes_read_so_far;
  +unsigned int bytes_read_so_far;
   LPEXTENSION_CONTROL_BLOCK lpEcb;
   };
   
  @@ -145,12 +146,12 @@
   const char *reason,
   const char *const *header_names,
   const char *const *header_values,
  -unsigned num_of_headers);
  +unsigned int num_of_headers);
   
   static int JK_METHOD read(jk_ws_service_t *s,
  -  void *b, unsigned l, unsigned *a);
  +  void *b, unsigned int l, unsigned int *a);
   
  -static int JK_METHOD write(jk_ws_service_t *s, const void *b, unsigned l);
  +static int JK_METHOD write(jk_ws_service_t *s, const void *b, unsigned int 
l);
   
   static int init_ws_service(isapi_private_data_t * private_data,
  jk_ws_service_t *s, char **worker_name);
  @@ -257,7 +258,7 @@
   else
   l = 0;
   n = l;
  -while ((name[n] = name[m])) {
  +while ((name[n] = name[m]) != '\0') {
   n++;
   m++;
   }
  @@ -287,7 +288,7 @@
   
   #define T_OS_ESCAPE_PATH(4)
   
  -static const unsigned char test_char_table[256] = {
  +static const BYTE test_char_table[256] = {
0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 14, 14, 14, 14, 14,
   14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
   14,  0,  7,  6,  1,  6,  1,  1,  9,  9,  1,  0,  8,  0,  0, 10,
  @@ -306,11 +307,11 @@
6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6
   };
   
  -#define TEST_CHAR(c, f) (test_char_table[(unsigned)(c)] & (f))
  +#define TEST_CHAR(c, f) (test_char_table[(unsigned int)(c)] & (f))
   
   static const char c2x_table[] = "0123456789abcdef";
   
  -static unsigned char *c2x(unsigned what, unsigned char *where)
  +static BYTE *c2x(unsigned int what, BYTE *where)
   {
   *where++ = '%';
   *where++ = c2x_table[what >> 4];
  @@ -320,10 +321,10 @@
   
   static int escape_url(const char *path, char *dest, int destsize)
   {
  -const unsigned char *s = (const unsigned char *)path;
  -unsigned char *d = (unsigned char *)dest;
  -unsigned char *e = d + destsize - 1;
  -unsigned char *ee = d + destsize - 3;
  +const BYTE *s = (const BYTE *)path;
  +BYTE *d = (BYTE *)dest;
  +BYTE *e = d + destsize - 1;
  +BYTE *ee = d + destsize - 3;
   
   while (*s) {
   if (TEST_CHAR(*s, T_OS_ESCAPE_PATH)) {
  @@ -362,15 +363,12 @@
   static void write_error_response(PHTTP_FILTER_CONTEXT pfc, char *status,
char *msg)
   {
  -char ctype[30];
   size_t len = strlen(msg);
   
  -strcpy(ctype, "Content-Type:text/html\r\n\r\n");
  -
   /* reject !!! */
   pfc->ServerSupportFuncti

Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_mt.h

2004-11-12 Thread NormW
[EMAIL PROTECTED] wrote:
mturk   2004/11/12 02:56:04
  Modified:jk/native/common jk_mt.h
  Log:
  Add getpid for Netware without __NOVELL_LIBC__
  
  Revision  ChangesPath
  1.9   +5 -1  jakarta-tomcat-connectors/jk/native/common/jk_mt.h
  
  Index: jk_mt.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_mt.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- jk_mt.h	12 Nov 2004 07:46:48 -	1.8
  +++ jk_mt.h	12 Nov 2004 10:56:03 -	1.9
  @@ -30,7 +30,11 @@
   #define jk_gettid()((int)GetCurrentThreadId())
   #elif defined(NETWARE)
   #define jk_gettid()((int)GetThreadID())
  +#if !defined(__NOVELL_LIBC__)
  +#define getpid()   ((int)GetThreadGroupID())
  +#endif /* __NOVELL_LIBC__ */
   #endif
  +
   
   /*
* All WIN32 code is MT, UNIX code that uses pthreads is marked by the POSIX 
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.
Thanks and Good Night from Oz!
Norm
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_mt.h jk_util.c

2004-11-12 Thread Mladen Turk
NormW wrote:
+#if !defined(__NOVELL_LIBC__)
+#define getpid()   ((pid_t)GetThreadGroupID())
+#endif
Committed, thanks!
Can you confirm that we can compile on Netware now?
Regards,
Mladen.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-connectors/jk/native/common jk_mt.h

2004-11-12 Thread mturk
mturk   2004/11/12 02:56:04

  Modified:jk/native/common jk_mt.h
  Log:
  Add getpid for Netware without __NOVELL_LIBC__
  
  Revision  ChangesPath
  1.9   +5 -1  jakarta-tomcat-connectors/jk/native/common/jk_mt.h
  
  Index: jk_mt.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_mt.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- jk_mt.h   12 Nov 2004 07:46:48 -  1.8
  +++ jk_mt.h   12 Nov 2004 10:56:03 -  1.9
  @@ -30,7 +30,11 @@
   #define jk_gettid()((int)GetCurrentThreadId())
   #elif defined(NETWARE)
   #define jk_gettid()((int)GetThreadID())
  +#if !defined(__NOVELL_LIBC__)

  +#define getpid()   ((int)GetThreadGroupID())

  +#endif /* __NOVELL_LIBC__ */

   #endif
  +
   
   /*
* All WIN32 code is MT, UNIX code that uses pthreads is marked by the POSIX 
  
  
  

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



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 InternalOutputBuffer.java Constants.java

2004-11-12 Thread remm
remm2004/11/12 02:51:49

  Modified:util/java/org/apache/tomcat/util/buf MessageBytes.java
CharChunk.java ByteChunk.java
   http11/src/java/org/apache/coyote/http11
InternalOutputBuffer.java Constants.java
  Log:
  - Move convertToBytes to ByteChunk.
  - Some small optimizations.
  - The recycle method of MB was called far too often (ex: when calling 
setChars). This needs some testing.
  
  Revision  ChangesPath
  1.20  +35 -14
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java
  
  Index: MessageBytes.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- MessageBytes.java 29 Aug 2004 17:14:41 -  1.19
  +++ MessageBytes.java 12 Nov 2004 10:51:49 -  1.20
  @@ -121,14 +121,18 @@
   /**
* Sets the content to the specified subarray of bytes.
*
  - * @param b the ascii bytes
  + * @param b the bytes
* @param off the start offset of the bytes
* @param len the length of the bytes
*/
   public void setBytes(byte[] b, int off, int len) {
  - recycle(); // a new value is set, cached values must reset
  - byteC.setBytes( b, off, len );
  - type=T_BYTES;
  +byteC.setBytes( b, off, len );
  +type=T_BYTES;
  +hasStrValue=false;
  +hasHashCode=false;
  +hasIntValue=false;
  +hasLongValue=false;
  +hasDateValue=false; 
   }
   
   /** Set the encoding. If the object was constructed from bytes[]. any
  @@ -144,12 +148,21 @@
byteC.setEncoding(enc);
   }
   
  -/** Sets the content to be a char[]
  +/** 
  + * Sets the content to be a char[]
  + *
  + * @param c the bytes
  + * @param off the start offset of the bytes
  + * @param len the length of the bytes
*/
   public void setChars( char[] c, int off, int len ) {
  - recycle();
  - charC.setChars( c, off, len );
  - type=T_CHARS;
  +charC.setChars( c, off, len );
  +type=T_CHARS;
  +hasStrValue=false;
  +hasHashCode=false;
  +hasIntValue=false;
  +hasLongValue=false;
  +hasDateValue=false; 
   }
   
   /** Remove the cached string value. Use it after a conversion on the
  @@ -165,15 +178,19 @@
}
   }
   
  -/** Set the content to be a string
  +/** 
  + * Set the content to be a string
*/
   public void setString( String s ) {
  - recycle();
   if (s == null)
   return;
  - strValue=s;
  - hasStrValue=true;
  - type=T_STR;
  +strValue=s;
  +hasStrValue=true;
  +hasHashCode=false;
  +hasIntValue=false;
  +hasLongValue=false;
  +hasDateValue=false; 
  +type=T_STR;
   }
   
   //  Conversion and getters 
  @@ -553,7 +570,6 @@
   /** Set the buffer to the representation of an int
*/
   public void setInt(int i) {
  - recycle();
   byteC.allocate(16, 32);
   int current = i;
   byte[] buf = byteC.getBuffer();
  @@ -571,6 +587,7 @@
   current = current / 10;
   buf[end++] = HexUtils.HEX[digit];
   }
  +byteC.setOffset(0);
   byteC.setEnd(end);
   // Inverting buffer
   end--;
  @@ -585,7 +602,11 @@
   end--;
   }
   intValue=i;
  +hasStrValue=false;
  +hasHashCode=false;
   hasIntValue=true;
  +hasLongValue=false;
  +hasDateValue=false; 
   type=T_BYTES;
   }
   
  
  
  
  1.18  +5 -7  
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java
  
  Index: CharChunk.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CharChunk.java18 Oct 2004 23:19:36 -  1.17
  +++ CharChunk.java12 Nov 2004 10:51:49 -  1.18
  @@ -133,12 +133,10 @@
   }
   
   public void setChars( char[] c, int off, int len ) {
  - recycle();
  - isSet=true;
  - buff=c;
  - start=off;
  - end=start + len;
  - limit=end;
  +buff=c;
  +start=off;
  +end=start + len;
  +isSet=true;
   }
   
   /** Maximum amount of data in this buffer.
  @@ -192,7 +190,7 @@
   }
   
   public int getOffset() {
  - return getStart();
  + return start;
   }
   
   /**
  
  
  
  1.23  +19 -5 
jakarta-tomcat-connectors/util

DO NOT REPLY [Bug 32137] - Random "401" responses for Digest - DigestAuthenticator thread un-safe use of MessageDigest

2004-11-12 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32137

Random "401" responses for Digest - DigestAuthenticator thread un-safe use of 
MessageDigest

[EMAIL PROTECTED] changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED



--- Additional Comments From [EMAIL PROTECTED]  2004-11-12 10:30 ---
I looked in MessageDigest, and indeed, it is not thread safe. Problems are very
unlikely to occur, though.

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



Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_mt.h jk_util.c

2004-11-12 Thread NormW
[EMAIL PROTECTED] wrote:
mturk   2004/11/11 23:46:49
  Modified:jk/native/common jk_mt.h jk_util.c
  Log:
  Fix Netware getpid/gettid.
  
  Revision  ChangesPath
  1.8   +10 -6 jakarta-tomcat-connectors/jk/native/common/jk_mt.h
  
  Index: jk_mt.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_mt.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- jk_mt.h	11 Nov 2004 17:04:04 -	1.7
  +++ jk_mt.h	12 Nov 2004 07:46:48 -	1.8
  @@ -25,6 +25,13 @@
   
   #include "jk_global.h"
   
  +
  +#if defined(WIN32)
  +#define jk_gettid()((int)GetCurrentThreadId())
  +#elif defined(NETWARE)
  +#define jk_gettid()((int)GetThreadID())
  +#endif
  +
   /*
* All WIN32 code is MT, UNIX code that uses pthreads is marked by the POSIX 
* _REENTRANT define.
  @@ -47,8 +54,6 @@
   #define JK_ENTER_CS(x, rc) EnterCriticalSection(x); rc = JK_TRUE;
   #define JK_LEAVE_CS(x, rc) LeaveCriticalSection(x); rc = JK_TRUE;
   
  -#define JK_THREADID()  ((int)GetCurrentThreadId())
  -
   #else /* Unix pthreads */
   
   #include 
  @@ -67,8 +72,7 @@
   #define JK_LEAVE_CS(x, rc)\
   if(pthread_mutex_unlock(x)) rc = JK_FALSE; else rc = JK_TRUE;
   
  -#define JK_THREADID()  ((int)pthread_self())
  -
  +#define jk_gettid() ((int)pthread_self())
   #endif /* Unix pthreads */
   
   #else /* Not an MT code */
  @@ -79,7 +83,7 @@
   #define JK_DELETE_CS(x, rc) rc = JK_TRUE;
   #define JK_ENTER_CS(x, rc) rc = JK_TRUE;
   #define JK_LEAVE_CS(x, rc) rc = JK_TRUE;
  -#define JK_THREADID()  0
  +#define jk_gettid() 0
   
   #endif /* Not an MT code */
   
  
  
  
  1.36  +3 -3  jakarta-tomcat-connectors/jk/native/common/jk_util.c
  
  Index: jk_util.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_util.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- jk_util.c	11 Nov 2004 17:06:06 -	1.35
  +++ jk_util.c	12 Nov 2004 07:46:48 -	1.36
  @@ -272,11 +272,11 @@
   #ifdef USE_SPRINTF  /* until we get a snprintf function */
   if (line)
   used += sprintf(&buf[used], "[%d:%d] ", getpid(),
  -JK_THREADID());
  +jk_gettid());
   #else
   if (line)
   used += snprintf(&buf[used], HUGE_BUFFER_SIZE, "[%d:%d] ",
  - getpid(), JK_THREADID());
  + getpid(), jk_gettid());
   #endif
   if (used < 0) {
   return 0;   /* [V] not sure what to return... */
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.
Greetings,
Sad to say, the latest CVS jk_util.c still contains, at lines 275 and 
279, two references to 'getpid', one of which (not sure which) is still 
causing CW to abort when building for Apache 1.3. Apache-2.x mod_jk(s) 
build without issue because the build scripts include hooks into the 
Apache 2.x source and pick up the 'getpid' definition from there.

The os.h (for Apache 1.3) has a definition for 'getpid' as follows:
#define getpid() ((pid_t)GetThreadGroupID())
Unfortunately the GetThreadGroupID() isn't part of LibC. So, another 
patch is attached, which adapts jk_mt.h for NetWare, and have been able 
to successfully build for Apache 2.0, 2.1 and Apache 1.3 using this. If 
this is the best solution for you or NetWare I am unable to say.

Regards,
Norm
--- jk_mt.h.orig2004-11-12 20:10:05.0 +1100
+++ jk_mt.h 2004-11-12 21:11:17.0 +1100
@@ -29,6 +29,9 @@
 #if defined(WIN32)
 #define jk_gettid()((int)GetCurrentThreadId())
 #elif defined(NETWARE)
+#if !defined(__NOVELL_LIBC__)
+#define getpid()   ((pid_t)GetThreadGroupID())
+#endif
 #define jk_gettid()((int)GetThreadID())
 #endif

--- jk_mt.h.orig2004-11-12 20:10:05.0 +1100
+++ jk_mt.h 2004-11-12 21:11:17.0 +1100
@@ -29,6 +29,9 @@
 #if defined(WIN32)
 #define jk_gettid()((int)GetCurrentThreadId())
 #elif defined(NETWARE)
+#if !defined(__NOVELL_LIBC__)
+#define getpid()   ((pid_t)GetThreadGroupID())
+#endif
 #define jk_gettid()((int)GetThreadID())
 #endif
 

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

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator DigestAuthenticator.java

2004-11-12 Thread remm
remm2004/11/12 02:21:41

  Modified:catalina/src/share/org/apache/catalina/authenticator
DigestAuthenticator.java
  Log:
  - Bug 32137: Use of MessageDigest should be synced.
  
  Revision  ChangesPath
  1.12  +14 -6 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/DigestAuthenticator.java
  
  Index: DigestAuthenticator.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/DigestAuthenticator.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DigestAuthenticator.java  15 Aug 2004 15:48:59 -  1.11
  +++ DigestAuthenticator.java  12 Nov 2004 10:21:41 -  1.12
  @@ -313,7 +313,11 @@
   String a2 = method + ":" + uri;
   //System.out.println("A2:" + a2);
   
  -String md5a2 = md5Encoder.encode(md5Helper.digest(a2.getBytes()));
  +byte[] buffer = null;
  +synchronized (md5Helper) {
  +buffer = md5Helper.digest(a2.getBytes());
  +}
  +String md5a2 = md5Encoder.encode(buffer);
   
   return (realm.authenticate(userName, response, nOnce, nc, cnonce, 
qop,
  realmName, md5a2));
  @@ -396,7 +400,10 @@
   String nOnceValue = request.getRemoteAddr() + ":" +
   currentTime + ":" + key;
   
  -byte[] buffer = md5Helper.digest(nOnceValue.getBytes());
  +byte[] buffer = null;
  +synchronized (md5Helper) {
  +buffer = md5Helper.digest(nOnceValue.getBytes());
  +}
   nOnceValue = md5Encoder.encode(buffer);
   
   // Updating the value in the no once hashtable
  @@ -444,13 +451,14 @@
   realmName = request.getServerName() + ":"
   + request.getServerPort();
   
  -byte[] buffer = md5Helper.digest(nOnce.getBytes());
  +byte[] buffer = null;
  +synchronized (md5Helper) {
  +buffer = md5Helper.digest(nOnce.getBytes());
  +}
   
   String authenticateHeader = "Digest realm=\"" + realmName + "\", "
   +  "qop=\"auth\", nonce=\"" + nOnce + "\", " + "opaque=\""
   + md5Encoder.encode(buffer) + "\"";
  -// System.out.println("Authenticate header value : "
  -//   + authenticateHeader);
   response.setHeader("WWW-Authenticate", authenticateHeader);
   
   }
  
  
  

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



Re: Question about new mod_jk jk_lb_worker.c

2004-11-12 Thread Rainer Jung
Hi Mladen,
I include my original posting.
Hi Mladen,
great! I don't know how hard the following is to achieve, but it is the 
most prominent problem around mod_jk-Logging I know of:

mod_jk does neither support Apaches rotatelogs nor does it have a log 
rotation capability on its own. If you or any other committer has an 
idea how to introduce rotating logfiles, that would be a major achievement.

I have 3 more features I would be willing to provide. Maybe you or the 
other committers can comment, if they think that would be useful. All of 
them are already implemented for mod_jk/apache 1.3 and in production 
under high load.

1) Limiting new application sessions if load is to high.
You can configure a start URL for your application (regexp based). If a 
request X matches this URL, then mod_jk checks the scoreboard how many 
apache requests are being processed simultaneously at that moment. There 
is a configurable limti, and if that limit is reached, the request X 
will not be sent to tomcat, but instead be answered by some configurable 
 "local" static response (containing the info, that the load is to high 
and the user should try again later). Alternatively one can configure X 
to be answered by some external redirect.

2) Multi-Cluster-Routing
Tomcat-Cluster does only allow session replication to all nodes in the 
cluster. Once you work with more than 3-4 nodes there is too much 
overhead and risk in replicating sessions to all nodes. We split all 
nodes into clustered groups. I introduced a new worker attribute 
"domain" to let get_most_suitable_worker know, to which other nodes the 
session gets replicated (the workers in the same domain).

This enhancement has another benefit: Once mod_jk connects an apache 
process to a tomcat instance, the tomcat jk connector will need one 
thread for this connection as long as the apache process is alive.

Now assume you have multiple Apaches and Tomcats. The Tomcats are 
clustered and mod_jk uses sticky sessions. Now you are going to shut 
down (maintenance) one tomcat. All Apache will start connections to all 
tomcats. You end up with all tomcats getting connections from all apache 
processes, so the number of threads needed inside the tomcats will explode.

If you group the tomcats the connections normally will stay inside the 
groups (combine 2) with a routing load balancer to the apaches).

3) Idle connection disconnect
This one also comes from the fact, that a mod_jk connection consumes one 
tomcat connector thread, even if its idle for a long time. The idle 
connection check in mod_jk only works, if the connection is going to be 
used. Then it is checked if it was idle for too long and probably is 
beeing closed and reconnected.

I implemented a feature, where in configurable intervals all workers of 
an lb worker are checked for idle connections, even the ones which are 
not returned by get_most_suitable_worker. The rationale behind it is the 
same as in the second part of 2).

4) Open Problem
I didn't check your new code, but at least before there was the problem, 
that a recovered worker that was offline a long time (in means of load) 
got all the work after recovery. Of course there was a fixed conatsnt of 
load added to it after recovery to compensate, but working with a 
constant was not really solving the problem.

It looks like one should virtually add load to a worker, even during 
it's error time, so that it will get normal load after recovering.

Thanks for any comments!
Rainer
Mladen Turk wrote:
> Rainer Jung wrote:
>
>> Hi Mladen, hi everyone,
>>
>> i have a proposal for a slight enhancement concerning the log format of
>> mod_jk. Maybe you could consider including it in your recently 
revised code. It contains only changes to jk_util.c and I attach a patch 
relativ to version 1.32 of the file.
>>
>
> Hi Rainer.
>
> You are definitely on my track :) .
>
> I'm planning to add one additional log level, and clear all the log
> messages.
>
> 1. ERROR - fatal operations
> 2. WARN  - problems but not fatal
> 3. INFO  - production logging
> 4. DEBUG - protocol tracing
> 5. TRACE - function call logging
>
>> 1) Include the log level of a message in the log line.
>> 2) Include the PID of the logging process in the log file.
>
>
>
> I'd like to make a customizable log line, in the JkRequestLogFormat
> fashion to be able to add PID/ThreadId, level, etc...
>
> MT.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


Mladen Turk wrote:
Peter Rossbach wrote:
Hello Mladen,
I have see your checkin's and Rainer Jung very fine mod_jk extension 
concept mail.

I have two questions about lb changes:
a)   Why you not change the lb_value value after successful recovery 
at service() function ?
  After a longer fail the recovered worker get for a long time all 
new sessions...

OK. Will check. Seems very reasonable.
  See also Rainers Jung

cvs commit: jakarta-tomcat-connectors/jk/native/apache-2.0 mod_jk.c

2004-11-12 Thread mturk
mturk   2004/11/12 01:02:04

  Modified:jk/native/apache-2.0 mod_jk.c
  Log:
  Add missing include for unixd, and remove unused vars.
  
  Revision  ChangesPath
  1.100 +6 -3  jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
  
  Index: mod_jk.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- mod_jk.c  12 Nov 2004 08:24:43 -  1.99
  +++ mod_jk.c  12 Nov 2004 09:02:04 -  1.100
  @@ -66,6 +66,10 @@
   #endif
   
   #include "apr_strings.h"
  +
  +#if APR_USE_SYSVSEM_SERIALIZE
  +#include "unixd.h"  /* for unixd_set_global_mutex_perms */
  +#endif
   /*
* Jakarta (jk_) include files
*/
  @@ -335,7 +339,6 @@
   
   if (l) {
   /* BUFF *bf = p->r->connection->client; */
  -size_t w = (size_t) l;
   size_t r = 0;
   long ll = l;
   char *bb = (char *)b;
  @@ -1663,7 +1666,7 @@
   worker_name = apr_table_get(r->notes, JK_WORKER_ID);
   
   /* Set up r->read_chunked flags for chunked encoding, if present */
  -if (rc = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) {
  +if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)) != 
APR_SUCCESS) {
   return rc;
   }
   
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/apache-1.3 mod_jk.c

2004-11-12 Thread mturk
mturk   2004/11/12 00:42:47

  Modified:jk/native/apache-1.3 mod_jk.c
  Log:
  Added JkWorkerProperty directive that enables omiting
  workers.properties file (same as for Apache2).
  For example: JkWorkerProperty worker.ajp13a.port=8009
  
  Revision  ChangesPath
  1.51  +44 -11jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c
  
  Index: mod_jk.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-1.3/mod_jk.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- mod_jk.c  9 Nov 2004 12:17:42 -   1.50
  +++ mod_jk.c  12 Nov 2004 08:42:47 -  1.51
  @@ -1383,6 +1383,27 @@
   return NULL;
   }
   
  +/*
  + * JkWorkerProperty Directive Handling
  + *
  + * JkWorkerProperty name=value
  + */
  +
  +static const char *jk_set_worker_property(cmd_parms * cmd,
  +  void *dummy,
  +  const char *line)
  +{
  +server_rec *s = cmd->server;
  +jk_server_conf_t *conf =
  +(jk_server_conf_t *) ap_get_module_config(s->module_config,
  +  &jk_module);
  +
  +if (jk_map_read_property(conf->worker_properties, line) == JK_FALSE)
  +return ap_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", line);
  +
  +return NULL;
  +}
  +
   static const command_rec jk_cmds[] = {
   /*
* JkWorkersFile specifies a full path to the location of the worker 
  @@ -1480,6 +1501,9 @@
   {"JkEnvVar", jk_add_env_var, NULL, RSRC_CONF, TAKE2,
"Adds a name of environment variable that should be sent to 
servlet-engine"},
   
  +{"JkWorkerProperty", jk_set_worker_property, NULL, RSRC_CONF, RAW_ARGS,
  + "Set worker.properties directive"},
  +
   {NULL}
   };
   
  @@ -1515,7 +1539,9 @@
   jk_worker_t *worker = wc_get_worker_for_name(worker_name, l);
   
   if (worker) {
  +#ifndef NO_GETTIMEOFDAY
   struct timeval tv_begin, tv_end;
  +#endif
   int rc = JK_FALSE;
   apache_private_data_t private_data;
   jk_ws_service_t s;
  @@ -1773,21 +1799,28 @@
   
   /*if(map_alloc(&init_map)) { */
   
  -if (jk_map_read_properties(init_map, conf->worker_file)) {
  +if (!jk_map_read_properties(init_map, conf->worker_file)) {
   
  +if (jk_map_size(init_map) == 0) {
  +ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
  + "No worker file and no worker options in httpd.conf 
\n"
  + "use JkWorkerFile to set workers\n");
  +return;
  +} 
  +
  +}
   #if MODULE_MAGIC_NUMBER >= 19980527
   /* Tell apache we're here */
  -ap_add_version_component(JK_EXPOSED_VERSION);
  +ap_add_version_component(JK_EXPOSED_VERSION);
   #endif
   
  -/* we add the URI->WORKER MAP since workers using AJP14 will feed it 
*/
  -worker_env.uri_to_worker = conf->uw_map;
  -worker_env.virtual = "*";   /* for now */
  -worker_env.server_name = (char *)ap_get_server_version();
  -if (wc_open(init_map, &worker_env, conf->log)) {
  -/* we don't need this any more so free it */
  -return;
  -}
  +/* we add the URI->WORKER MAP since workers using AJP14 will feed it */
  +worker_env.uri_to_worker = conf->uw_map;
  +worker_env.virtual = "*";   /* for now */
  +worker_env.server_name = (char *)ap_get_server_version();
  +if (wc_open(init_map, &worker_env, conf->log)) {
  +/* we don't need this any more so free it */
  +return;
   }
   
   ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/apache-2.0 mod_jk.c

2004-11-12 Thread mturk
mturk   2004/11/12 00:24:43

  Modified:jk/native/apache-2.0 mod_jk.c
  Log:
  Added JkWorkerProperty directive that enables omiting
  workers.properties file.
  For example: JkWorkerProperty worker.ajp13a.port=8009
  
  Revision  ChangesPath
  1.99  +26 -1 jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c
  
  Index: mod_jk.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- mod_jk.c  9 Nov 2004 12:17:43 -   1.98
  +++ mod_jk.c  12 Nov 2004 08:24:43 -  1.99
  @@ -1473,6 +1473,27 @@
   return NULL;
   }
   
  +/*
  + * JkWorkerProperty Directive Handling
  + *
  + * JkWorkerProperty name=value
  + */
  +
  +static const char *jk_set_worker_property(cmd_parms * cmd,
  +  void *dummy,
  +  const char *line)
  +{
  +server_rec *s = cmd->server;
  +jk_server_conf_t *conf =
  +(jk_server_conf_t *) ap_get_module_config(s->module_config,
  +  &jk_module);
  +
  +if (jk_map_read_property(conf->worker_properties, line) == JK_FALSE)
  +return apr_pstrcat(cmd->temp_pool, "Invalid JkWorkerProperty ", 
line);
  +
  +return NULL;
  +}
  +
   static const command_rec jk_cmds[] = {
   /*
* JkWorkersFile specifies a full path to the location of the worker
  @@ -1583,6 +1604,10 @@
   AP_INIT_TAKE2("JkEnvVar", jk_add_env_var, NULL, RSRC_CONF,
 "Adds a name of environment variable that should be sent "
 "to servlet-engine"),
  +
  +AP_INIT_RAW_ARGS("JkWorkerProperty", jk_set_worker_property,
  + NULL, RSRC_CONF,
  + "Set worker.properties directive"),
   
   {NULL}
   };
  
  
  

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