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
bpo-32186: Release the GIL during lseek and fstat #4652
Conversation
@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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with your suggestion, updating 👍
6f68fd6
to
cfebbec
Compare
- Mention the impacted methods and the GIL (Victor)
cfebbec
to
4da8169
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
GH-4661 is a backport of this pull request to the 3.6 branch. |
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)
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)
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