cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp13_worker.c jk_ajp14.h jk_ajp14_worker.c jk_ajp_common.c

2005-02-06 Thread mturk
mturk   2005/02/06 05:45:11

  Modified:jk/native/common jk_ajp13_worker.c jk_ajp14.h
jk_ajp14_worker.c jk_ajp_common.c
  Log:
  Remove unneeded strdup's by changing some properties to const char..
  
  Revision  ChangesPath
  1.23  +2 -10 
jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c
  
  Index: jk_ajp13_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- jk_ajp13_worker.c 6 Feb 2005 09:37:59 -   1.22
  +++ jk_ajp13_worker.c 6 Feb 2005 13:45:11 -   1.23
  @@ -95,15 +95,7 @@
   return JK_FALSE;
   }
   
  -aw->name = strdup(name);
  -
  -if (!aw->name) {
  -free(aw);
  -jk_log(l, JK_LOG_ERROR, "malloc failed");
  -JK_TRACE_EXIT(l);
  -return JK_FALSE;
  -}
  -
  +aw->name = name;
   aw->proto = AJP13_PROTO;
   aw->login = NULL;
   
  
  
  
  1.16  +3 -3  jakarta-tomcat-connectors/jk/native/common/jk_ajp14.h
  
  Index: jk_ajp14.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_ajp14.h10 Nov 2004 16:36:48 -  1.15
  +++ jk_ajp14.h6 Feb 2005 13:45:11 -   1.16
  @@ -216,7 +216,7 @@
   /*
*  Pointer to web-server name
*/
  -char *web_server_name;
  +const char *web_server_name;
   
   /*
* Pointer to servlet-engine name
  @@ -226,7 +226,7 @@
   /*
* Pointer to secret key
*/
  -char *secret_key;
  +const char *secret_key;
   
   /*
* Received entropy seed
  
  
  
  1.27  +2 -13 
jakarta-tomcat-connectors/jk/native/common/jk_ajp14_worker.c
  
  Index: jk_ajp14_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14_worker.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- jk_ajp14_worker.c 6 Feb 2005 13:30:34 -   1.26
  +++ jk_ajp14_worker.c 6 Feb 2005 13:45:11 -   1.27
  @@ -310,7 +310,7 @@
  JK_RETRIES);
   
   /* Set Secret Key (used at logon time) */
  -aw->login->secret_key = strdup(jk_get_worker_secret_key(props, 
aw->name));
  +aw->login->secret_key = jk_get_worker_secret_key(props, aw->name);
   
   if (aw->login->secret_key == NULL) {
   jk_log(l, JK_LOG_ERROR, "can't malloc secret_key");
  @@ -357,17 +357,6 @@
   JK_TRACE_ENTER(l);
   
   if (aw->login) {
  -
  -if (aw->login->web_server_name) {
  -free(aw->login->web_server_name);
  -aw->login->web_server_name = NULL;
  -}
  -
  -if (aw->login->secret_key) {
  -free(aw->login->secret_key);
  -aw->login->secret_key = NULL;
  -}
  -
   free(aw->login);
   aw->login = NULL;
   }
  
  
  
  1.75  +5 -1  
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.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- jk_ajp_common.c   6 Feb 2005 13:30:34 -   1.74
  +++ jk_ajp_common.c   6 Feb 2005 13:45:11 -   1.75
  @@ -1899,6 +1899,10 @@
   }
   
   if (aw->login) {
  + /* take care of removing previously allocated data */
  +if (aw->login->servlet_engine_name)
  +free(aw->login->servlet_engine_name);
  +
   free(aw->login);
   aw->login = NULL;
   }
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp13_worker.c jk_ajp14.c jk_ajp14_worker.c jk_ajp_common.c jk_jni_worker.c jk_lb_worker.c

2004-11-26 Thread mturk
mturk   2004/11/26 08:59:52

  Modified:jk/native/common jk_ajp13_worker.c jk_ajp14.c
jk_ajp14_worker.c jk_ajp_common.c jk_jni_worker.c
jk_lb_worker.c
  Log:
  Use calloc instead malloc for initalizing stucts, so we can use default zeros
  
  Revision  ChangesPath
  1.21  +4 -3  
jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c
  
  Index: jk_ajp13_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- jk_ajp13_worker.c 19 Nov 2004 12:58:18 -  1.20
  +++ jk_ajp13_worker.c 26 Nov 2004 16:59:51 -  1.21
  @@ -78,7 +78,7 @@
   int JK_METHOD ajp13_worker_factory(jk_worker_t **w,
  const char *name, jk_logger_t *l)
   {
  -ajp_worker_t *aw = (ajp_worker_t *) malloc(sizeof(ajp_worker_t));
  +ajp_worker_t *aw;
   
   JK_TRACE_ENTER(l);
   if (name == NULL || w == NULL) {
  @@ -86,7 +86,8 @@
   JK_TRACE_EXIT(l);
   return JK_FALSE;
   }
  -
  +
  +aw = (ajp_worker_t *) calloc(1, sizeof(ajp_worker_t));
   if (!aw) {
   jk_log(l, JK_LOG_ERROR,
  "malloc of private_data failed\n");
  
  
  
  1.24  +6 -6  jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c
  
  Index: jk_ajp14.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- jk_ajp14.c11 Nov 2004 17:43:01 -  1.23
  +++ jk_ajp14.c26 Nov 2004 16:59:51 -  1.24
  @@ -417,7 +417,7 @@
   JK_TRACE_ENTER(l);
   jk_log(l, JK_LOG_DEBUG,
  "get virtual %s for virtual %s\n",
  -   vname, c->virtual);
  +   vname, c->virt);
   
   if (!vname) {
   jk_log(l, JK_LOG_ERROR,
  @@ -427,7 +427,7 @@
   }
   
   /* Check if we get the correct virtual host */
  -if (c->virtual != NULL && vname != NULL && strcmp(c->virtual, vname)) {
  +if (c->virt != NULL && vname != NULL && strcmp(c->virt, vname)) {
   /* set the virtual name, better to add to a virtual list ? */
   
   if (context_set_virtual(c, vname) == JK_FALSE) {
  @@ -536,7 +536,7 @@
   /*
* VIRTUAL HOST CSTRING
*/
  -if (jk_b_append_string(msg, c->virtual)) {
  +if (jk_b_append_string(msg, c->virt)) {
   jk_log(l, JK_LOG_ERROR,
  "failed appending the virtual host string\n");
   JK_TRACE_EXIT(l);
  @@ -628,10 +628,10 @@
   }
   
   /* Check if we speak about the correct virtual */
  -if (strcmp(c->virtual, vname)) {
  +if (strcmp(c->virt, vname)) {
   jk_log(l, JK_LOG_ERROR,
  "incorrect virtual %s instead of %s\n",
  -   vname, c->virtual);
  +   vname, c->virt);
   JK_TRACE_EXIT(l);
   return JK_FALSE;
   }
  
  
  
  1.24  +3 -2  
jakarta-tomcat-connectors/jk/native/common/jk_ajp14_worker.c
  
  Index: jk_ajp14_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14_worker.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- jk_ajp14_worker.c 19 Nov 2004 12:58:18 -  1.23
  +++ jk_ajp14_worker.c 26 Nov 2004 16:59:51 -  1.24
  @@ -380,7 +380,7 @@
   int JK_METHOD ajp14_worker_factory(jk_worker_t **w,
  const char *name, jk_logger_t *l)
   {
  -ajp_worker_t *aw = (ajp_worker_t *) malloc(sizeof(ajp_worker_t));
  +ajp_worker_t *aw;
   
   JK_TRACE_ENTER(l);
   
  @@ -390,6 +390,7 @@
   return JK_FALSE;
   }
   
  +aw = (ajp_worker_t *) calloc(1, sizeof(ajp_worker_t));
   if (!aw) {
   jk_log(l, JK_LOG_ERROR,
  "malloc of private data failed\n");
  
  
  
  1.65  +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.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- jk_ajp_common.c   19 Nov 2004 12:59:15 -  1.64
  +++ jk_ajp_common.c   26 Nov 2004 16:59:51 -  1.65
  @@ -1947,7 +1947,7 @@
   }
   }
   
  -ae = (ajp_endpoint_t *) malloc(sizeof(ajp_endpoint_t));
  +ae = (ajp_endpoint_t *) calloc(1, sizeof(ajp_endpoint_t));
   if (ae) {
   ae->sd = -1;
   ae->reuse = JK_FALSE;
  
  
  
  1.29  +4 -3  
jakarta-tomcat-connectors/jk/native/com

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

2004-11-11 Thread Cindy Brzozowski
TAKE MY EMAIL OFF OF YOUR LIST. THANK YOU

Costin Manolache <[EMAIL PROTECTED]> wrote:Mladen Turk wrote:
> jean-frederic clere wrote:
> 
>> Mladen Turk wrote:
>>
>>> Costin Manolache wrote:
>>>
 Are you joking :-) ?
>>>
>>>
>>> If we can not alloc couple of bytes from the system, then the
>>> entire system is unstable.
>>
>>
>> Or that the process that makes the malloc() has reached a configurable 
>> limit of the amount of memory it is allowed to use.
>>
> 
> 
> Sure, but the system is still unusable.
> 
> This checking is done inside worker_factory, called from init_jk,
> so IMHO the apache will fail long before.
> 
> But if everyone thinks it's a good to check for failed memory
> allocation on small objects, I'll revert the patch.
> 

Well, I see your point - probably it doesn't matter much, I'm sure other 
places in code will not check and it would crash anyway. Most OSes use 
swap, so the system will trash and become unuseable before running out 
of memory. But there are other cases where the swap is not used - and 
then malloc failure is a common condition under load.

If the system is very loaded, it is possible you'll run low on memory 
and you don't know which malloc will fail - maybe the small one. The 
correct behavior would be to give up and return a 500 on the request ( 
that may go through since apache probably already have the memory 
allocated in the memory pools ). On single process/multithread systesm, 
an apache server crashing under load is not a good thing :-)

IMO all mallocs should be checked - but probably I spend too much time 
with systems with very little memory where a crash is not such a good 
thing :-)

Costin
Costin







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




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

2004-11-11 Thread mturk
mturk   2004/11/11 09:28:59

  Modified:jk/native/common jk_ajp13_worker.c
  Log:
  Add new trace macros and clean up some log messages.
  
  Revision  ChangesPath
  1.19  +23 -14
jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c
  
  Index: jk_ajp13_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- jk_ajp13_worker.c 10 Nov 2004 16:36:48 -  1.18
  +++ jk_ajp13_worker.c 11 Nov 2004 17:28:59 -  1.19
  @@ -30,8 +30,11 @@
 jk_map_t *props,
 jk_worker_env_t *we, jk_logger_t *l)
   {
  +int rc;
   JK_TRACE_ENTER(l);
  -return (ajp_validate(pThis, props, we, l, AJP13_PROTO));
  +rc = ajp_validate(pThis, props, we, l, AJP13_PROTO);
  +JK_TRACE_EXIT(l);
  +return rc;
   }
   
   
  @@ -39,23 +42,32 @@
 jk_map_t *props,
 jk_worker_env_t *we, jk_logger_t *l)
   {
  +int rc;
   JK_TRACE_ENTER(l);
  -return (ajp_init(pThis, props, we, l, AJP13_PROTO));
  +rc = ajp_init(pThis, props, we, l, AJP13_PROTO);
  +JK_TRACE_EXIT(l);
  +return rc;
   }
   
   
   static int JK_METHOD destroy(jk_worker_t **pThis, jk_logger_t *l)
   {
  +int rc;
   JK_TRACE_ENTER(l);
  -return (ajp_destroy(pThis, l, AJP13_PROTO));
  +rc = ajp_destroy(pThis, l, AJP13_PROTO);
  +JK_TRACE_EXIT(l);
  +return rc;
   }
   
   
   static int JK_METHOD get_endpoint(jk_worker_t *pThis,
 jk_endpoint_t **pend, jk_logger_t *l)
   {
  +int rc;
   JK_TRACE_ENTER(l);
  -return (ajp_get_endpoint(pThis, pend, l, AJP13_PROTO));
  +rc = ajp_get_endpoint(pThis, pend, l, AJP13_PROTO);
  +JK_TRACE_EXIT(l);
  +return rc;
   }
   
   int JK_METHOD ajp13_worker_factory(jk_worker_t **w,
  @@ -65,29 +77,26 @@
   
   JK_TRACE_ENTER(l);
   if (name == NULL || w == NULL) {
  -jk_log(l, JK_LOG_ERROR, "In ajp13_worker_factory, NULL 
parameters\n");
  +JK_LOG_NULL_PARAMS(l);
  +JK_TRACE_EXIT(l);
   return JK_FALSE;
   }
   
   if (!aw) {
   jk_log(l, JK_LOG_ERROR,
  -   "In ajp13_worker_factory, malloc of private_data failed\n");
  +   "malloc of private_data failed\n");
  +JK_TRACE_EXIT(l);
   return JK_FALSE;
   }
   
   aw->name = strdup(name);
   
  -/* Lets core dump for every malloc.
  -   If we can not allocate few bytes what's the purpose
  -   to keep anyhow and waste cpr cycles
  - */
  -#if 0
   if (!aw->name) {
   free(aw);
  -jk_log(l, JK_LOG_ERROR, "In ajp13_worker_factory, malloc failed\n");
  +jk_log(l, JK_LOG_ERROR, "malloc failed\n");
  +JK_TRACE_EXIT(l);
   return JK_FALSE;
   }
  -#endif
   
   aw->proto = AJP13_PROTO;
   aw->login = NULL;
  
  
  

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



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

2004-11-11 Thread Costin Manolache
Mladen Turk wrote:
jean-frederic clere wrote:
Mladen Turk wrote:
Costin Manolache wrote:
Are you joking :-) ?

If we can not alloc couple of bytes from the system, then the
entire system is unstable.

Or that the process that makes the malloc() has reached a configurable 
limit of the amount of memory it is allowed to use.


Sure, but the system is still unusable.
This checking is done inside worker_factory, called from init_jk,
so IMHO the apache will fail long before.
But if everyone thinks it's a good to check for failed memory
allocation on small objects, I'll revert the patch.
Well, I see your point - probably it doesn't matter much, I'm sure other 
places in code will not check and it would crash anyway. Most OSes use 
swap, so the system will trash and become unuseable before running out 
of memory. But there are other cases where the swap is not used - and 
then malloc failure is a common condition under load.

If the system is very loaded, it is possible you'll run low on memory 
and you don't know which malloc will fail - maybe the small one. The 
correct behavior would be to give up and return a 500 on the request ( 
that may go through since apache probably already have the memory 
allocated in the memory pools ). On single process/multithread systesm, 
an apache server crashing under load is not a good thing :-)

