Message391862
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:46 | DaRoee | set | recipients:
+ DaRoee |
2021-04-25 16:58:46 | DaRoee | set | messageid: <1619369926.8.0.917759570645.issue43939@roundup.psfhosted.org> |
2021-04-25 16:58:46 | DaRoee | link | issue43939 messages |
2021-04-25 16:58:46 | DaRoee | create | |
|