]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91555: add warning to docs about possibility of deadlock/infinite recursion (GH...
authorDuane Griffin <duaneg@dghda.com>
Thu, 26 Jun 2025 14:18:32 +0000 (02:18 +1200)
committerGitHub <noreply@github.com>
Thu, 26 Jun 2025 14:18:32 +0000 (15:18 +0100)
* gh-91555: add warning to docs about possibility of deadlock/infinite recursion

Attempt to clarify in the documentation that care must be taken when using
multiprocessing classes to implement logging since they have builtin internal
logging, and hence may cause deadlock/infinite recursion.

* Update Doc/library/logging.handlers.rst

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
* Change whitespace.

---------

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Doc/library/logging.handlers.rst

index 8f3aa1dfdd0cde5e11343db6a39d87000a401326..d74ef73ee284979b7c8ae8565780e7d655899731 100644 (file)
@@ -1059,6 +1059,15 @@ possible, while any potentially slow operations (such as sending an email via
    .. note:: If you are using :mod:`multiprocessing`, you should avoid using
       :class:`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`.
 
+   .. warning::
+
+      The :mod:`multiprocessing` module uses an internal logger created and
+      accessed via :meth:`~multiprocessing.get_logger`.
+      :class:`multiprocessing.Queue` will log ``DEBUG`` level messages upon
+      items being queued. If those log messages are processed by a
+      :class:`QueueHandler` using the same :class:`multiprocessing.Queue` instance,
+      it will cause a deadlock or infinite recursion.
+
    .. method:: emit(record)
 
       Enqueues the result of preparing the LogRecord. Should an exception