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.

Author DaRoee
Recipients DaRoee
Date 2021-04-25.16:58:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I've recently encountered a weird bug. To make a long story short, I’ve been using an external package to make sure my threads stop working in time, and appearently it’s been using ctypes.pythonapi.PyThreadState_SetAsyncExc.
There is a slight chance, that this code that is literally injecting an exception in the thread, will throw an exception in the handle function of the logger, right after the acquire. This will make the whole process deadlocked (only the thread with the exception will be able to continue logging) once the other threads try to log.

While I totally understand that this is not a casual use case, I think that the logger should be able to handle situations such as this...
The good news is that I’ve created a test (attached) that once you run it with pytest it’ll reproduce constantly (even though it’s a statistical bug), and the solution for this is relatively easy. Once we change the lock to use context manager the whole action is much more atomic, making the test pass constantly.

I’d be happy to help solve it, and replace locks to context manager usage throughout the file (or whatever the maintainers see fit for this).
Date User Action Args
2021-04-25 16:58:46DaRoeesetrecipients: + DaRoee
2021-04-25 16:58:46DaRoeesetmessageid: <>
2021-04-25 16:58:46DaRoeelinkissue43939 messages
2021-04-25 16:58:46DaRoeecreate