]> granicus.if.org Git - python/commit
[3.7] bpo-33021: Release the GIL during fstat() calls (GH-6019) (GH-6159)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 20 Mar 2018 19:16:30 +0000 (12:16 -0700)
committerAntoine Pitrou <pitrou@free.fr>
Tue, 20 Mar 2018 19:16:30 +0000 (20:16 +0100)
commit56cce1ca84344f519f7ed01024434c083031d354
tree24b27081d096fedbb363b298ef881f05f982834e
parent3d41f482594b6aab12a316202b3c06757262109a
[3.7] bpo-33021: Release the GIL during fstat() calls (GH-6019) (GH-6159)

fstat may block for long time if the file descriptor is on a
non-responsive NFS server, hanging all threads. Most fstat() calls are
handled by _Py_fstat(), releasing the GIL internally, but but
_Py_fstat_noraise() does not release the GIL, and most calls release the
GIL explicitly around it.

This patch fixes last 2 calls to _Py_fstat_no_raise(), avoiding hangs
when calling:
- mmap.mmap()
- os.urandom()
- random.seed()
(cherry picked from commit 4484f9dca9149da135bbae035f10a50d20d1cbbb)

Co-authored-by: Nir Soffer <nirsof@gmail.com>
Misc/NEWS.d/next/Library/2018-03-12-00-27-56.bpo-33021.m19B9T.rst [new file with mode: 0644]
Modules/mmapmodule.c
Python/bootstrap_hash.c