Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-44098: Release the GIL while calling mmap() in the mmap module on Windows#14114
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
For Windows we should ensure that the GIL is released for all calls to Another issue I notice with this module is that |
Thank you, Eryk Sun. If it is possible for access violations to occur when the mmap object is, for example, accessed by multiple threads, the GIL should not be released. For what it's worth, I did encounter an access violation when releasing the GIL in I will create a BPO issue for the mojibake issue. |
Right. Releasing the global lock in I did a little timing test in C to gauge the relative time taken by the calls needed to create a file, resize it to 128 MiB, get the size, create a section for it, map a view, unmap the view, and close the section and file handles. The following is the result for 1000 trials, keeping only values within a standard deviation for each call, and normalizing the averages against that of
In |
On second thought, the file could be remote, in which case the underlying This is unrelated, but a possible bug. For Unix, shouldn't |
Hey,@isidentical@ZackerySpytz@eryksun: this has been authored and accepted two years back. If this is still relevant, can you rebase on |
netlifybot commentedDec 12, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview forpython-cpython-preview ready!
To edit notification comments on pull requests, go to yourNetlify site settings. |
| size_hi, | ||
| size_lo, | ||
| m_obj->tagname); | ||
| Py_END_ALLOW_THREADS |
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.
This should be after theMapViewOfFile call. We can probably restructure the function to store results in locals and then determine success/failure after we have the GIL back
The following commit authors need to sign the Contributor License Agreement: |
Uh oh!
There was an error while loading.Please reload this page.
It is not safe to release the GIL for other relevant syscalls (for example, ftruncate()
or mremap()) in the mmap module -- segfaults could occur if the mmap
object is accessed from multiple threads.
https://bugs.python.org/issue1572968