cagney <andrew.cag...@gmail.com> added the comment:

> acquiring locks before fork in the thread doing the forking and releasing 
> them afterwards is always the safe thing to do.

It's also an easy way to cause a deadlock:

- register_at_fork() et.al. will cause per-logger locks to be acquired before 
the global lock (this isn't immediately obvious from the code)

If a thread were to grab its logging lock before the global lock then it would 
deadlock.  I'm guessing this isn't allowed - however I didn't see any comments 
to this effect?

Can I suggest documenting this, and also merging the two callbacks so that the 
ordering of these two acquires is made explicit.

- the per-logger locks are acquired in a random order

If a thread were to acquire two per-logger locks in a different order then 
things would deadlock.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue6721>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to