]> granicus.if.org Git - apache/commitdiff
move a couple of special warnings for SysV sems and Posix sems out of the
authorJeff Trawick <trawick@apache.org>
Tue, 24 Nov 2009 21:08:37 +0000 (21:08 +0000)
committerJeff Trawick <trawick@apache.org>
Tue, 24 Nov 2009 21:08:37 +0000 (21:08 +0000)
performance tuning guide and into the common Mutex documentation; remove the
other (duplicate) information from that guide and instead point to the Mutex
directive

mpm_common: axe docs for old accept mutex directives

worker and prefork: axe links to old accept mutex directives, mention the use
of the accept mutex and how it can be configured

event: axe links to old mutex directives where were already N/A

mod_rewrite: axe old RewriteLock directive, mention use of the rewrite map
mutex for RewriteMap programs and how it can be configured

fix other miscellaneous LockFile or AcceptMutex references

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@883878 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/misc/perf-tuning.xml
docs/manual/mod/core.xml
docs/manual/mod/event.xml
docs/manual/mod/mod_rewrite.xml
docs/manual/mod/mpm_common.xml
docs/manual/mod/prefork.xml
docs/manual/mod/worker.xml
docs/manual/server-wide.xml
docs/manual/stopping.xml

index 6526a4b122f755de31afcebb63fe53346df65923..ac0fa15a3ce70400d6e81476d72252977f09f8e7 100644 (file)
       <directive module="mpm_common">Listen</directive>
       directives.</p>
 
-      <p>The directive <directive
-      module="mpm_common">AcceptMutex</directive> can be used to
-      change the selected mutex implementation at run-time.</p>
-
-      <dl>
-        <dt><code>AcceptMutex flock</code></dt>
-
-        <dd>
-          <p>This method uses the <code>flock(2)</code> system call to
-          lock a lock file (located by the <directive module="mpm_common"
-          >LockFile</directive> directive).</p>
-        </dd>
-
-        <dt><code>AcceptMutex fcntl</code></dt>
-
-        <dd>
-          <p>This method uses the <code>fcntl(2)</code> system call to
-          lock a lock file (located by the <directive module="mpm_common"
-          >LockFile</directive> directive).</p>
-        </dd>
-
-        <dt><code>AcceptMutex sysvsem</code></dt>
-
-        <dd>
-          <p>(1.3 or later) This method uses SysV-style semaphores to
-          implement the mutex. Unfortunately SysV-style semaphores have
-          some bad side-effects. One is that it's possible Apache will
-          die without cleaning up the semaphore (see the
-          <code>ipcs(8)</code> man page). The other is that the
-          semaphore API allows for a denial of service attack by any
-          CGIs running under the same uid as the webserver
-          (<em>i.e.</em>, all CGIs, unless you use something like
-          <program>suexec</program> or <code>cgiwrapper</code>).</p>
-        </dd>
-
-        <dt><code>AcceptMutex pthread</code></dt>
-
-        <dd>
-          <p>(1.3 or later) This method uses POSIX mutexes and should
-          work on any architecture implementing the full POSIX threads
-          specification, however appears to only work on Solaris (2.5
-          or later), and even then only in certain configurations. If
-          you experiment with this you should watch out for your server
-          hanging and not responding. Static content only servers may
-          work just fine.</p>
-        </dd>
-
-        <dt><code>AcceptMutex posixsem</code></dt>
-
-        <dd>
-          <p>(2.0 or later)  This method uses POSIX semaphores.  The
-          semaphore ownership is not recovered if a thread in the process
-          holding the mutex segfaults, resulting in a hang of the web
-          server.</p>
-        </dd>
-
-      </dl>
-
-      <p>If your system has another method of serialization which
-      isn't in the above list then it may be worthwhile adding code
-      for it to APR.</p>
+      <p>The <directive module="core">Mutex</directive> directive can
+      be used to change the mutex implementation of the 
+      <code>mpm-accept</code> mutex at run-time.  Special considerations
+      for different mutex implementations are documented with that 
+      directive.</p>
 
       <p>Another solution that has been considered but never
       implemented is to partially serialize the loop -- that is, let