IMO all mallocs should be checked - but probably I spend too much time 
with systems with very little memory where a crash is not such a good 
thing :-)

Costin
Costin



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


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

2004-11-10 Thread Mladen Turk
jean-frederic clere wrote:
Mladen Turk wrote:
Costin Manolache wrote:
Are you joking :-) ?
If we can not alloc couple of bytes from the system, then the
entire system is unstable.
Or that the process that makes the malloc() has reached a configurable 
limit of the amount of memory it is allowed to use.


Sure, but the system is still unusable.
This checking is done inside worker_factory, called from init_jk,
so IMHO the apache will fail long before.
But if everyone thinks it's a good to check for failed memory
allocation on small objects, I'll revert the patch.
MT.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2004-11-10 Thread jean-frederic clere
Mladen Turk wrote:
Costin Manolache wrote:
Mladen Turk wrote:
David Rees wrote:
Are you sure it's a good idea to wait until it crashes rather than 
fail in a controlled method?  How much overhead is there to check 
aw->name for NULL?  Can't be much...

Yes I am.
Look, if the system can not alloc 1000 bytes of memory what's
the purpose to continue?
Mt.

Are you joking :-) ?
No :).
It would make sense if we expect that malloc call might fail due
the fact that we are trying to alloc potentially large memory and
then fall back.
If we can not alloc couple of bytes from the system, then the
entire system is unstable.
Or that the process that makes the malloc() has reached a configurable limit of 
the amount of memory it is allowed to use.

