You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
multiprocessing.Pool: leak of global named resources using multiprocessing spawn #122770
I'm receiving a warning when using the multiprocessing.Pool in spawn mode.
/opt/pyenv/versions/3.12.4/lib/python3.12/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
A similar issue was brought up and fixed before, when multiprocessing.Process was used: #30617
import multiprocessing as mp
from multiprocessing import Queue
ctx = mp.get_context('forkserver')
global_resource = ctx.Semaphore()
def submain(): pass
if __name__ == '__main__':
p = ctx.Pool(processes=3).starmap(submain, [tuple() for i in range(5)])
Only the number of leaked objects differ
/usr/lib64/python3.11/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 3 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
Activity
hanke-it-nrw commentedon Dec 17, 2024
I have the same issue with context
forkserver:Only the number of leaked objects differ
CPython versions tested on:
3.11, 3.12, CPython main branch
Operating systems tested on:
Linux