gh-152754: Fix crash when an os.scandir iterator is shared between threads#153402
Open
deadlovelll wants to merge 1 commit into
Open
gh-152754: Fix crash when an os.scandir iterator is shared between threads#153402deadlovelll wants to merge 1 commit into
deadlovelll wants to merge 1 commit into
Conversation
Member
|
I have some concerns about this approach. Using critical sections is probably not the right tool. We still want to release the GIL when doing IO, i.e. the Py_BEGIN_ALLOW_THREADS / Py_END_ALLOW_THREADS blocks. I created a revised PR based on this one that uses a mutex instead. With the mutex it's easier to confirm that everything is safe (critical section can be released depending on what you call inside of it) and it's pretty easy to also confirm there is no deadlock risk (always a concern when using a plain mutex). BTW, for the unit test, you should use |
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.
Fix crash when an os.scandir iterator is shared between threads
for more details see gh-152754