This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vinay0410
Recipients davin, pitrou, vinay0410
Date 2019-08-20.04:11:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1566274278.08.0.265787700889.issue37754@roundup.psfhosted.org>
In-reply-to
Content
Hi Davin,
Thanks for replying!

As you said I went through the issue, and now understand why segments should not be automatically created if they don't exist.

But, after reading that thread I got to know that shared memory is supposed to exist even if the process exits, and it can only be freed by unlink, which I also believe is an important functionality required by many use cases as you mentioned.

But, this is not the behaviour currently.
As soon as the process exists, all the shared memory created is unlinked.

Also, the documentation currently mentions: "shared memory blocks may outlive the original process that created them", which is not the case at all.

Currently, the resource_tracker, unlinks the shared memory, by calling unlink as specified here:
```
if os.name == 'posix':
    import _multiprocessing
    import _posixshmem

    _CLEANUP_FUNCS.update({
        'semaphore': _multiprocessing.sem_unlink,
        'shared_memory': _posixshmem.shm_unlink,
    })
```

So, is this an expected behaviour, if yes documentation should be updated, and if not the code base should be.

I will be happy to submit a patch in both the cases.

PS: I personally believe from my experience that shared memory segments should outlive the process, unless specified otherwise. Also, a argument persist=True, can be added which can ensure that the shared_memory segment outlives the process, and can be used by processes which are spawned later.
History
Date User Action Args
2019-08-20 04:11:18vinay0410setrecipients: + vinay0410, pitrou, davin
2019-08-20 04:11:18vinay0410setmessageid: <1566274278.08.0.265787700889.issue37754@roundup.psfhosted.org>
2019-08-20 04:11:18vinay0410linkissue37754 messages
2019-08-20 04:11:17vinay0410create