That's probably good.  However, I may have been a bit hasty in
my general condemnation of khttpd.  The following patch seems
to solve the nasty problems; perhaps removing khttpd can wait a bit.
(I only tested the patch briefly, but it makes a lot of sense,
and it did improve things here.)
- Dan
diff -aur linux-2.4.19-pre8.orig/net/khttpd/README linux-2.4.19-pre8/net/khttpd/README
--- linux-2.4.19-pre8.orig/net/khttpd/README	Mon May  6 11:37:33 2002
+++ linux-2.4.19-pre8/net/khttpd/README	Mon May  6 12:10:27 2002
@@ -44,6 +44,7 @@
  
    echo 1 > /proc/sys/net/khttpd/stop
    echo 1 > /proc/sys/net/khttpd/unload 
+   sleep 2
    rmmod khttpd
    
 
@@ -123,7 +124,9 @@
    ===============
    In order to change the configuration, you should stop kHTTPd by typing
    echo 1 > /proc/sys/net/khttpd/stop
-   on a command-prompt.
+   sleep 2
+   on a command-prompt.  (The sleep makes it more likely
+   that all kHTTPd threads notice the stop request.)
 
    If you want to unload the module, you should type
    echo 1 > /proc/sys/net/khttpd/unload
diff -aur linux-2.4.19-pre8.orig/net/khttpd/main.c linux-2.4.19-pre8/net/khttpd/main.c
--- linux-2.4.19-pre8.orig/net/khttpd/main.c	Mon May  6 11:37:33 2002
+++ linux-2.4.19-pre8/net/khttpd/main.c	Mon May  6 11:48:47 2002
@@ -226,6 +226,9 @@
 		if ( (signal_pending(current)) || (sysctl_khttpd_unload!=0) )
 		 	break;
 		 	
+		/* must clear 'stop' flag before starting threads!  -dank */
+		sysctl_khttpd_stop = 0;
+
 		/* Then start listening and spawn the daemons */
 		 	
 		if (StartListening(sysctl_khttpd_serverport)==0)
@@ -277,10 +278,20 @@
 		}
 		
 		/* Then wait for deactivation */
-		sysctl_khttpd_stop = 0;
 
 		while ( (sysctl_khttpd_stop==0) && (!signal_pending(current)) && (sysctl_khttpd_unload==0) )
 		{
+
+#if 0
+		/* FIXME This section seems to be here to restart worker 
+		 * threads that have died for any reason, but it has a bug:
+		 * if 'stop' is set briefly while this thread is asleep, and
+		 * a worker thread notices, it terminates and free its buffer,
+		 * and this thread will restart it without reallocating
+		 * its buffer.  This happened *every time* until I moved
+		 * the 'sysctl_khttpd_stop = 0' statement up above the thread
+		 * creation.  dank@kegel.com
+		 */
 			if (atomic_read(&DaemonCount)<ActualThreads)
 			{
 				I=0;
@@ -295,6 +306,8 @@
 					I++;
 				}
 			}
+#endif
+
 			interruptible_sleep_on_timeout(&WQ,HZ);
 			
 			/* reap the daemons */
diff -aur linux-2.4.19-pre8.orig/net/khttpd/waitheaders.c linux-2.4.19-pre8/net/khttpd/waitheaders.c
--- linux-2.4.19-pre8.orig/net/khttpd/waitheaders.c	Mon May  6 11:37:33 2002
+++ linux-2.4.19-pre8/net/khttpd/waitheaders.c	Mon May  6 11:54:23 2002
@@ -134,7 +134,7 @@
 		CurrentRequest = CurrentRequest->Next;
 	}
 
-	LeaveFunction("WaitHeaders");
+	LeaveFunction("WaitForHeaders");
 	return count;
 }
 
@@ -178,6 +178,12 @@
 	
 	EnterFunction("DecodeHeader");
 	
+	if (Buffer[CPUNR] == NULL) {
+		/* see comments in main.c regarding buffer managemnet - dank */
+		printk(KERN_CRIT "khttpd: lost my buffer");
+		BUG();
+	}
+
 	/* First, read the data */
 
 	msg.msg_name     = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/