Repository navigation
gh-155003: Don't try to close mmap in SharedMemory.__del__ - #155070
Conversation
de0a160 to
4fc964d
Compare
4fc964d to
b17d6e4
Compare
|
Is there anything else I should be doing on this? |
|
This is likely good. I added a regression test (thank Claude). letting PR CI run and i'll kickoff a buildbot series after that. |
|
🤖 New build scheduled with the buildbot fleet by @gpshead for commit 04a3ebb 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F155070%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
|
Thanks @takluyver for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
Sorry, @takluyver and @gpshead, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
GH-161797 is a backport of this pull request to the 3.15 branch. |
|
GH-161798 is a backport of this pull request to the 3.14 branch. |
…-155070) (#161797) gh-155003: Don't try to close mmap in SharedMemory.__del__ (GH-155070) * Don't try to close mmap in SharedMemory.__del__ * Add a test for SharedMemory finalization with a live buffer, expand NEWS --------- (cherry picked from commit 4b79d90) Co-authored-by: Thomas Kluyver <thomas@kluyver.me.uk> Co-authored-by: Gregory P. Smith <greg@krypto.org>
…honGH-155070) * Don't try to close mmap in SharedMemory.__del__ * Add a test for SharedMemory finalization with a live buffer, expand NEWS --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
This is an alternative to #155007, keeping the file descriptor in the object and fixing the
__del__method to close it without trying to close the mmap or memoryview, which was my original idea in #155003.I could add, in this PR or separately:
posix_fallocate()change as in gh-155003: Don't keep file descriptor in multiprocessing SharedMemory object #155007 - but with this option it's orthogonal..fileno()method, which is a convention for higher level objects which wrap an fd.mmap(..., trackfd=False)to skip the duplicate fd within mmap (at a cost of breaking potential workarounds usingsm._mmap.resize()&.size())