Just look at httpd or apr sources. There's almost no checks for
malloc success on small objects. They are presumed to return valid
memory block.
At least do an printf and exit(), coredump is never good  (some 
systems don't collect the core - so the user will have no idea what 
just happened ).

Well, IMO it would fail long before our module is called.
Also on first write to NULL every system will give the user a pretty
good warning thought :).
MT.
-
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]


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

2004-11-10 Thread Mladen Turk
Costin Manolache wrote:
Mladen Turk wrote:
David Rees wrote:
Are you sure it's a good idea to wait until it crashes rather than 
fail in a controlled method?  How much overhead is there to check 
aw->name for NULL?  Can't be much...

Yes I am.
Look, if the system can not alloc 1000 bytes of memory what's
the purpose to continue?
Mt.

Are you joking :-) ?
No :).
It would make sense if we expect that malloc call might fail due
the fact that we are trying to alloc potentially large memory and
then fall back.
If we can not alloc couple of bytes from the system, then the
entire system is unstable.
Just look at httpd or apr sources. There's almost no checks for
malloc success on small objects. They are presumed to return valid
memory block.
At least do an printf and exit(), coredump is never good  (some systems 
don't collect the core - so the user will have no idea what just 
happened ).

Well, IMO it would fail long before our module is called.
Also on first write to NULL every system will give the user a pretty
good warning thought :).
MT.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2004-11-10 Thread Costin Manolache
Mladen Turk wrote:
David Rees wrote:
Are you sure it's a good idea to wait until it crashes rather than 
fail in a controlled method?  How much overhead is there to check 
aw->name for NULL?  Can't be much...