index cf7e3672bd1784f5795d96026e833b4ac4fdecb6..daf9f71ac40ecf0fd4b5431898b9daa6470bae80 100644 (file)
@@ -2335,7 +2335,13 @@ or specified mutexes</description>
         module documentation for more information.</p></li>
 
         <li><code>posixsem</code>
-        <p>This is a mutex variant based on a Posix semaphore.</p></li>
+        <p>This is a mutex variant based on a Posix semaphore.</p>
+
+        <note type="warning"><title>Warning</title>
+        <p>The semaphore ownership is not recovered if a thread in the process
+        holding the mutex segfaults, resulting in a hang of the web server.</p>
+        </note>
+        </li>
 
         <li><code>sysvsem</code>
         <p>This is a mutex variant based on a SystemV IPC semaphore.</p>
@@ -2344,6 +2350,13 @@ or specified mutexes</description>
         <p>It is possible to "leak" SysV semaphores if processes crash 
         before the semaphore is removed.</p>
        </note>
+
+        <note type="warning"><title>Security</title>
+        <p>The semaphore API allows for a denial of service attack by any
+        CGIs running under the same uid as the webserver (<em>i.e.</em>,
+        all CGIs, unless you use something like <program>suexec</program>
+        or <code>cgiwrapper</code>).</p>
+       </note>
         </li>
 
         <li><code>sem</code>
index 9439e1899d15f6d04948280c733c5560adc6eeec..55f31b266b343faca0dae1a4c80845accab2ec14 100644 (file)
@@ -94,8 +94,6 @@ of consuming threads only for connections with active processing</description>
     </ul>
 </section>
 
-<directivesynopsis location="mpm_common"><name>AcceptMutex</name>
-</directivesynopsis>
 <directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
 </directivesynopsis>
 <directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
@@ -108,8 +106,6 @@ of consuming threads only for connections with active processing</description>
 </directivesynopsis>
 <directivesynopsis location="mpm_common"><name>SendBufferSize</name>
 </directivesynopsis>
-<directivesynopsis location="mpm_common"><name>LockFile</name>
-</directivesynopsis>
 <directivesynopsis location="mpm_common"><name>MaxClients</name>
 </directivesynopsis>
 <directivesynopsis location="mpm_common"><name>MaxMemFree</name>
index 363429ddb20535fd030e49d49b96d893136148f1..9151086b976e75189a571d0dfb124b5fc97cb4fd 100644 (file)
@@ -202,26 +202,6 @@ RewriteLogLevel 3
 
 </directivesynopsis>
 
-<directivesynopsis>
-<name>RewriteLock</name>
-<description>Sets the name of the lock file used for <directive
-module="mod_rewrite">RewriteMap</directive>
-synchronization</description>
-<syntax>RewriteLock <em>file-path</em></syntax>
-<contextlist><context>server config</context></contextlist>
-
-<usage>
-      <p>This directive sets the filename for a synchronization
-      lockfile which mod_rewrite needs to communicate with <directive
-      module="mod_rewrite">RewriteMap</directive>
-      <em>programs</em>. Set this lockfile to a local path (not on a
-      NFS-mounted device) when you want to use a rewriting
-      map-program. It is not required for other types of rewriting
-      maps.</p>
-</usage>
-
-</directivesynopsis>
-
 <directivesynopsis>
 <name>RewriteMap</name>
 <description>Defines a mapping function for key-lookup</description>
@@ -417,6 +397,11 @@ $ httxt2dbm -i mapfile.txt -o mapfile.map
           ``<code>NULL</code>'' if it fails (<em>i.e.</em>, there
           is no corresponding value for the given key).</p>
 
+          <p>This feature utilizes the <code>rewrite-map</code> mutex,
+          which is required for reliable communication with the program.
+          The mutex mechanism and lock file can be configured with the
+          <directive module="core">Mutex</directive> directive.</p>
+
           <p>External rewriting programs are not started if they're defined in a
           context that does not have <directive>RewriteEngine</directive> set to
           <code>on</code></p>.
