-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
make altinstall for PGO is not parallel-safe #93584
Copy link
Copy link
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-buildrelease-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesbuildThe build process and cross-buildThe build process and cross-buildrelease-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Fields
Give feedbackNo fields configured for issues without a type.
Bug report
setup.pyhas a helper methodadd_multiarch_paths. The method creates a temporary filebuild/lib.{platform}/multiarchand unlinks it at the end of the function call. This is not parallel-safe.PGO builds of Python use
$(MAKE), so called recursive make. Recursive makes are considered harmful because the main make process has no understanding what the child make process is doing. With heavy parallel makes this can cause race conditions.The combination of unsafe
add_multiarch_paths(), recursive make and loooots of CPU cores can lead to build issues like #84461 (comment).Possible workarounds
$(MAKE)CC -print-multiarchanddpkg-architecture ... -qDEB_HOST_MULTIARCHcalls toconfigure.ac_bootsubprocess.check_output()andadd_multiarch_paths()to use a more safe tmp fileOption (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.