dgaudet 97/10/27 11:10:38
Modified: src CHANGES Configure PORTING
src/main http_main.c
Log:
"Fix" PR#467 by generating a warning when the configuration/architecture
demands it.
PR: 467
Reviewed by: Paul Sutton, Jim Jagielski
Revision Changes Path
1.478 +4 -0 apachen/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apachen/src/CHANGES,v
retrieving revision 1.477
retrieving revision 1.478
diff -u -r1.477 -r1.478
--- CHANGES 1997/10/27 19:06:21 1.477
+++ CHANGES 1997/10/27 19:10:32 1.478
@@ -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
+
*) Ensure that one copy of config warnings makes it to the
error_log. [Dean Gaudet]
1.165 +1 -1 apachen/src/Configure
Index: Configure
===================================================================
RCS file: /export/home/cvs/apachen/src/Configure,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -r1.164 -r1.165
--- Configure 1997/10/25 23:28:04 1.164
+++ Configure 1997/10/27 19:10:33 1.165
@@ -532,7 +532,7 @@
#
if [ "$RULE_WANTHSREGEX" = "default" ]; then
if [ "x$DEF_WANTHSREGEX" = "x" ]; then
- RULE_WANTHSREGEX=no
+ RULE_WANTHSREGEX=yes
else
RULE_WANTHSREGEX=$DEF_WANTHSREGEX
fi
1.15 +25 -23 apachen/src/PORTING
Index: PORTING
===================================================================
RCS file: /export/home/cvs/apachen/src/PORTING,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- PORTING 1997/10/25 05:34:41 1.14
+++ PORTING 1997/10/27 19:10:34 1.15
@@ -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_PTHREAD_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.
--
1.239 +17 -0 apachen/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -r1.238 -r1.239
--- http_main.c 1997/10/27 19:06:23 1.238
+++ http_main.c 1997/10/27 19:10:36 1.239
@@ -609,11 +609,16 @@
/* Default --- no serialization. Other methods *could* go here,
* as #elifs...
*/
+#if !defined(MULTITHREAD)
+/* Multithreaded systems don't complete between processes for
+ * the sockets. */
+#define NO_SERIALIZED_ACCEPT
#define accept_mutex_cleanup()
#define accept_mutex_init(x)
#define accept_mutex_on()
#define accept_mutex_off()
#endif
+#endif
/* On some architectures it's safe to do unserialized accept()s in the
* single Listen case. But it's never safe to do it in the case where
@@ -2484,6 +2489,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
}