Skip to content

Commit a4625d5

Browse files
duanegvsajip
andauthored
gh-91555: add warning to docs about possibility of deadlock/infinite recursion (GH-135954)
* 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 <[email protected]> * Change whitespace. --------- Co-authored-by: Vinay Sajip <[email protected]>
1 parent 0d76dcc commit a4625d5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Doc/library/logging.handlers.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,15 @@ 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 a
1068+
:class:`QueueHandler` using the same :class:`multiprocessing.Queue` instance,
1069+
it will cause a deadlock or infinite recursion.
1070+
10621071
.. method:: emit(record)
10631072

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

0 commit comments

Comments
 (0)