Skip to content

Commit 4334f56

Browse files
committed
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.
1 parent 6227662 commit 4334f56

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/library/logging.handlers.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,14 @@ possible, while any potentially slow operations (such as sending an email via
10591059
.. note:: If you are using :mod:`multiprocessing`, you should avoid using
10601060
:class:`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`.
10611061

1062+
.. warning::
1063+
1064+
The :mod:`multiprocessing` module uses an internal logger created and
1065+
accessed via :meth:`~multiprocessing.get_logger`.
1066+
:class:`multiprocessing.Queue` will log ``DEBUG`` level messages upon
1067+
items being queued. If those log messages are processed by the same
1068+
:class:`QueueHandler` it will cause a deadlock or infinite recursion.
1069+
10621070
.. method:: emit(record)
10631071

10641072
Enqueues the result of preparing the LogRecord. Should an exception

0 commit comments

Comments
 (0)