classification
Title: Resource Tracker in Multiprocessing Shared Memory not working correctly
Type: behavior Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: damian.barabonkov, davin, gvanrossum, pitrou
Priority: normal Keywords:

Created on 2020-07-30 17:19 by damian.barabonkov, last changed 2020-08-03 00:57 by gvanrossum. This issue is now closed.

Files
File name Uploaded Description Edit
shmem_bug.py damian.barabonkov, 2020-07-30 17:19
Messages (2)
msg374621 - (view) Author: Damian Barabonkov (damian.barabonkov) Date: 2020-07-30 17:19
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 '
msg374707 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2020-08-03 00:57
Looks like a duplicate of https://bugs.python.org/issue38119
History
Date User Action Args
2020-08-03 00:57:01gvanrossumsetstatus: open -> closed

nosy: + gvanrossum
messages: + msg374707

resolution: duplicate
stage: resolved
2020-08-01 07:26:17ned.deilysetnosy: + pitrou, davin
2020-07-30 17:19:35damian.barabonkovcreate