bpo-32186: Release the GIL during lseek and fstat#4652
Merged
Conversation
Contributor
Author
|
@vstinner can you review? |
In _io_FileIO_readall_impl, lseek and _Py_fstat_noraise were called without releasing the GIL. This can cause all threads to hang for unlimited time when calling FileIO.read() and the NFS server is not accessible.
c2d6dfd to
1258ef4
Compare
vstinner
reviewed
Nov 30, 2017
vstinner
left a comment
Member
There was a problem hiding this comment.
The code change LGTM, but I'm unhappy with the NEWS entry.
| @@ -0,0 +1,3 @@ | |||
| Fixed hang of all threads when using io.FileIO with inaccessible NFS server. | |||
| Now only the thread accessing the problematic storage will hang. Patch by | |||
Member
There was a problem hiding this comment.
"io.FileIO" is unclear. IMHO it's better here to mention the impacted methods, so read and readall, and mention the GIL. I propose:
io.FileIO.readall() and io.FileIO.read() now releases the GIL when getting the file size. Fixed hang of all threads with inaccessible NFS server. Patch by Nir Soffer.
Contributor
Author
There was a problem hiding this comment.
I'm happy with your suggestion, updating 👍
6f68fd6 to
cfebbec
Compare
- Mention the impacted methods and the GIL (Victor)
cfebbec to
4da8169
Compare
Contributor
|
GH-4661 is a backport of this pull request to the 3.6 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Dec 1, 2017
In _io_FileIO_readall_impl(), lseek() and _Py_fstat_noraise() were called without releasing the GIL. This can cause all threads to hang for unlimited time when calling FileIO.read() and the NFS server is not accessible. (cherry picked from commit 6a89481)
vstinner
pushed a commit
that referenced
this pull request
Dec 1, 2017
In _io_FileIO_readall_impl(), lseek() and _Py_fstat_noraise() were called without releasing the GIL. This can cause all threads to hang for unlimited time when calling FileIO.read() and the NFS server is not accessible. (cherry picked from commit 6a89481)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In _io_FileIO_readall_impl, lseek and _Py_fstat_noraise were called
without releasing the GIL. This can cause all threads to hang for
unlimited time when calling FileIO.read() and the NFS server is not
accessible.
https://bugs.python.org/issue32186