Skip to content

Commit 630dcf5

Browse files
Merge branch 'release/4.6.0'
2 parents 538cf8f + 68a67c7 commit 630dcf5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1083
-234
lines changed

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The first way of installing mod_wsgi is the traditional way that has been
1212
used by many software packages. This is where it is installed as a module
1313
directly into your Apache installation using the commands ``configure``,
1414
``make`` and ``make install``, a method sometimes referred to by the
15-
acyronym CMMI. This method works with most UNIX type systems. It cannot
15+
acronym CMMI. This method works with most UNIX type systems. It cannot
1616
be used on Windows.
1717

1818
The second way of installing mod_wsgi is to install it as a Python package
@@ -49,7 +49,7 @@ they never fixed those problems either. This time there is no easy
4949
workaround as they no longer supply certain tools which are required to
5050
perform the installation.
5151

52-
The ``pip install`` method along with manual configuration of Apache
52+
The ``pip install`` method along with the manual configuration of Apache
5353
is also the method you need to use on Windows.
5454

5555
System Requirements
@@ -59,7 +59,7 @@ With either installation method for mod_wsgi, you must have Apache
5959
installed. This must be a complete Apache installation. It is not enough to
6060
have only the runtime packages for Apache installed. You must have the
6161
corresponding development package for Apache installed, which contains the
62-
Apache header files, as these are required to be able compile and install
62+
Apache header files, as these are required to be able to compile and install
6363
third party Apache modules.
6464

6565
Similarly with Python, you must have a complete Python installation which
@@ -156,7 +156,7 @@ Note that nothing will be copied into your Apache installation at this
156156
point. As a result, you do not need to run this as the root user unless
157157
installing it into a site wide Python installation rather than a Python
158158
virtual environment. It is recommended you always use Python virtual
159-
environments and never install any Python package direct into the system
159+
environments and never install any Python package directly into the system
160160
Python installation.
161161

162162
On a UNIX type system, to verify that the installation was successful, run
@@ -233,7 +233,7 @@ additional steps.
233233

234234
The first thing you must do is supply the ``--user`` and ``--group``
235235
options to say what user and group your Python web application should run
236-
as. Most Linux distributions will pre define a special user for Apache to
236+
as. Most Linux distributions will predefine a special user for Apache to
237237
run as, so you can use that. Alternatively you can use any other special
238238
user account you have created for running the Python web application::
239239

@@ -344,7 +344,7 @@ use the ``--setup-only`` option to the ``runmodwsgi`` management command.
344344
--user www-data --group www-data \
345345
--server-root=/etc/mod_wsgi-express-80
346346
347-
This will setup all the required files and you can use ``apachectl`` to
347+
This will set up all the required files and you can use ``apachectl`` to
348348
start and stop the Apache instance as explained previously.
349349

350350
Connecting into Apache installation

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dnl vim: set sw=4 expandtab :
22
dnl
3-
dnl Copyright 2007-2017 GRAHAM DUMPLETON
3+
dnl Copyright 2007-2018 GRAHAM DUMPLETON
44
dnl
55
dnl Licensed under the Apache License, Version 2.0 (the "License");
66
dnl you may not use this file except in compliance with the License.

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
# General information about the project.
4343
project = u'mod_wsgi'
44-
copyright = u'2007-2017, Graham Dumpleton'
44+
copyright = u'2007-2018, Graham Dumpleton'
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the

docs/configuration-directives/WSGIApplicationGroup.rst

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ to. All WSGI applications within the same application group will execute
1717
within the context of the same Python sub interpreter of the process
1818
handling the request.
1919

20+
Setting ``WSGIApplicationGroup`` doesn't control what processes a request
21+
is handled by, that is what the ``WSGIProcessGroup`` directive does. In
22+
other words, the ``WSGIProcessGroup`` directive operates distinct from the
23+
``WSGIApplicationGroup`` directive, with ``WSGIProcessGroup`` dictating
24+
what named group of processes a request is handled by, and
25+
``WSGIApplicationGroup`` dictating which named Python sub interpreter
26+
context (application group) of those processes is used. In each distinct
27+
process of a named group of processes, there will be a separate sub
28+
interpreter instance of same name, for handling the requests accepted by
29+
that process.
30+
2031
The argument to the ``WSGIApplicationGroup`` can be either one of four
2132
special expanding variables or an explicit name of your own choosing.
2233
The meaning of the special variables are:
@@ -27,11 +38,12 @@ The meaning of the special variables are:
2738

2839
Any WSGI applications in the global application group will always be
2940
executed within the context of the first interpreter created by Python
30-
when it is initialised. Forcing a WSGI application to run within the
31-
first interpreter can be necessary when a third party C extension
32-
module for Python has used the simplified threading API for
33-
manipulation of the Python GIL and thus will not run correctly within
34-
any additional sub interpreters created by Python.
41+
when it is initialised, of the process handling the request. Forcing a
42+
WSGI application to run within the first interpreter can be necessary
43+
when a third party C extension module for Python has used the
44+
simplified threading API for manipulation of the Python GIL and thus
45+
will not run correctly within any additional sub interpreters created
46+
by Python.
3547

3648
**%{SERVER}**
3749

docs/configuration-directives/WSGIDaemonProcess.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ Options which can be supplied to the ``WSGIDaemonProcess`` directive are:
5959
where your code is I/O bound. If you code is CPU bound, you are better
6060
of using at most 3 to 5 threads per process and using more processes.
6161

