This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Parallel build race condition on AIX since python-2.7
Type: behavior Stage: resolved
Components: Build Versions: Python 3.10, Python 3.9
process
Status: open Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BTaskaya, David.Edelsohn, Michael.Felt, ericvw, haubi, kadler, loewis, miss-islington, skrah
Priority: normal Keywords: patch

Created on 2013-11-07 16:04 by haubi, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
python-tip-aix-parallel.patch haubi, 2013-11-07 16:04 Fix parallel build race condition on AIX review
issue19521-parallel-build-race-on-aix.patch haubi, 2014-06-04 06:35 patch for 3.4
aix-parallel-build-race-refresh.patch ericvw, 2016-11-27 14:26 Refreshed 2014 patch for tip of CPython review
Pull Requests
URL Status Linked Edit
PR 682 closed haubi, 2017-03-16 13:09
PR 21997 merged skrah, 2020-08-29 10:48
PR 22001 merged miss-islington, 2020-08-29 15:55
PR 22002 closed miss-islington, 2020-08-29 15:56
Repositories containing patches
http://hg.code.sf.net/p/prefix-launcher/cpython#issue19521
Messages (15)
msg202357 - (view) Author: Michael Haubenwallner (haubi) * Date: 2013-11-07 16:04
Since python-3.2, there is a race condition building in parallel on AIX:

Consider these Makefile(.pre.in) rules:

$(BUILDPYTHON): ...
  $(LINKCC) ... $(LINKFORSHARED) ...

Modules/_testembed: ...
  $(LINKCC) ... $(LINKFORSHARED) ...

Modules/_freeze_importlib: ...
  $(LINKCC) ...

On AIX, the variables get these values:

LINKCC = $(srcdir)/Modules/makexp_aix Modules/python.exp ...
LINKFORSHARED = -Wl,-bE:Modules/python.exp ...

Now $(BUILDPYTHON) and Modules/_testembed may run in parallel, causing Modules/python.exp to be created by two instances of makexp_aix eventually running at the same time.

Attached patch fixes this problem for cpython tip (doubt supporting AIX 4.1 and earlier still is necessary).

Thank you!
msg202379 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2013-11-07 18:01
Wouldn't it be better if linking _testembed generated _testembed.exp instead of generating python.exp? I hope using $@.exp somehow could help. Hard-coding the name of the export file sounds like a flaw in the first place.
msg202407 - (view) Author: Michael Haubenwallner (haubi) * Date: 2013-11-08 07:14
I'm unsure about the real purpose of _testembed, but given the name it does make sense to me to export the same symbols as $(BUILDPYTHON), thus reusing python.exp.
msg202435 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2013-11-08 16:45
+1
msg219742 - (view) Author: Michael Haubenwallner (haubi) * Date: 2014-06-04 06:35
Patch including configure update now.
msg281827 - (view) Author: Eric N. Vander Weele (ericvw) * Date: 2016-11-27 14:26
I also have found this goes back since Python 2.7.

I have refreshed the patched for the tip of CPython.  What can I do to help push this forward?
msg281833 - (view) Author: Eric N. Vander Weele (ericvw) * Date: 2016-11-27 18:53
I may be able to simplify the build on AIX by removing ld_so_aix and python.exp entirely.  Would this be a preferred solution if I am able to get something working?  If so, should I create a separate issue to track the change?
msg375626 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-08-18 21:07
The original patch is a bit dated, do we still need the export symbol generation?

https://www.ibm.com/support/knowledgecenter/en/SSGH3R_16.1.0/com.ibm.xlcpp161.aix.doc/proguide/compiling_shared_aix.html

"Use the -G option to create a shared library from the generated object files, and to enable runtime linking with applications that support it."

"If you do not specify a -bE option, all the global symbols are exported except for those symbols that have the hidden or internal visibility attribute."
msg375627 - (view) Author: David Edelsohn (David.Edelsohn) * Date: 2020-08-18 21:10
Yes, export file generation still is required.

Python does not need to utilize runtime linking.  Using -G is a very bad choice and severely discouraged with severe performance and other penalties.
msg376059 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-08-29 11:51
Okay, thanks.  The -G option is of course attractive for Linux projects
because it requires minimal changes in the build machinery.

I've added support for libmpdec/libmpdec++ (next release) for AIX-style
shared libraries (shr.o inside libmpdec.a).  The AIX linker has a certain
elegance, but it requires something like 150 lines of code changes and
conditionals inside the Makefiles.

