diff options
author | Gregory P. Smith <greg@krypto.org> | 2018-09-14 05:08:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-14 05:08:31 (GMT) |
commit | 19003841e965bbf56fd06824d6093620c1b66f9e (patch) | |
tree | 626ed792088f60c7191d4815e847ad0925593b7d /Misc | |
parent | ea13740a37347d68d096b11b87c9167917ccfc22 (diff) | |
download | cpython-19003841e965bbf56fd06824d6093620c1b66f9e.zip cpython-19003841e965bbf56fd06824d6093620c1b66f9e.tar.gz cpython-19003841e965bbf56fd06824d6093620c1b66f9e.tar.bz2 |
bpo-6721: Hold logging locks across fork() (GH-4071)
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.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2018-09-13-10-09-19.bpo-6721.ZUL_F3.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2018-09-13-10-09-19.bpo-6721.ZUL_F3.rst b/Misc/NEWS.d/next/Library/2018-09-13-10-09-19.bpo-6721.ZUL_F3.rst new file mode 100644 index 0000000..073a441 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-09-13-10-09-19.bpo-6721.ZUL_F3.rst @@ -0,0 +1,2 @@ +Acquire the logging module's commonly used internal locks while fork()ing to +avoid deadlocks in the child process. |