[New-bugs-announce] [issue41447] Resource Tracker in Multiprocessing Shared Memory not working correctly

Damian Barabonkov report at bugs.python.org
Thu Jul 30 13:19:35 EDT 2020


New submission from Damian Barabonkov <damianb at mit.edu>:

The way the resource tracker is used in /Lib/multiprocessing/shared_memory.py leads to it issuing warnings/errors, even when resources are cleaned up properly.

Attached are two simple demo files copied from the documentation example (https://docs.python.org/3.9/library/multiprocessing.shared_memory.html) that illustrate the warnings below: 

proc1.py

Traceback (most recent call last):
  File "proc1.py", line 19, in <module>
    shm.unlink()  # Free and release the shared memory block at the very end
  File "/home/damian/Documents/QuantCo/miniconda3/envs/pipeline-parallel/lib/python3.8/multiprocessing/shared_memory.py", line 244, in unlink
    _posixshmem.shm_unlink(self._name)
FileNotFoundError: [Errno 2] No such file or directory: '/shmem'
/home/damian/Documents/QuantCo/miniconda3/envs/pipeline-parallel/lib/python3.8/multiprocessing/resource_tracker.py:218: UserWarning: resource_tracker: There appear to be 1 leaked shared_memory objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '
/home/damian/Documents/QuantCo/miniconda3/envs/pipeline-parallel/lib/python3.8/multiprocessing/resource_tracker.py:231: UserWarning: resource_tracker: '/shmem': [Errno 2] No such file or directory: '/shmem'
  warnings.warn('resource_tracker: %r: %s' % (name, e))


proc2.py

python3.8/multiprocessing/resource_tracker.py:218: UserWarning: resource_tracker: There appear to be 1 leaked shared_memory objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

----------
files: shmem_bug.py
messages: 374621
nosy: damian.barabonkov
priority: normal
severity: normal
status: open
title: Resource Tracker in Multiprocessing Shared Memory not working correctly
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49351/shmem_bug.py

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


More information about the New-bugs-announce mailing list