Deadlock with logging multiprocess/multithread python script

后端 未结 2 1880
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 05:42

I am facing the problem with collecting logs from the following script. Once I set up the SLEEP_TIME to too \"small\" value, the LoggingThread threads somehow b

2条回答
  •  感动是毒
    2020-12-16 06:41

    This is probably bug 6721.

    The problem is common in any situation where you have locks, threads and forks. If thread 1 had a lock while thread 2 calls fork, in the forked process, there will only be thread 2 and the lock will be held forever. In your case, that is logging.StreamHandler.lock.

    A fix can be found here (permalink) for the logging module. Note that you need to take care of any other locks, too.

提交回复
热议问题