httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject [PATCH] PR#467: serialized accept
Date Sat, 25 Oct 1997 02:49:51 GMT
This patch informs folks when they're in danger, putting the onus on them
to figure out a solution to this problem for their system.  This lets us
close out this PR and remove it from known_bugs.

I know there's still an issue with flock(), but I'm assuming that Marc is
working on that, and it's somewhat orthogonal to this. 

Dean

Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apachen/src/CHANGES,v
retrieving revision 1.471
diff -u -r1.471 CHANGES
--- CHANGES	1997/10/25 01:52:41	1.471
+++ CHANGES	1997/10/25 02:45:19
@@ -1,5 +1,9 @@
 Changes with Apache 1.3b3
 
+  *) PORT: "Fix" PR#467 by generating warnings on systems which we have
+     not been able to get working USE_*_SERIALIZED_ACCEPT settings for.
+     Document this a bit more in src/PORTING.  [Dean Gaudet] PR#467
+
   *) PORT: AIX now uses USE_FCNTL_SERIALIZED_ACCEPT. PR#849
      PORT: i386 AIX does not have memmove. PR#1267
      PORT: HPUX now defaults to using Spencer regex.  PR#482, 1246
Index: PORTING
===================================================================
RCS file: /export/home/cvs/apachen/src/PORTING,v
retrieving revision 1.13
diff -u -r1.13 PORTING
--- PORTING	1997/09/30 23:24:49	1.13
+++ PORTING	1997/10/25 02:45:20
@@ -203,42 +203,44 @@
   These #defines are used for functions and ability that aren't exactly
   required but should be used.
 
+     USE_LONGJMP:
+      Define to use the longjmp() call instead of siglongjmp()
+      (as well as setjmp() instead of sigsetjmp()).
+
+     USE_MMAP_FILES:
+      Enable the use of mmap() for sending static files.
+
+ USE_*_SERIALIZED_ACCEPT:
+  See htdocs/manual/misc/perf-tuning.html for an in-depth discussion of
+  why these are required.  These are choices for implementing a semaphore
+  between children entering accept().  A complete port should define one
+  of these, many may work and it's worthwhile timing them.  Without these
+  the server will not implement multiple Listen directives reliably.
+
      USE_FCNTL_SERIALIZED_ACCEPT:
-      Define if the OS requires a mutex "lock" around the socket accept()
-      call. Use fcntl() locking.  See htdocs/manual/misc/perf-tuning.html.
+      Use fcntl() to implement the semaphore.
 
      USE_FLOCK_SERIALIZED_ACCEPT:
-      Define if the OS requires a mutex "lock" around the socket accept()
-      call. Use flock() locking (fcntl() is expensive on some OSs, esp.
-      when using NFS).  See htdocs/manual/misc/perf-tuning.html.
+      Use flock() to implement the semaphore (fcntl() is expensive on
+      some OSs, esp.  when using NFS).
 
      USE_USLOCK_SERIALIZED_ACCEPT:
       Probably IRIX only: use uslock() to serialize, which is far faster
       on multiprocessor boxes (and far slower on uniprocessor, yay).
-      See htdocs/manual/misc/perf-tuning.html.
 
      USE_SYSVSEM_SERIALIZED_ACCEPT:
-      Use System V semaphores to serialize accept.  These are problematic
-      in that they won't be cleaned up if apache is kill -9d, and there's
-      the potential of a CGI causing a denial of service attack if it's
-      running as the same uid as apache (i.e. suexec is recommended on
-      public servers).
-      See htdocs/manual/misc/perf-tuning.html.
-     
+      Use System V semaphores to implement the semaphore.  These are
+      problematic in that they won't be cleaned up if apache is kill -9d,
+      and there's the potential of a CGI causing a denial of service
+      attack if it's running as the same uid as apache (i.e. suexec
+      is recommended on public servers).  But they can be faster than
+      either of fcntl() or flock() on some systems.
+
      USE_PTHREADS_SERIALIZED_ACCEPT:
-      Use POSIX mutexes to serialize accept.
-      See htdocs/manual/misc/perf-tuning.html.
+      Use POSIX mutexes to implement the semaphore.
 
      SAFE_UNSERIALIZED_ACCEPT:
       It's safe to unserialize single-socket accept().
-      See htdocs/manual/misc/perf-tuning.html.
-
-     USE_LONGJMP:
-      Define to use the longjmp() call instead of siglongjmp()
-      (as well as setjmp() instead of sigsetjmp()).
-
-     USE_MMAP_FILES:
-      Enable the use of mmap() for sending static files.
 
 --
 
Index: main/http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.237
diff -u -r1.237 http_main.c
--- http_main.c	1997/10/22 20:29:40	1.237
+++ http_main.c	1997/10/25 02:45:24
@@ -609,6 +609,7 @@
 /* Default --- no serialization.  Other methods *could* go here,
  * as #elifs...
  */
+#define NO_SERIALIZED_ACCEPT
 #define accept_mutex_cleanup()
 #define accept_mutex_init(x)
 #define accept_mutex_on()
@@ -2484,6 +2485,18 @@
     lr->next = listeners;
     head_listener = listeners;
     close_unused_listeners();
+
+#ifdef NO_SERIALIZED_ACCEPT
+    /* warn them about the starvation problem if they're using multiple
+     * sockets
+     */
+    if (listeners->next != listeners) {
+	aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_CRIT, NULL,
+		    "You cannot use multiple Listens safely on your system, "
+		    "proceeding anyway.  See src/PORTING, search for "
+		    "SERIALIZED_ACCEPT.");
+    }
+#endif
 }
 
 




Mime
View raw message