62+
If you set the number of threads to 0 you will enable a special mode
63+
intended for using a daemon process to run a managed set of processes.
64+
You will need to use ``WSGIImportScript`` to pre-load a Python script
65+
into the main application group specified by ``%{GLOBAL}`` where the
66+
script runs a never ending task, or does an exec to run an external
67+
program. If the script or external program exits, the process is
68+
shutdown and replaced with a new one. For the case of using a Python
69+
script to run a never ending task, a ``SystemExit`` exception will be
70+
injected when a signal is received to shutdown the process. You can
71+
use ``signal.signal()`` to register a signal handler for ``SIGTERM``
72+
if needing to run special actions before then exiting the process using
73+
``sys.exit()``, or to signal your own threads to exit any processing
74+
so you can shutdown in an orderly manner.
75+
6276
**display-name=value**
6377
Defines a different name to show for the daemon process when using the
6478
``ps`` command to list processes. If the value is ``%{GROUP}`` then the
@@ -598,6 +612,37 @@ host, the following could be used::
598612
...
599613
</VirtualHost>
600614

615+
For historical reasons and the inability to change existing behaviour when
616+
adding or changing features, many of the options to ``WSGIDaemonProcess``,
617+
especially those related to timeouts are not enabled by default. It is
618+
strongly recommended you explicitly set these options yourself as this will
619+
give you a system which is better able to recover from backlogging due to
620+
overloading when you have too many long running requests or hanging
621+
requests. As a starting point you can see what ``mod_wsgi-express`` uses as
622+
defaults, adjusting them as necessary to suit your specific application
623+
after you research what each option does. For example, consider starting
624+
out with:
625+
626+
* ``display-name='%{GROUP}'``
627+
628+
* ``lang='en_US.UTF-8'``
629+
* ``locale='en_US.UTF-8'``
630+
631+
* ``threads=5``
632+
633+
* ``queue-timeout=45``
634+
* ``socket-timeout=60``
635+
* ``connect-timeout=15``
636+
* ``request-timeout=60``
637+
* ``inactivity-timeout=0``
638+
* ``startup-timeout=15``
639+
* ``deadlock-timeout=60``
640+
* ``graceful-timeout=15``
641+
* ``eviction-timeout=0``
642+
* ``restart-interval=0``
643+
* ``shutdown-timeout=5``
644+
* ``maximum-requests=0``
645+
601646
Note that the ``WSGIDaemonProcess`` directive and corresponding features are
602647
not available on Windows.
603648

docs/configuration-directives/WSGIScriptAlias.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ Options which can be supplied to the ``WSGIScriptAlias`` directive are:
8686
If the name is set to be ``%{GLOBAL}`` the application group will be
8787
set to the empty string. Any WSGI applications in the global
8888
application group will always be executed within the context of the
89-
first interpreter created by Python when it is initialised. Forcing
90-
a WSGI application to run within the first interpreter can be
91-
necessary when a third party C extension module for Python has used
92-
the simplified threading API for manipulation of the Python GIL and
93-
thus will not run correctly within any additional sub interpreters
94-
created by Python.
89+
first interpreter created by Python when it is initialised, of the
90+
process handling the request. Forcing a WSGI application to run within
91+
the first interpreter can be necessary when a third party C extension
92+
module for Python has used the simplified threading API for
93+
manipulation of the Python GIL and thus will not run correctly within
94+
any additional sub interpreters created by Python.
9595

9696
If both ``process-group`` and ``application-group`` options are set, the
9797
WSGI script file will be pre-loaded when the process it is to run in is

docs/configuration-directives/WSGIScriptAliasMatch.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ Options which can be supplied to the ``WSGIScriptAlias`` directive are:
5959
If the name is set to be ``%{GLOBAL}`` the application group will be
6060
set to the empty string. Any WSGI applications in the global
6161
application group will always be executed within the context of the
62-
first interpreter created by Python when it is initialised. Forcing
63-
a WSGI application to run within the first interpreter can be
64-
necessary when a third party C extension module for Python has used
65-
the simplified threading API for manipulation of the Python GIL and
66-
thus will not run correctly within any additional sub interpreters
67-
created by Python.
62+
first interpreter created by Python when it is initialised, of the
63+
process handling the request. Forcing a WSGI application to run within
64+
the first interpreter can be necessary when a third party C extension
65+
module for Python has used the simplified threading API for
66+
manipulation of the Python GIL and thus will not run correctly within
67+
any additional sub interpreters created by Python.
6868

69-
If both ``process-group`` and ``application-group`` options are set, the
70-
WSGI script file will be pre-loaded when the process it is to run in is
71-
started, rather than being lazily loaded on the first request.
69+
If both ``process-group`` and ``application-group`` options are set, and
70+
the WSGI script file doesn't include substiutions values to be supplied
71+
from the matched URL pattern, the WSGI script file will be pre-loaded when
72+
the process it is to run in is started, rather than being lazily loaded on
73+
the first request.

docs/release-notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Release Notes
55
.. toctree::
66
:maxdepth: 2
77

8+
release-notes/version-4.6.0
9+
810
release-notes/version-4.5.24
911
release-notes/version-4.5.23
1012
release-notes/version-4.5.22

0 commit comments

Comments
 (0)