Skip to content

Commit

Permalink
Add docs for WSGIDestroyInterpreter directive.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Sep 11, 2024
1 parent e80ac37 commit 01bf430
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/configuration-directives/WSGIDestroyInterpreter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
======================
WSGIDestroyInterpreter
======================

:Description: Enable/disable cleanup of Python interpreter.
:Syntax: ``WSGIDestroyInterpreter On|Off``
:Default: ``WSGIDestroyInterpreter On``
:Context: server config

The ``WSGIDestroyInterpreter`` directive is used to control whether the Python
interpreter is destroyed when processes are shutdown or restarted. By default
the Python interpreter is destroyed when the process is shutdown or restarted.

This directive was added due to changes in Python 3.9 where the Python cleanup
behaviour was changed such that it would wait on daemon threads to complete.
This could cause cleanup of the Python interpreter to hang in the some cases
where threads were created external to Python, as is the case where Python is
embedded in a C program such as mod_wsgi with Apache.

This problem of hanging when cleanup of the Python interpreter was attempted
was especially noticeable when using mod_wsgi to host Trac.

Note that it is not known whether versions of Python newer than 3.9 still have
this problem or whether further changes were made in Python interpreter cleanup
code.
1 change: 1 addition & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Configuration
configuration-directives/WSGICaseSensitivity
configuration-directives/WSGIChunkedRequest
configuration-directives/WSGIDaemonProcess
configuration-directives/WSGIDestroyInterpreter
configuration-directives/WSGIImportScript
configuration-directives/WSGILazyInitialization
configuration-directives/WSGIPassAuthorization
Expand Down

0 comments on commit 01bf430

Please sign in to comment.