Title: make altinstall for PGO is not parallel-safe · Issue #93584 · python/cpython · GitHub
Open Graph Title: make altinstall for PGO is not parallel-safe · Issue #93584 · python/cpython
X Title: make altinstall for PGO is not parallel-safe · Issue #93584 · python/cpython
Description: Bug report setup.py has a helper method add_multiarch_paths. The method creates a temporary file build/lib.{platform}/multiarch and unlinks it at the end of the function call. This is not parallel-safe. PGO builds of Python use $(MAKE), ...
Open Graph Description: Bug report setup.py has a helper method add_multiarch_paths. The method creates a temporary file build/lib.{platform}/multiarch and unlinks it at the end of the function call. This is not parallel-...
X Description: Bug report setup.py has a helper method add_multiarch_paths. The method creates a temporary file build/lib.{platform}/multiarch and unlinks it at the end of the function call. This is not parallel-...
Opengraph URL: https://github.com/python/cpython/issues/93584
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"make altinstall for PGO is not parallel-safe","articleBody":"**Bug report**\r\n\r\n``setup.py`` has a helper method [``add_multiarch_paths``](https://github.com/python/cpython/blob/70690c7233aaad4431660a64daef81b5220e2ac1/setup.py#L688-L696). The method creates a temporary file ``build/lib.{platform}/multiarch`` and unlinks it at the end of the function call. This is not parallel-safe.\r\n\r\nPGO builds of Python use ``$(MAKE)``, so called *recursive make*. [Recursive makes are considered harmful](https://accu.org/journals/overload/14/71/miller_2004/) because the main make process has no understanding what the child make process is doing. With heavy parallel makes this can cause race conditions.\r\n\r\nThe combination of unsafe ``add_multiarch_paths()``, recursive make and loooots of CPU cores can lead to build issues like https://github.com/python/cpython/issues/84461#issuecomment-1148672087.\r\n\r\n**Possible workarounds**\r\n\r\n1) Rewrite our Makefile to not use ``$(MAKE)``\r\n2) Move ``CC -print-multiarch`` and ``dpkg-architecture ... -qDEB_HOST_MULTIARCH`` calls to ``configure.ac``\r\n3) Fix ``_bootsubprocess.check_output()`` and ``add_multiarch_paths()`` to use a more safe tmp file\r\n\r\nOption (3) is the simplest approach. Even ``tmpfile = os.path.join(self.build_temp, f'multiarch-{os.getpid()}')`` would be good enough to avoid file conflicts in parallel builds.","author":{"url":"https://github.com/tiran","@type":"Person","name":"tiran"},"datePublished":"2022-06-07T14:04:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/93584/cpython/issues/93584"}
| 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:158bcdcc-ede6-3274-f2da-6325771e8c15 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3D8:10CAF0:3DF993:5300F8:69697DDA |
| html-safe-nonce | b9704c55c409d30e602dd146293d3915d6a789801fbbd6b7c94b02477f44e3aa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0Q4OjEwQ0FGMDozREY5OTM6NTMwMEY4OjY5Njk3RERBIiwidmlzaXRvcl9pZCI6IjE5NTI2MTAzNjIwOTQ4NzgxNzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a898201d10fa5eb4fa6ef980d5bed7d438012b907d1b86cd83c771661eb664fa |
| hovercard-subject-tag | issue:1263363247 |
| 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/93584/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8c79f10e37b433299a305f608858c6f958853829a2ddfa24c7898993d8483f0f/python/cpython/issues/93584 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8c79f10e37b433299a305f608858c6f958853829a2ddfa24c7898993d8483f0f/python/cpython/issues/93584 |
| og:image:alt | Bug report setup.py has a helper method add_multiarch_paths. The method creates a temporary file build/lib.{platform}/multiarch and unlinks it at the end of the function call. This is not parallel-... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tiran |
| hostname | github.com |
| expected-hostname | github.com |
| None | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| 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 | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width