This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: fix for a deadlock in the logging module
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: sprause, vinay.sajip
Priority: normal Keywords: patch

Created on 2005-03-07 03:28 by sprause, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
logging_deadlock.patch sprause, 2005-03-07 03:28
Messages (3)
msg47883 - (view) Author: Sebastian Prause (sprause) Date: 2005-03-07 03:28
there is a deadlock in the logging package, that can be
triggered with a custom class importer:

(1) create a custom class importer and put it in
sys.meta_path (this importer must log a message via the
logging package)
(2) raise an exception somewhere and log it
(3) when the formatter tries to format the exception,
it imports the traceback module (in the formatException
method)
(4) this import will be redirected to the above
installed class importer
(5) the class importer tries to log a message
(6) trying to acquire the lock for the new log message
in Handler.acquire results in a deadlock

the fix is to move the traceback import from the method
to the module, so it gets imported when no lock is
held. the attached patch does this
msg47884 - (view) Author: Sebastian Prause (sprause) Date: 2005-03-07 21:47
Logged In: YES 
user_id=925608

SMTPHandler and HTTPHandler have the same problem, as they
import modules in the emit() method...
msg47885 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2005-03-13 09:59
Logged In: YES 
user_id=308438

Fix checked into CVS, thanks.
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41661
2005-03-07 03:28:50sprausecreate