cpython/Lib/logging
Miss Islington (bot) 3b699932e5 bpo-6721: Hold logging locks across fork() (GH-4071) (#9291)
bpo-6721: When os.fork() was called while another thread holds a logging lock, the child process may deadlock when it tries to log.  This fixes that by acquiring all logging locks before fork and releasing them afterwards.

A regression test that fails before this change is included.

Within the new unittest itself: There is a small _potential_ due to mixing of fork and a thread in the child process if the parent's thread happened to hold a non-reentrant library call lock (malloc?) when the os.fork() happens.  buildbots and time will tell if this actually manifests itself in this test or not.  :/  A functionality test that avoids that would be a challenge.

An alternate test that isn't trying to produce the deadlock itself but just checking that the release and acquire calls are made would be the next best alternative if so.
(cherry picked from commit 19003841e9)

Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
2018-10-07 00:09:59 -07:00
..
__init__.py bpo-6721: Hold logging locks across fork() (GH-4071) (#9291) 2018-10-07 00:09:59 -07:00
config.py bpo-33978: Close existing handlers before logging (re-)configuration. (GH-8008) (GH-8044) 2018-07-02 10:35:09 +01:00
handlers.py bpo-34334: Don't log traceback twice in QueueHandler (GH-9537) (GH-9581) 2018-10-07 00:33:37 -04:00