Navigation Menu

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

bpo-32186: Release the GIL during lseek and fstat #4652

Merged
merged 3 commits into from Dec 1, 2017

Conversation

nirs
Copy link
Contributor

@nirs nirs commented Nov 30, 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.

https://bugs.python.org/issue32186

@nirs
Copy link
Contributor Author

nirs commented Nov 30, 2017

@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.
@nirs nirs changed the title bpo-XXX: Release the GIL during lseek and fstat bpo-32186: Release the GIL during lseek and fstat Nov 30, 2017
Copy link
Member

@vstinner vstinner left a 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
Copy link
Member

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.

Copy link
Contributor Author

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 👍

- Mention the impacted methods and the GIL (Victor)
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@miss-islington
Copy link
Contributor

Thanks @nirs for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@bedevere-bot
Copy link

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)
@nirs nirs deleted the fileio-gil-master branch October 1, 2022 22:17
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