@@ -445,12 +430,6 @@ while (&lt;STDIN&gt;) {
             <li>A common mistake is to use buffered I/O on
             <code>stdout</code>. Avoid this, as it will cause a deadloop!
             ``<code>$|=1</code>'' is used above, to prevent this.</li>
-
-            <li>The <directive
-            module="mod_rewrite">RewriteLock</directive> directive can
-            be used to define a lockfile which mod_rewrite can use to synchronize
-            communication with the mapping program. By default no such
-            synchronization takes place.</li>
           </ol>
         </li>
         <li>
index 66306c13c2707491073998de689ece91a47de5d8..d59018e51fd163bb6a66e6b8fda721a8fed11001 100644 (file)
 more than one multi-processing module (MPM)</description>
 <status>MPM</status>
 
-<directivesynopsis>
-<name>AcceptMutex</name>
-<description>Method that Apache uses to serialize multiple children
-accepting requests on network sockets</description>
-<syntax>AcceptMutex Default|<var>method</var></syntax>
-<default>AcceptMutex Default</default>
-<contextlist><context>server config</context></contextlist>
-<modulelist><module>prefork</module><module>worker</module>
-</modulelist>
-
-<usage>
-    <p>The <directive>AcceptMutex</directive> directives sets the
-    method (and lockfile location if appropriate) that Apache uses to
-    serialize multiple children accepting
-    requests on network sockets. Prior to Apache 2.0, the method was
-    selectable only at compile time. The optimal method to use is
-    highly architecture and platform dependent. For further details,
-    see the <a href="../misc/perf-tuning.html">performance tuning</a>
-    documentation.</p>
-
-    <p>If this directive is set to <code>Default</code>, then the
-    compile-time selected default will be used. Other possible
-    methods are listed below. Note that not all methods are
-    available on all platforms. If a method is specified which is
-    not available, a message will be written to the error log
-    listing the available methods.</p>
-
-    <dl>
-      <dt><code>flock&lt;<var>:/path/to/lockfile</var>&gt;</code></dt>
-      <dd>uses the <code>flock(2)</code> system call to lock the
-      file defined by the optional <var>/path/to/lockfile</var>
-      parameter. One can also use the <directive module="mpm_common"
-      >LockFile</directive> directive to specify the lockfile,
-      although this is deprecated.</dd>
-
-      <dt><code>fcntl&lt;<var>:/path/to/lockfile</var>&gt;</code></dt>
-      <dd>uses the <code>fcntl(2)</code> system call to lock the
-      file defined by the optional <var>/path/to/lockfile</var>
-      parameter. One can also use the <directive module="mpm_common"
-      >LockFile</directive> directive to specify the lockfile,
-      although this is deprecated.</dd>
-
-      <dt><code>file&lt;<var>:/path/to/lockfile</var>&gt;</code></dt>
-      <dd>This directive tells Apache to pick the "best" file locking
-      implementation available to it, choosing between <code>fcntl</code> and
-      <code>flock</code>, in that order. It is only available when the underlying
-      platform and <glossary>APR</glossary> supports at least one of the 2.</dd>
-
-      <dt><code>posixsem</code></dt>
-      <dd>uses POSIX compatible semaphores to implement the mutex.</dd>
-
-      <dt><code>sysvsem</code></dt>
-      <dd>uses SySV-style semaphores to implement the mutex.</dd>
-
-      <dt><code>sem</code></dt>
-      <dd>This directive tells Apache to pick the "best" semaphore
-      implementation available to it, choosing between Posix and SystemV IPC,
-      in that order. It is only available when the underlying platform and
-      <glossary>APR</glossary> supports at least one of the 2.</dd>
-
-      <dt><code>pthread</code></dt>
-      <dd>uses POSIX mutexes as implemented by the POSIX Threads
-      (PThreads) specification.</dd>
-
-    </dl>
-
-    <p>If you want to find out the compile time chosen default
-    for your system, you may set your <directive module="core"
-    >LogLevel</directive> to <code>debug</code>. Then the default <directive
-    >AcceptMutex</directive> will be written into the <directive
-    module="core">ErrorLog</directive>.</p>
-
-  <note type="warning"><title>Warning</title>
-     <p>On most systems, when the <code>pthread</code> option
-     is selected, if a child process terminates abnormally
-     while holding the <code>AcceptCntl</code> mutex the
-     server will stop responding to requests. When this
-     occurs, the server will require a manual restart to
-     recover.</p>
-     <p>Solaris is a notable exception as it provides a
-     mechanism, used by Apache, which usually allows the
-     mutex to be recovered after a child process terminates
-     abnormally while holding a mutex.</p>
-     <p>If your system implements the
-     <code>pthread_mutexattr_setrobust_np()</code> function,
-     you may be able to use the <code>pthread</code> option safely.</p>
-  </note>
-</usage>
-</directivesynopsis>
-
 <directivesynopsis>
 <name>CoreDumpDirectory</name>
 <description>Directory where Apache attempts to
@@ -354,45 +264,6 @@ The <var>protocol</var> argument was added in 2.1.5</compatibility>
 </usage>
 </directivesynopsis>
 
-<directivesynopsis>
-<name>LockFile</name>
-<description>Location of the accept serialization lock file <em>(deprecated)</em></description>
-<syntax>LockFile <var>filename</var></syntax>
-<default>LockFile logs/accept.lock</default>
-<contextlist><context>server config</context></contextlist>
-<modulelist>
-<module>prefork</module><module>worker</module>
-</modulelist>
-
-<usage>
-    <p>The <directive>LockFile</directive> directive sets the path to
-    the lockfile used when Apache is used with an <directive
-    module="mpm_common">AcceptMutex</directive> value of either
-    <code>fcntl</code> or <code>flock</code>. This directive should
-    normally be left at its default value. The main reason for changing
-    it is if the <code>logs</code> directory is NFS mounted, since
-    <strong>the lockfile must be stored on a local disk</strong>. The PID
-    of the main server process is automatically appended to the
-    filename.</p>
-
-    <note type="warning"><title>Security</title>
-      <p>It is best to <em>avoid</em> putting this file in a world writable
-      directory such as <code>/var/tmp</code> because someone could create
-      a denial of service attack and prevent the server from starting by
-      creating a lockfile with the same name as the one the server will try
-      to create.</p>
-    </note>
-    <note type="warning"><title>Deprecated</title>
-      <p>This directive is deprecated. It is strongly suggested that
-      you use <directive module="mpm_common">AcceptMutex</directive> to
-      specify both the mutex locking implementation as well as
-      the lockfile location.</p>
-    </note>
-
-</usage>
-<seealso><directive module="mpm_common">AcceptMutex</directive></seealso>
-</directivesynopsis>
-
 <directivesynopsis>
 <name>MaxClients</name>
 <description>Maximum number of connections that will be processed
index c5288611dd852a72e3291eb93a99672bfd2ab6df..d47dd7a0cfe086298d71c23e53fbf1affe569401 100644 (file)
@@ -83,6 +83,14 @@ uses</a></seealso>
     <p><directive module="mpm_common">MaxRequestsPerChild</directive>
     controls how frequently the server recycles processes by killing
     old ones and launching new ones.</p>
+
+    <p>This MPM uses the <code>mpm-accept</code> mutex to serialize
+    access to incoming connections when subject to the thundering herd
+    problem (generally, when there are multiple listening sockets).
+    The implementation aspects of this mutex can be configured with the
+    <directive module="core">Mutex</directive> directive.  The <a
+    href="../misc/perf-tuning.html">performance hints</a>
+    documentation has additional information about this mutex.</p>
 </section>
 
 <directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
@@ -95,8 +103,6 @@ uses</a></seealso>
 </directivesynopsis>
 <directivesynopsis location="mpm_common"><name>ListenBacklog</name>
 </directivesynopsis>
-<directivesynopsis location="mpm_common"><name>LockFile</name>
-</directivesynopsis>
 <directivesynopsis location="mpm_common"><name>MaxClients</name>
 </directivesynopsis>
 <directivesynopsis location="mpm_common"><name>MaxMemFree</name>
@@ -117,8 +123,6 @@ uses</a></seealso>
 </directivesynopsis>
 <directivesynopsis location="mod_unixd"><name>Group</name>
 </directivesynopsis>
-<directivesynopsis location="mpm_common"><name>AcceptMutex</name>
-</directivesynopsis>
 
 <directivesynopsis>
 <name>MaxSpareServers</name>
index 1490cb2d118d8c0761b6ee7fc600db414ba54811..98b709327b4fef2363669a069e71c377c18b2920 100644 (file)
@@ -135,10 +135,16 @@ uses</a></seealso>
     <p><directive module="mpm_common">MaxRequestsPerChild</directive>
     controls how frequently the server recycles processes by killing
     old ones and launching new ones.</p>
+
+    <p>This MPM uses the <code>mpm-accept</code> mutex to serialize
+    access to incoming connections when subject to the thundering herd
+    problem (generally, when there are multiple listening sockets).
+    The implementation aspects of this mutex can be configured with the
+    <directive module="core">Mutex</directive> directive.  The <a
+    href="../misc/perf-tuning.html">performance hints</a>
+    documentation has additional information about this mutex.</p>
 </section>
 
-<directivesynopsis location="mpm_common"><name>AcceptMutex</name>
-</directivesynopsis>
 <directivesynopsis location="mpm_common"><name>CoreDumpDirectory</name>
 </directivesynopsis>
 <directivesynopsis location="mpm_common"><name>EnableExceptionHook</name>
@@ -151,8 +157,6 @@ uses</a></seealso>
 </directivesynopsis>
 <directivesynopsis location="mpm_common"><name>ListenBacklog</name>
 </directivesynopsis>
-<directivesynopsis location="mpm_common"><name>LockFile</name>
-</directivesynopsis>
 <directivesynopsis location="mpm_common"><name>MaxClients</name>
 </directivesynopsis>
 <directivesynopsis location="mpm_common"><name>MaxMemFree</name>
index 15e511e4b0c9e07a52da1eb0b6a75fe1000e2b3a..161bb418718af1659302590800dfba333eacbf30 100644 (file)
@@ -70,7 +70,7 @@ the basic operations of the server.</p>
         <directive module="mpm_common">CoreDumpDirectory</directive>
         <directive module="core">DocumentRoot</directive>
         <directive module="core">ErrorLog</directive>
-        <directive module="mpm_common">LockFile</directive>
+        <directive module="core">Mutex</directive>
         <directive module="mpm_common">PidFile</directive>
         <directive module="mpm_common">ScoreBoardFile</directive>
         <directive module="core">ServerRoot</directive>
@@ -117,4 +117,20 @@ the basic operations of the server.</p>
     <p>The <directive module="mpm_common">ThreadStackSize</directive>
     directive is used with some platforms to control the stack size.</p>
   </section>
+
+  <section id="implementation">
+    <title>Implementation Choices</title>
+
+    <related>
+      <directivelist>
+        <directive module="core">Mutex</directive>
+      </directivelist>
+    </related>
+
+    <p>The <directive>Mutex</directive> directive can be used to change
+    the underlying implementation used for mutexes, in order to relieve
+    functional or performance problems with <glossary>APR</glossary>'s
+    default choice.</p>
+  </section>
+
 </manualpage>
index 5c49c7684ece0160cac0c80af29a032995d2b47b..ef5826e43c3e4219d8e15ee839b5c07358cfef9a 100644 (file)
@@ -214,9 +214,9 @@ syntax error(s).</note>
     upgrades of Apache, however it can also cause deadlocks and race 
     conditions with some configurations.</p> 
 
-    <p>Care has been taken to ensure that on-disk files
-    such as the <directive module="core">Lockfile</directive> and <directive 
-    module="mod_cgid">ScriptSock</directive> files contain the server
+    <p>Care has been taken to ensure that on-disk files such as lock files
+    (<directive module="core">Mutex</directive>) and Unix socket files
+    (<directive module="mod_cgid">ScriptSock</directive>) contain the server
     PID, and should coexist without problem. However, if a configuration
     directive, third-party module or persistent CGI utilises any other on-disk 
     lock or  state files, care should be taken to ensure that multiple running