New submission from mrc <marco.giu...@posteo.de>:

DataGraham in #django reported a deadlock with a very specific logging 
configuration. Issue is reproducible from this code: 
https://github.com/data-graham/wedge. To trigger the deadlock at least one 
handle must be enable. Note how there there are no loggers using those 
handlers. 
(https://github.com/data-graham/wedge/blob/master/wedge/settings.py#L127-L169)

The two offending locks causing the deadlock are logging._lock and a lock used 
by importlib._bootstrap._imp (_PyImport_AcquireLock).


TH1> start and complete the logging configuration via dictConfig. An handler is 
configured but no logger uses it, only a weakref holds it
TH2> start logging configuration, acquires logging._lock
TH1> import some module, acquiring the import lock
TH1> the garbage collector starts and reclaims the unused handled (only a 
weakref exists)
TH1> the weakref callback tries to acquire logging._lock. WAITING
TH2> start importing some module, try to acquire import lock. DEADLOCK

Attached the traceback of the threads. I could test this with Python3.7 only 
(and Django 3.0).

----------
components: Library (Lib)
files: deadlock_logging.log
messages: 367085
nosy: mrc
priority: normal
severity: normal
status: open
title: Deadlock in logging.config.dictConfig
versions: Python 3.7
Added file: https://bugs.python.org/file49088/deadlock_logging.log

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40371>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to