Message349987
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. |
|
Date |
User |
Action |
Args |
2019-08-20 04:11:18 | vinay0410 | set | recipients:
+ vinay0410, pitrou, davin |
2019-08-20 04:11:18 | vinay0410 | set | messageid: <1566274278.08.0.265787700889.issue37754@roundup.psfhosted.org> |
2019-08-20 04:11:18 | vinay0410 | link | issue37754 messages |
2019-08-20 04:11:17 | vinay0410 | create | |
|