Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.6] bpo-33021: Release the GIL during fstat() calls (GH-6019) #6160

Merged
merged 2 commits into from Mar 20, 2018

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Mar 20, 2018

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

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()
(cherry picked from commit 4484f9d)

Co-authored-by: Nir Soffer <nirsof@gmail.com>
@pitrou pitrou merged commit f3e6ead into python:3.6 Mar 20, 2018
@miss-islington
Copy link
Contributor Author

Thanks, @pitrou!

@miss-islington miss-islington deleted the backport-4484f9d-3.6 branch March 20, 2018 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants