[issue39959] Bug on multiprocessing.shared_memory

Rauan Mukhamejanov report at bugs.python.org
Sun May 17 11:25:54 EDT 2020


Rauan Mukhamejanov <rauan.argyn at gmail.com> added the comment:

Not sure about "it can always be accessed and closed/unlinked by any process later on", as each process will be spawning its own resource_tracker, using a separate pipe. Thus, unregister calls from other processes will not have any effect. 

The documentation is indeed unclear that processes must share the resource_tracker. Can we introduce a new flag - "persist", that would indicate no resource tracking is needed? Registering will only happen if create=True and persist=False, meaning the user accepts the creating process must outlive all other processes that could connect to the shared memory. If persist=False, the user accepts the responsibility for manual cleaning up of the allocated memory. This will allow catering to a wider range of use cases, where readers/writer processes can exit and re-connect to shared_memory as they see fit.

----------
nosy: +rauanargyn

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39959>
_______________________________________


More information about the Python-bugs-list mailing list