EVOLUTION-MANAGER
Edit File: version-4.6.0.html
<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Version 4.6.0 — mod_wsgi 4.7.1 documentation</title> <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> <link rel="top" title="mod_wsgi 4.7.1 documentation" href="../index.html"/> <link rel="up" title="Release Notes" href="../release-notes.html"/> <link rel="next" title="Version 4.5.24" href="version-4.5.24.html"/> <link rel="prev" title="Version 4.6.1" href="version-4.6.1.html"/> <script src="../_static/js/modernizr.min.js"></script> </head> <body class="wy-body-for-nav" role="document"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search"> <a href="../index.html" class="icon icon-home"> mod_wsgi </a> <div class="version"> 4.7 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../project-status.html">Project Status</a></li> <li class="toctree-l1"><a class="reference internal" href="../security-issues.html">Security Issues</a></li> <li class="toctree-l1"><a class="reference internal" href="../getting-started.html">Getting Started</a></li> <li class="toctree-l1"><a class="reference internal" href="../requirements.html">Requirements</a></li> <li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting.html">Troubleshooting</a></li> <li class="toctree-l1"><a class="reference internal" href="../user-guides.html">User Guides</a></li> <li class="toctree-l1"><a class="reference internal" href="../configuration.html">Configuration</a></li> <li class="toctree-l1"><a class="reference internal" href="../finding-help.html">Finding Help</a></li> <li class="toctree-l1"><a class="reference internal" href="../reporting-bugs.html">Reporting Bugs</a></li> <li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../source-code.html">Source Code</a></li> <li class="toctree-l1 current"><a class="reference internal" href="../release-notes.html">Release Notes</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="version-4.7.0.html">Version 4.7.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.7.1.html">Version 4.7.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.6.8.html">Version 4.6.8</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.6.7.html">Version 4.6.7</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.6.6.html">Version 4.6.6</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.6.5.html">Version 4.6.5</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.6.4.html">Version 4.6.4</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.6.3.html">Version 4.6.3</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.6.2.html">Version 4.6.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.6.1.html">Version 4.6.1</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="">Version 4.6.0</a><ul> <li class="toctree-l3"><a class="reference internal" href="#bugs-fixed">Bugs Fixed</a></li> <li class="toctree-l3"><a class="reference internal" href="#features-changed">Features Changed</a></li> <li class="toctree-l3"><a class="reference internal" href="#new-features">New Features</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.24.html">Version 4.5.24</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.23.html">Version 4.5.23</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.22.html">Version 4.5.22</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.21.html">Version 4.5.21</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.20.html">Version 4.5.20</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.19.html">Version 4.5.19</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.18.html">Version 4.5.18</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.17.html">Version 4.5.17</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.16.html">Version 4.5.16</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.15.html">Version 4.5.15</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.14.html">Version 4.5.14</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.13.html">Version 4.5.13</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.12.html">Version 4.5.12</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.11.html">Version 4.5.11</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.10.html">Version 4.5.10</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.9.html">Version 4.5.9</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.8.html">Version 4.5.8</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.7.html">Version 4.5.7</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.6.html">Version 4.5.6</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.5.html">Version 4.5.5</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.4.html">Version 4.5.4</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.3.html">Version 4.5.3</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.2.html">Version 4.5.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.1.html">Version 4.5.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.5.0.html">Version 4.5.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.23.html">Version 4.4.23</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.22.html">Version 4.4.22</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.21.html">Version 4.4.21</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.20.html">Version 4.4.20</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.19.html">Version 4.4.19</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.18.html">Version 4.4.18</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.17.html">Version 4.4.17</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.16.html">Version 4.4.16</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.15.html">Version 4.4.15</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.14.html">Version 4.4.14</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.13.html">Version 4.4.13</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.12.html">Version 4.4.12</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.11.html">Version 4.4.11</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.10.html">Version 4.4.10</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.9.html">Version 4.4.9</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.8.html">Version 4.4.8</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.7.html">Version 4.4.7</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.6.html">Version 4.4.6</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.5.html">Version 4.4.5</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.4.html">Version 4.4.4</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.3.html">Version 4.4.3</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.2.html">Version 4.4.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.1.html">Version 4.4.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.4.0.html">Version 4.4.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.3.2.html">Version 4.3.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.3.1.html">Version 4.3.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.3.0.html">Version 4.3.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.8.html">Version 4.2.8</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.7.html">Version 4.2.7</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.6.html">Version 4.2.6</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.5.html">Version 4.2.5</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.4.html">Version 4.2.4</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.3.html">Version 4.2.3</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.2.html">Version 4.2.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.1.html">Version 4.2.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.2.0.html">Version 4.2.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.1.3.html">Version 4.1.3</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.1.2.html">Version 4.1.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.1.1.html">Version 4.1.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.1.0.html">Version 4.1.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-4.0.html">Version 4.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-3.5.html">Version 3.5</a></li> <li class="toctree-l2"><a class="reference internal" href="version-3.4.html">Version 3.4</a></li> <li class="toctree-l2"><a class="reference internal" href="version-3.3.html">Version 3.3</a></li> <li class="toctree-l2"><a class="reference internal" href="version-3.2.html">Version 3.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-3.1.html">Version 3.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-3.0.html">Version 3.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.8.html">Version 2.8</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.7.html">Version 2.7</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.6.html">Version 2.6</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.5.html">Version 2.5</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.4.html">Version 2.4</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.3.html">Version 2.3</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.2.html">Version 2.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.1.html">Version 2.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-2.0.html">Version 2.0</a></li> <li class="toctree-l2"><a class="reference internal" href="version-1.6.html">Version 1.6</a></li> <li class="toctree-l2"><a class="reference internal" href="version-1.5.html">Version 1.5</a></li> <li class="toctree-l2"><a class="reference internal" href="version-1.4.html">Version 1.4</a></li> <li class="toctree-l2"><a class="reference internal" href="version-1.3.html">Version 1.3</a></li> <li class="toctree-l2"><a class="reference internal" href="version-1.2.html">Version 1.2</a></li> <li class="toctree-l2"><a class="reference internal" href="version-1.1.html">Version 1.1</a></li> <li class="toctree-l2"><a class="reference internal" href="version-1.0.html">Version 1.0</a></li> </ul> </li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="../index.html">mod_wsgi</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="../index.html">Docs</a> »</li> <li><a href="../release-notes.html">Release Notes</a> »</li> <li>Version 4.6.0</li> <li class="wy-breadcrumbs-aside"> <a href="../_sources/release-notes/version-4.6.0.txt" rel="nofollow"> View page source</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="version-4-6-0"> <h1>Version 4.6.0<a class="headerlink" href="#version-4-6-0" title="Permalink to this headline">¶</a></h1> <p>Version 4.6.0 of mod_wsgi can be obtained from:</p> <blockquote> <div><a class="reference external" href="https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.6.0">https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.6.0</a></div></blockquote> <div class="section" id="bugs-fixed"> <h2>Bugs Fixed<a class="headerlink" href="#bugs-fixed" title="Permalink to this headline">¶</a></h2> <ul class="simple"> <li>Management of reference counting on Python objects in the access, authentication, authorization and dispatch hooks wasn’t correct for certain error cases. The error cases shouldn’t have ever occurred, but still fixed.</li> <li>Point at which details of Python exceptions occuring during access, authentication, authorization and dispatch hooks was incorrect and not done, with exception cleared, before trying to close per callback error log. That the exception hadn’t been cleared would result in the call to close the per callback error log to itself fail as it believed an exception occurred in that call when it hadn’t. The result was confusing error messages in the Apache error log.</li> <li>The deprecated backwards compatability mode enabled by setting the directive <tt class="docutils literal"><span class="pre">WSGILazyInitialization</span> <span class="pre">Off</span></tt>, to have Python initialised in the Apache parent process before forking, was resulting in the Apache parent process crashing on Apache shutdown or restart. This resulted in Apache child processes and daemon process being orphaned. Issue has been fixed, but you should never use this mode and it will be removed in a future update. The reason it shouldn’t be used is due to memory leaks in Python interpreter re-initialisation in same process and also the risks due to Python code potentially being run as root.</li> <li>When stack traces were being dumped upon request timeout expiring, the line numbers of the definition of each function in the stack trace was being displayed, instead of the actual line number within the body of the function that was executing at the time.</li> <li>When stack traces were being dumped upon request timeout expiring, the thread ID was being truncated to 32 bits when displayed, meaning it wouldn’t match the actual Python thread ID on 64 bit systems.</li> </ul> </div> <div class="section" id="features-changed"> <h2>Features Changed<a class="headerlink" href="#features-changed" title="Permalink to this headline">¶</a></h2> <ul> <li><p class="first">Now flagging mod_wsgi package when installing using <tt class="docutils literal"><span class="pre">setup.py</span></tt> as being not <tt class="docutils literal"><span class="pre">zip_safe</span></tt>. This is to workaround an apparent bug with <tt class="docutils literal"><span class="pre">setuptools</span></tt> when using Python 3.7 alpha versions. Believe this will disable use of egg file in certain cases.</p> </li> <li><p class="first">When the connection to a client is lost when writing back the response, the HTTP response code logged in the Apache access log will be that for the original response from the WSGI application rather than a 500 error.</p> <p>This is done to avoid confusion where a 500 error is recorded in the access log, making you think your WSGI application is at fault when it wasn’t, but there is no actual error recorded in the error log as to why the 500 error was recorded in the access log.</p> <p>The reason no error is logged in the case of the connection to a client being lost is that doing so would create a lot of noise due to the regularity which it can happen. The only time an error is logged is when a timeout occurs rather than connection being lost. That is done to highlight that connections are hanging due to the effect it can have on available server capacity when connections are kept open for long times.</p> <p>Thanks to Jesús Cea Avión for identifying how using the Apache C API it could be identified that the connection had been aborted and in that case the original HTTP response code could safely be used.</p> </li> <li><p class="first">When using the Django integration for <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt>, if the <tt class="docutils literal"><span class="pre">whitenoise.middleware.WhiteNoiseMiddleware</span></tt> middleware is listed in <tt class="docutils literal"><span class="pre">MIDDLEWARE</span></tt> or <tt class="docutils literal"><span class="pre">MIDDLEWARE_CLASSES</span></tt> of the Django settings file, Apache will now not be used to host Django’s static files. This is being done to allow WhiteNoise middleware to be used in conjunction with front end content delivery networks or other caching systems. If you aren’t using such a front end and do want Apache to still host the static files, either don’t list the WhiteNoise middleware in the list of middleware classes when using <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt>, or pass the <tt class="docutils literal"><span class="pre">--url-alias</span></tt> option explictly, along with the URL mount point for static files and the directory where they have been placed by the <tt class="docutils literal"><span class="pre">collectstatic</span></tt> management command of Django.</p> </li> <li><p class="first">When running <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt> if the <tt class="docutils literal"><span class="pre">TMPDIR</span></tt> environment variable is specified, it will be used as the directory under which the default server root directory for generated files will be created. If <tt class="docutils literal"><span class="pre">TMPDIR</span></tt> is not specified, then <tt class="docutils literal"><span class="pre">/tmp</span></tt> will be used.</p> <p>This allows <tt class="docutils literal"><span class="pre">TMPDIR</span></tt> to be used to control the directory used as a default. On MacOS where <tt class="docutils literal"><span class="pre">TMPDIR</span></tt> is set to a unique directory for the login session under <tt class="docutils literal"><span class="pre">/var/tmp</span></tt>, this also avoids a problem where a system cron job in MacOS will delete files under <tt class="docutils literal"><span class="pre">/tmp</span></tt> which are older than a certain date, which can cause a long running instance of <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt> to start failing.</p> </li> <li><p class="first">The “process_stopping” event previously would not be delivered when the process was being shutdown and there were still active requests, such as when a request timeout occurred. Seen as better to always deliver the event if can, even if there were still requests that hadn’t been completed. This will allow the event handler to dump out details on what the active requests were, helping to identify long running or stuck requests.</p> </li> </ul> </div> <div class="section" id="new-features"> <h2>New Features<a class="headerlink" href="#new-features" title="Permalink to this headline">¶</a></h2> <ul> <li><p class="first">When using <tt class="docutils literal"><span class="pre">--compress-responses</span></tt> option of <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt>, content of type <tt class="docutils literal"><span class="pre">application/json</span></tt> will now be compressed.</p> </li> <li><p class="first">Added directive <tt class="docutils literal"><span class="pre">WSGISocketRotation</span></tt> to allow the rotation of the daemon socket file path on restarts of Apache to be disabled. By default it is <tt class="docutils literal"><span class="pre">On</span></tt> to preserve existing behaviour but can be set to <tt class="docutils literal"><span class="pre">Off</span></tt> to have the same socket file path always be used for lifetime of that Apache instance.</p> <p>Rotation should only be disabled where the Apache configuration for the mod_wsgi application stays constant over time. The rotation was originally done to prevent a request received and handled by an Apache worker process being proxied through to a daemon process created under a newer configuration. This was done to avoid the possibility of an error, or a security issue, due to the old and new configurations being incompatible or out of sync.</p> <p>By setting rotation to <tt class="docutils literal"><span class="pre">Off</span></tt>, when a graceful restart is done and the Apache worker process survives for a period of time due to keep alive connections, those subsequent requests on the keep alive connection will now be proxied to the newer daemon processes rather than being failed as occurred before due to no instances of daemon process existing under the older configuration.</p> <p>Although socket rotation still defaults to <tt class="docutils literal"><span class="pre">On</span></tt> for mod_wsgi, this is overridden for <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt> where it is always now set to <tt class="docutils literal"><span class="pre">Off</span></tt>. This is okay as is not possible for configuration to change when using it.</p> </li> <li><p class="first">The <tt class="docutils literal"><span class="pre">process-group</span></tt> and <tt class="docutils literal"><span class="pre">application-group</span></tt> options can now be used with the <tt class="docutils literal"><span class="pre">WSGIScriptAliasMatch</span></tt> directive. If substitutions are not used in the value for the WSGI script file target path, then the WSGI script file will be pre-loaded if both <tt class="docutils literal"><span class="pre">process-group</span></tt> and <tt class="docutils literal"><span class="pre">application-group</span></tt> options are used at the same time.</p> <p>Note that the documentation was wrongly updated recently to suggest that these options were already supported by <tt class="docutils literal"><span class="pre">WSGIScriptAliaMatch</span></tt>. This was done in error. Instead of removing the documentation, the ability to use the options with the directive was instead added with this release.</p> </li> <li><p class="first">Raise an actual exception when installing using <tt class="docutils literal"><span class="pre">pip</span></tt> or using the <tt class="docutils literal"><span class="pre">setup.py</span></tt> file on MacOS and it doesn’t appear that Xcode application has been installed. Lack of Xcode application will mean that cannot find the SDK which has the Apache include files.</p> </li> <li><p class="first">An explicit error message is now logged when the calculated daemon socket path is too long and would be truncated, causing potential failures. A shorter directory path should be set with the <tt class="docutils literal"><span class="pre">WSGISocketPrefix</span></tt> option.</p> </li> <li><p class="first">Added the <tt class="docutils literal"><span class="pre">--socket-path</span></tt> option to <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt> so you can set the daemon socket prefix via the <tt class="docutils literal"><span class="pre">WSGISocketPrefix</span></tt> directive to an alternate directory if the calculated path would be too long based on where server root is set for <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt>.</p> </li> <li><p class="first">Added the <tt class="docutils literal"><span class="pre">--isatty</span></tt> option to <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt> to indicate that running the command in an interactive terminal session. In this case Apache will be run as a sub process rather than it replacing the current script. Signals such as SIGINT, SIGTERM, SIGHUP and SIGUSR1 will be intercepted and forwarded onto Apache, but the signal SIGWINCH will be ignored. This will avoid the problems of Apache shutting down when the terminal session Apache is run in is resized.</p> <p>Technically this could be done automatically by working out if the attached terminal is a tty, but is being done using an option at this point so the reliability of the mechanism used to run Apache as a sub process and the handling of the signals, can be verified. If everything checks out, it is likely that this will become the default behaviour when the attached terminal is a tty.</p> </li> <li><p class="first">When using <tt class="docutils literal"><span class="pre">WSGIDaemonProcess</span></tt>, if you set the number of threads to zero you will enable a special mode intended for using a daemon process to run a managed task or program. You will need to use <tt class="docutils literal"><span class="pre">WSGIImportScript</span></tt> to pre-load a Python script into the main application group specified by <tt class="docutils literal"><span class="pre">%{GLOBAL}</span></tt> where the script runs a never ending task, or does an exec to run an external program. If the script or external program exits, the process is shutdown and replaced with a new one. For the case of using a Python script to run a never ending task, a <tt class="docutils literal"><span class="pre">SystemExit</span></tt> exception will be injected when a signal is received to shutdown the process. You can use <tt class="docutils literal"><span class="pre">signal.signal()</span></tt> to register a signal handler for <tt class="docutils literal"><span class="pre">SIGTERM</span></tt> if needing to run special actions before then exiting the process using <tt class="docutils literal"><span class="pre">sys.exit()</span></tt>, or to signal your own threads to exit any processing so you can shutdown in an orderly manner.</p> <p>The ability to do something very similar did previously exist in that you could use <tt class="docutils literal"><span class="pre">WSGIImportScript</span></tt> to run a never ending task even when the number of threads was non zero. This was used by <tt class="docutils literal"><span class="pre">--service-script</span></tt> option of <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt>. The difference in setting <tt class="docutils literal"><span class="pre">threads=0</span></tt> is that signals will work correctly and be able to interupt the script. Also once the script exits, the process will shutdown, to be replaced, where as previously the process would stay running until Apache was restart or shutdown. The <tt class="docutils literal"><span class="pre">--service-script</span></tt> option of <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt> has been updated to set the number of threads to zero.</p> </li> <li><p class="first">Added <tt class="docutils literal"><span class="pre">mod_wsgi.active_requests</span></tt> dictionary. This is populated with the per request data object for active requests, keyed by the Apache request ID.</p> </li> <li><p class="first">Add <tt class="docutils literal"><span class="pre">--cpu-time-limit</span></tt> option to <tt class="docutils literal"><span class="pre">mod_wsgi-express</span></tt> so that limit can be imposed on daemon process group as to how much CPU can be used for process is restarted automatically.</p> </li> <li><p class="first">Pass a “shutdown_reason” argument with “process_stopping” event so event handler knows the reason the process is being shutdown.</p> </li> </ul> </div> </div> </div> <div class="articleComments"> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="version-4.5.24.html" class="btn btn-neutral float-right" title="Version 4.5.24" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="version-4.6.1.html" class="btn btn-neutral" title="Version 4.6.1" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © Copyright 2007-2020, Graham Dumpleton. </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT:'../', VERSION:'4.7.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '' }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.StickyNav.enable(); }); </script> </body> </html>