GIL (Global Interpreter Lock) prevents the execution of any Python code at the same time, so technically the main thread cannot process the signal while other threads are running. It can "appear" in this way, but there is one big mutex that allows only one python thread to run at a time.
The best thing I can guess is the problem with signals and flows is that the signal is usually caused by an interrupt that can happen at any time. So I would suggest that Python stops what it is doing and invokes the handler. At this point, a lock can already be obtained, and if logging tries to block again, you get a dead end. In some implementations, this works fine, because the mutex can be locked several times (re-entry), but others only have one lock.
Hope someone else can support this.
milkypostman
source share