>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 -0000 1.15
> +++ jk_ajp13_worker.c 10 Nov 2004 15:24:17 -0000 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 Changes Path
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 -0000 1.15
+++ jk_ajp13_worker.c 10 Nov 2004 15:24:17 -0000 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]