httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Bley <>
Subject Re: Question: error checking: how important? [PATCH]
Date Sat, 06 Mar 1999 16:34:48 GMT
On Sat, 6 Mar 1999 wrote:

> Exactly how to log is also a problem.  This routine takes no
> dynamic context info so you can't record the request or the
> server that was deluded into thinking the directory in question
> was useful.

Well, roughly 18% of the ap_log_error calls in main/ are also lacking 
this information... even if a log message can't provide specific 
information along these lines, it will have a log context, and this at 
least leaves some clues ("always crashing when a lynx user requests this CGI"
or something...)

> Few programs include code to handle errors that if they occur
> the entire enterprise is a hopeless mess.  So for example the
> calls on dup2 fall into that catagory.  Programs willing to
> call longjmp at the error site sometimes do, but they are rare.

Excellent point - in some cases, the process won't be able to log the 
error at all, and as Jim pointed out, in other cases in makes more sense 
to do something other than log - try again or switch tactics.  But if the 
dup2 situation is hopeless, why does the WIN32 code log for it but the 
Unix code doesn't?

I was somewhat appalled to discover that (for a default configuration on 
Solaris2.6 anyway) there are 139 calls to these 28 functions whose 
return values are ignored:
chdir close closedir dlclose dup2 execl execle execve fclose fflush fputc 
fputs fseek getrlimit kill munmap select sigaddset sigemptyset signal 
sigsetjmp sleep strftime times ungetc unlink waitpid write 

> So I'm sure we would love to see cases where you think that
> the judgement call made was deluded!
> One at a time.

Here's one.  138 more to look at.

diff -Burp apache-1.3/src/main/http_core.c apache-1.3-patched/src/main/http_core.c
--- apache-1.3/src/main/http_core.c	Wed Feb 24 09:12:26 1999
+++ apache-1.3-patched/src/main/http_core.c	Sat Mar  6 11:10:16 1999
@@ -2937,7 +2937,10 @@ static void mmap_cleanup(void *mmv)
     struct mmap *mmd = mmv;
-    munmap(mmd->mm, mmd->length);
+    if(munmap(mmd->mm, mmd->length))
+	ap_log_error(APLOG_MARK, APLOG_ERR, NULL, 
+		"Couldn't munmap memory of length %d at 0x%x", 
+		mmd->length, mmd->mm);
John Bley -
Duke '99 - English/Computer Science
  Since English is a mess, it maps well onto the problem space,
  which is also a mess, which we call reality.     - Larry Wall

View raw message