I can confirm that -G is substantially slower, so I'm going to commit this
patch soon.
msg376063 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-08-29 14:03
I can't find the reason for:

        if test -z "$EXPORTSYMS"; then
            EXPORTSYMS="Modules/python.exp"
        fi


Modules/python.exp is hardcoded elsewhere, and I'd rather set
EXPORTSYMS unconditionally on AIX and unset it unconditionally
for all other systems (which don't build with the patch if
EXPORTSYMS happens to be defined).
msg376067 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-08-29 15:00
New changeset e6dcd371b2c54a94584dd124e8c592a496d46a47 by Stefan Krah in branch 'master':
bpo-19521: Fix parallel build race condition on AIX (GH-21997)
https://github.com/python/cpython/commit/e6dcd371b2c54a94584dd124e8c592a496d46a47
msg376069 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-08-29 16:36
New changeset 88b86a9752afc2c50ca196f6ba1a8d62d71cf398 by Miss Islington (bot) in branch '3.9':
bpo-19521: Fix parallel build race condition on AIX (GH-22001)
https://github.com/python/cpython/commit/88b86a9752afc2c50ca196f6ba1a8d62d71cf398
msg376070 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-08-29 16:40
This is in master and 3.9.1.  I'll not backport to 3.8 because a release candidate is imminent.
msg376681 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2020-09-10 12:22
I have been asked to backport this to 3.8. There's a very small window
of opportunity:

3.8.6: Monday, 2020-09-21
3.8.7rc1: Monday, 2020-11-02
3.8.7: Monday, 2020-11-16     (final version!)


Backporting procedures since 3.8 are unclear and a source of
constant friction, so most core developers seem to have stopped
doing any backports at all.  It is not a battle I'll choose, but
if you get a second core dev to review this trivial patch I'll
commit it.

There's a simple solution for 3.8: Do not use the parallel build,
the regular build takes around 4 min.


For the buildbots you can ask the operator for a custom command
line.
History
Date User Action Args
2022-04-11 14:57:53adminsetgithub: 63720
2020-09-10 12:22:11skrahsetstatus: closed -> open

messages: + msg376681
2020-08-29 16:40:36skrahsetstatus: open -> closed
versions: + Python 3.9
type: behavior
messages: + msg376070

resolution: fixed
stage: patch review -> resolved
2020-08-29 16:36:47skrahsetmessages: + msg376069
2020-08-29 15:56:05miss-islingtonsetpull_requests: + pull_request21108
2020-08-29 15:55:59miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request21107
2020-08-29 15:00:15skrahsetmessages: + msg376067
2020-08-29 14:03:57skrahsetmessages: + msg376063
2020-08-29 11:51:02skrahsetmessages: + msg376059
2020-08-29 10:48:58skrahsetstage: patch review
pull_requests: + pull_request21103
2020-08-18 21:10:01David.Edelsohnsetmessages: + msg375627
2020-08-18 21:07:26skrahsetmessages: + msg375626
2020-08-15 21:06:03skrahsetversions: + Python 3.10, - Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
2020-08-15 21:05:36skrahsetnosy: + skrah, Michael.Felt, kadler, BTaskaya
2020-08-15 21:05:30skrahlinkissue40424 superseder
2017-03-16 13:09:47haubisetpull_requests: + pull_request560
2016-11-27 18:53:54ericvwsetmessages: + msg281833
2016-11-27 14:26:10ericvwsetfiles: + aix-parallel-build-race-refresh.patch

messages: + msg281827
title: parallel build race condition on AIX since python-3.2 -> Parallel build race condition on AIX since python-2.7
2016-11-27 13:56:32ericvwsetnosy: + ericvw

versions: + Python 2.7, Python 3.6, Python 3.7
2014-06-06 11:08:26haubisethgrepos: + hgrepo251
2014-06-04 06:35:59haubisetfiles: + issue19521-parallel-build-race-on-aix.patch

messages: + msg219742
2014-06-04 06:33:35haubisethgrepos: - hgrepo248
2014-06-04 06:03:14haubisethgrepos: + hgrepo248
2013-11-08 16:45:49David.Edelsohnsetnosy: + David.Edelsohn
messages: + msg202435
2013-11-08 07:14:47haubisetmessages: + msg202407
2013-11-07 18:01:12loewissetnosy: + loewis
messages: + msg202379
2013-11-07 16:04:54haubicreate