bpo-33021: Release the GIL during fstat() calls by nirs · Pull Request #6019 · python/cpython (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation11 Commits2 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
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()
https://bugs.python.org/issue33021
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()
nirs added a commit to nirs/cpython that referenced this pull request
If the file descriptor is on a non-responsive NFS server, calling fstat() can block for long time, hanging all threads. Most of the calls release the GIL around the call, but some calls seems to be forgotten.
This patch fixes the last calls, affecting users of:
- imp.load_dynamic()
- imp.load_source()
- mmap.mmap()
- mmapobject.size()
- os.fdopen()
- os.urandom()
- random.seed()
Hi @nirs, sorry for the delay. @vstinner is currently unavailable, so I'm gonna review this.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. The changes look basically fine to me. The only thing missing is a NEWS entry with a short description of the fix. You should use the blurb tool to generate it.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.
Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again
. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.
Thanks for the review @pitrou! I have made the requested changes; please review again.
Thanks for making the requested changes!
@pitrou: please review the changes made to this pull request.
Thanks @nirs for the PR, and @pitrou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖
Thanks @nirs for the PR, and @pitrou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
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 4484f9d)
Co-authored-by: Nir Soffer nirsof@gmail.com
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
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 4484f9d)
Co-authored-by: Nir Soffer nirsof@gmail.com
pitrou pushed a commit that referenced this pull request
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 4484f9d)
Co-authored-by: Nir Soffer nirsof@gmail.com
pitrou pushed a commit that referenced this pull request
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 4484f9d)
Co-authored-by: Nir Soffer nirsof@gmail.com
jo2y pushed a commit to jo2y/cpython that referenced this pull request
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()
nirs deleted the fstat-gil-master branch