Yes I am.
Look, if the system can not alloc 1000 bytes of memory what's
the purpose to continue?
Mt.
Are you joking :-) ?
At least do an printf and exit(), coredump is never good  (some systems 
don't collect the core - so the user will have no idea what just 
happened ).

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


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

2004-11-10 Thread Mladen Turk
David Rees wrote:
Are you sure it's a good idea to wait until it crashes rather than fail 
in a controlled method?  How much overhead is there to check aw->name 
for NULL?  Can't be much...

Yes I am.
Look, if the system can not alloc 1000 bytes of memory what's
the purpose to continue?
Mt.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

2004-11-10 Thread David Rees
[EMAIL PROTECTED] wrote, On 11/10/2004 7:24 AM:
mturk   2004/11/10 07:24:17
  Modified:jk/native/common jk_ajp13_worker.c
  Log:
  Use new TRACE/DEBUG logging.
  Also skip checking for memory allocation.
  If we can not allocate enough memory it's better to core dump
  then try to continue. At some point we'll core dump anyhow, so
  why waste CPU cycles on things that are unrecoverable?
>
>   --- jk_ajp13_worker.c	8 Oct 2004 07:50:39 -	1.15
>   +++ jk_ajp13_worker.c	10 Nov 2004 15:24:17 -	1.16
>   @@ -74,11 +75,17 @@
>
>aw->name = strdup(name);
>
>   +	/* Lets core dump for every malloc.
>   +	   If we can not allocate few bytes what's the purpose
>   +	   to keep anyhow and waste cpr cycles
>   +	 */
>   +#if 0
>if (!aw->name) {
>free(aw);
>jk_log(l, JK_LOG_ERROR, "In ajp13_worker_factory, malloc 
failed\n");
>return JK_FALSE;
>}
>   +#endif
>
>aw->proto = AJP13_PROTO;
>aw->login = NULL;

Are you sure it's a good idea to wait until it crashes rather than fail 
in a controlled method?  How much overhead is there to check aw->name 
for NULL?  Can't be much...

-Dave
  Revision  ChangesPath
  1.16  +13 -3 jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c
  
  Index: jk_ajp13_worker.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_ajp13_worker.c	8 Oct 2004 07:50:39 -	1.15
  +++ jk_ajp13_worker.c	10 Nov 2004 15:24:17 -	1.16
  @@ -59,8 +59,9 @@
   {
   ajp_worker_t *aw = (ajp_worker_t *) malloc(sizeof(ajp_worker_t));
   
  -jk_log(l, JK_LOG_DEBUG, "Into ajp13_worker_factory\n");
  -
  +#ifdef JK_TRACE
  +jk_log(l, JK_LOG_TRACE, "enter ajp13_worker_factory\n");
  +#endif
   if (name == NULL || w == NULL) {
   jk_log(l, JK_LOG_ERROR, "In ajp13_worker_factory, NULL parameters\n");
   return JK_FALSE;

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


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

2004-11-10 Thread mturk
mturk   2004/11/10 07:47:56

  Modified:jk/native/common jk_ajp13_worker.c jk_ajp14.c jk_logger.h
  Log:
  Use new TRACE macros.
  
  Revision  ChangesPath
  1.17  +6 -6  
jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c
  
  Index: jk_ajp13_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- jk_ajp13_worker.c 10 Nov 2004 15:24:17 -  1.16
  +++ jk_ajp13_worker.c 10 Nov 2004 15:47:56 -  1.17
  @@ -30,6 +30,7 @@
 jk_map_t *props,
 jk_worker_env_t *we, jk_logger_t *l)
   {
  + JK_TRACE_ENTER(l);
   return (ajp_validate(pThis, props, we, l, AJP13_PROTO));
   }
   
  @@ -38,12 +39,14 @@
 jk_map_t *props,
 jk_worker_env_t *we, jk_logger_t *l)
   {
  + JK_TRACE_ENTER(l);
   return (ajp_init(pThis, props, we, l, AJP13_PROTO));
   }
   
   
   static int JK_METHOD destroy(jk_worker_t **pThis, jk_logger_t *l)
   {
  + JK_TRACE_ENTER(l);
   return (ajp_destroy(pThis, l, AJP13_PROTO));
   }
   
  @@ -51,6 +54,7 @@
   static int JK_METHOD get_endpoint(jk_worker_t *pThis,
 jk_endpoint_t **pend, jk_logger_t *l)
   {
  + JK_TRACE_ENTER(l);
   return (ajp_get_endpoint(pThis, pend, l, AJP13_PROTO));
   }
   
  @@ -59,9 +63,7 @@
   {
   ajp_worker_t *aw = (ajp_worker_t *) malloc(sizeof(ajp_worker_t));
   
  -#ifdef JK_TRACE
  -jk_log(l, JK_LOG_TRACE, "enter ajp13_worker_factory\n");
  -#endif
  + JK_TRACE_ENTER(l);
   if (name == NULL || w == NULL) {
   jk_log(l, JK_LOG_ERROR, "In ajp13_worker_factory, NULL 
parameters\n");
   return JK_FALSE;
  @@ -103,8 +105,6 @@
   aw->logon = NULL;   /* No Logon on AJP13 */
   
   *w = &aw->worker;
  -#ifdef JK_TRACE
  -jk_log(l, JK_LOG_TRACE, "exit ajp13_worker_factory\n");
  -#endif
  + JK_TRACE_EXIT(l);
   return JK_TRUE;
   }
  
  
  
  1.21  +32 -12jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c
  
  Index: jk_ajp14.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp14.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- jk_ajp14.c8 Oct 2004 07:50:39 -   1.20
  +++ jk_ajp14.c10 Nov 2004 15:47:56 -  1.21
  @@ -34,11 +34,13 @@
   
   void ajp14_compute_md5(jk_login_service_t *s, jk_logger_t *l)
   {
  + JK_TRACE_ENTER(l);
   jk_md5((const unsigned char *)s->entropy,
  (const unsigned char *)s->secret_key, s->computed_key);
   
   jk_log(l, JK_LOG_DEBUG, "Into ajp14_compute_md5 (%s/%s) -> (%s)\n",
  s->entropy, s->secret_key, s->computed_key);
  + JK_TRACE_EXIT(l);
   }
   
   
  @@ -54,8 +56,7 @@
   int ajp14_marshal_login_init_into_msgb(jk_msg_buf_t *msg,
  jk_login_service_t *s, jk_logger_t *l)
   {
  -jk_log(l, JK_LOG_DEBUG, "Into ajp14_marshal_login_init_into_msgb\n");
  -
  + JK_TRACE_ENTER(l);
   /* To be on the safe side */
   jk_b_reset(msg);
   
  @@ -80,6 +81,7 @@
   return JK_FALSE;
   }
   
  + JK_TRACE_EXIT(l);
   return JK_TRUE;
   }
   
  @@ -96,6 +98,8 @@
   int ajp14_unmarshal_login_seed(jk_msg_buf_t *msg,
  jk_login_service_t *s, jk_logger_t *l)
   {
  + JK_TRACE_ENTER(l);
  +
   if (jk_b_get_bytes
   (msg, (unsigned char *)s->entropy, AJP14_ENTROPY_SEED_LEN) < 0) {
   jk_log(l, JK_LOG_ERROR,
  @@ -104,6 +108,7 @@
   }
   
   s->entropy[AJP14_ENTROPY_SEED_LEN] = 0; /* Just to have a CString */
  + JK_TRACE_EXIT(l);
   return JK_TRUE;
   }
   
  @@ -119,7 +124,7 @@
   int ajp14_marshal_login_comp_into_msgb(jk_msg_buf_t *msg,
  jk_login_service_t *s, jk_logger_t *l)
   {
  -jk_log(l, JK_LOG_DEBUG, "Into ajp14_marshal_login_comp_into_msgb\n");
  + JK_TRACE_ENTER(l);
   
   /* To be on the safe side */
   jk_b_reset(msg);
  @@ -141,6 +146,7 @@
   return JK_FALSE;
   }
   
  + JK_TRACE_EXIT(l);
   return JK_TRUE;
   }
   
  @@ -160,6 +166,8 @@
   unsigned long nego;
   char *sname;
   
  + JK_TRACE_ENTER(l);
  +
   nego = jk_b_get_long(msg);
   
   if (nego == 0x) {
  @@ -187,6 +195,7 @@
   return JK_FALSE;
   }
   
  + JK_TRACE_EXIT(l);
   return JK_TRUE;
   }
   
  @@ -204,7 +213,7 @@
   {
   unsigned long status;
   
  -jk_log(l, JK_LOG_DEBUG, "Into ajp14_unmarshal_log_nok\n");
  + JK_TRACE_ENTER(l);
   
   status = jk_b_get_long(msg);
   
  @@ -216,6 +225,7 @@
   
   jk_log(l, JK_LOG_I

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

2004-11-10 Thread mturk
mturk   2004/11/10 07:24:17

  Modified:jk/native/common jk_ajp13_worker.c
  Log:
  Use new TRACE/DEBUG logging.
  Also skip checking for memory allocation.
  If we can not allocate enough memory it's better to core dump
  then try to continue. At some point we'll core dump anyhow, so
  why waste CPU cycles on things that are unrecoverable?
  
  Revision  ChangesPath
  1.16  +13 -3 
jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c
  
  Index: jk_ajp13_worker.c
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp13_worker.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_ajp13_worker.c 8 Oct 2004 07:50:39 -   1.15
  +++ jk_ajp13_worker.c 10 Nov 2004 15:24:17 -  1.16
  @@ -59,8 +59,9 @@
   {
   ajp_worker_t *aw = (ajp_worker_t *) malloc(sizeof(ajp_worker_t));
   
  -jk_log(l, JK_LOG_DEBUG, "Into ajp13_worker_factory\n");
  -
  +#ifdef JK_TRACE
  +jk_log(l, JK_LOG_TRACE, "enter ajp13_worker_factory\n");
  +#endif
   if (name == NULL || w == NULL) {
   jk_log(l, JK_LOG_ERROR, "In ajp13_worker_factory, NULL 
parameters\n");
   return JK_FALSE;
  @@ -74,11 +75,17 @@
   
   aw->name = strdup(name);
   
  + /* Lets core dump for every malloc.
  +If we can not allocate few bytes what's the purpose
  +to keep anyhow and waste cpr cycles
  +  */
  +#if 0
   if (!aw->name) {
   free(aw);
   jk_log(l, JK_LOG_ERROR, "In ajp13_worker_factory, malloc failed\n");
   return JK_FALSE;
   }
  +#endif
   
   aw->proto = AJP13_PROTO;
   aw->login = NULL;
  @@ -96,5 +103,8 @@
   aw->logon = NULL;   /* No Logon on AJP13 */
   
   *w = &aw->worker;
  +#ifdef JK_TRACE
  +jk_log(l, JK_LOG_TRACE, "exit ajp13_worker_factory\n");
  +#endif
   return JK_TRUE;
   }
  
  
  

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