Title: multiprocessing.Pool: leak of global named resources using multiprocessing spawn · Issue #122770 · python/cpython · GitHub
Open Graph Title: multiprocessing.Pool: leak of global named resources using multiprocessing spawn · Issue #122770 · python/cpython
X Title: multiprocessing.Pool: leak of global named resources using multiprocessing spawn · Issue #122770 · python/cpython
Description: Bug report Bug description: 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...
Open Graph Description: Bug report Bug description: 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...
X Description: Bug report Bug description: 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: UserWar...
Opengraph URL: https://github.com/python/cpython/issues/122770
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"multiprocessing.Pool: leak of global named resources using multiprocessing spawn","articleBody":"# Bug report\n\n### Bug description:\n\nI'm receiving a warning when using the `multiprocessing.Pool` in `spawn` mode.\n\n```\n/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\n warnings.warn('resource_tracker: There appear to be %d '\n```\n\nA similar issue was brought up and fixed before, when `multiprocessing.Process` was used:\nhttps://github.com/python/cpython/pull/30617\n\nThe test case introduced by the PR above: https://github.com/python/cpython/blob/3.12/Lib/test/_test_multiprocessing.py#L6040C7-L6040C24\n\nTo trigger the warning, I just replaced the `Process` with `Pool` as follows:\n\n```python\nimport multiprocessing as mp\nctx = mp.get_context('spawn')\nglobal_resource = ctx.Semaphore()\ndef submain(): pass\nif __name__ == '__main__':\n p = ctx.Pool(processes=3).starmap(submain, [tuple() for i in range(5)])\n```\n\n### CPython versions tested on:\n\n3.11, 3.12, CPython main branch\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/vindex10","@type":"Person","name":"vindex10"},"datePublished":"2024-08-07T09:10:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/122770/cpython/issues/122770"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ba714b26-a963-43f3-af24-e4067d17e9fe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 963C:28C591:21EF4A:30012A:696A0624 |
| html-safe-nonce | a4fbec8335f812e2b7a58095d184fd4028adb5788de1908570515b59b63ab88d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjNDOjI4QzU5MToyMUVGNEE6MzAwMTJBOjY5NkEwNjI0IiwidmlzaXRvcl9pZCI6IjY2NjIwMDEwMTUyODYwMDczMzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6f966449789fc79b7714c0324a763a96468144ea1c810259b991e76f0c0f7c06 |
| hovercard-subject-tag | issue:2452975620 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/122770/issue_layout |
| twitter:image | https://opengraph.githubassets.com/45c55b26970734298a19ea584dcca009a6da3c7feebae48aa8501e31f07ac38f/python/cpython/issues/122770 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/45c55b26970734298a19ea584dcca009a6da3c7feebae48aa8501e31f07ac38f/python/cpython/issues/122770 |
| og:image:alt | Bug report Bug description: 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vindex10 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 578c119ff0247c8b2f2491fbf4fc0395cdf909d4df66598cebdc96ddfc4418dc |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 671c2f67171dbced24284331f3133a613d08c366 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width