Bug 1738752 - wx + NumPy breaks Pillow on ppc64le
Summary: wx + NumPy breaks Pillow on ppc64le
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: openblas
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Susi Lehtola
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1722181
Blocks: PPCTracker
TreeView+ depends on / blocked
 
Reported: 2019-08-08 05:13 UTC by Elliott Sales de Andrade
Modified: 2019-10-01 14:55 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Elliott Sales de Andrade 2019-08-08 05:13:53 UTC
Description of problem:
When both wx and NumPy are imported, then importing Pillow fails due to some TLS error in libgomp:

/lib64/libgomp.so.1: cannot allocate memory in static TLS block


Version-Release number of selected component (if applicable):
python3-numpy-1.17.0-2.fc31.ppc64le
python3-pillow-6.1.0-2.fc31.ppc64le
python3-wxpython4-4.0.6-5.fc31.ppc64le


Steps to reproduce:
$ mock -r fedora-rawhide-ppc64le --forcearch=ppc64le --install python3-numpy python3-pillow python3-wxpython4
$ mock -r fedora-rawhide-ppc64le --forcearch=ppc64le --shell

(wx + numpy) then pillow fails:

# python3 -q
>>> import wx
>>> import numpy
>>> from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.7/site-packages/PIL/Image.py", line 95, in <module>
    from . import _imaging as core
ImportError: /lib64/libgomp.so.1: cannot allocate memory in static TLS block
>>> 

# python3 -q
>>> import numpy
>>> import wx
>>> from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.7/site-packages/PIL/Image.py", line 95, in <module>
    from . import _imaging as core
ImportError: /lib64/libgomp.so.1: cannot allocate memory in static TLS block
>>> 

but any other order works, e.g.,

# python3 -q
>>> import numpy
>>> from PIL import Image
>>> import wx
>>> 

# python3 -q
>>> import wx
>>> from PIL import Image
>>> import numpy
>>> 


Additional information:
This breaks the Matplotlib tests on ppc64le only. See this build https://koji.fedoraproject.org/koji/taskinfo?taskID=36854425 for example:
_______________________ test_interactive_backend[wxagg] ________________________
[gw11] linux -- Python 3.7.4 /usr/bin/python3
backend = 'wxagg'
    @pytest.mark.parametrize("backend", _get_testable_interactive_backends())
    @pytest.mark.flaky(reruns=3)
    def test_interactive_backend(backend):
        proc = subprocess.run([sys.executable, "-c", _test_script],
                              env={**os.environ, "MPLBACKEND": backend},
                              timeout=_test_timeout)
        if proc.returncode:
>           pytest.fail("The subprocess returned with non-zero exit status "
                        f"{proc.returncode}.")
E           Failed: The subprocess returned with non-zero exit status 1.
../../BUILDROOT/python-matplotlib-3.1.1-1.fc31.ppc64le/usr/lib64/python3.7/site-packages/matplotlib/tests/test_backends_interactive.py:117: Failed
------------------------------ Captured log setup ------------------------------
WARNING  matplotlib.testing:__init__.py:40 Could not set locale to English/United States. Some date-related tests may fail.
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/builddir/build/BUILDROOT/python-matplotlib-3.1.1-1.fc31.ppc64le/usr/lib64/python3.7/site-packages/matplotlib/pyplot.py", line 2355, in <module>
    switch_backend(rcParams["backend"])
  File "/builddir/build/BUILDROOT/python-matplotlib-3.1.1-1.fc31.ppc64le/usr/lib64/python3.7/site-packages/matplotlib/pyplot.py", line 221, in switch_backend
    backend_mod = importlib.import_module(backend_name)
  File "/usr/lib64/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/builddir/build/BUILDROOT/python-matplotlib-3.1.1-1.fc31.ppc64le/usr/lib64/python3.7/site-packages/matplotlib/backends/backend_wxagg.py", line 3, in <module>
    from .backend_agg import FigureCanvasAgg
  File "/builddir/build/BUILDROOT/python-matplotlib-3.1.1-1.fc31.ppc64le/usr/lib64/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 45, in <module>
    from PIL import Image
  File "/usr/lib64/python3.7/site-packages/PIL/Image.py", line 95, in <module>
    from . import _imaging as core
ImportError: /lib64/libgomp.so.1: cannot allocate memory in static TLS block

Comment 1 Dan Horák 2019-08-08 09:24:56 UTC
same as bug #1722181, I was it sure it will appear again, but not that soon ...

Comment 2 Ben Cotton 2019-08-13 16:58:19 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 3 Ben Cotton 2019-08-13 17:20:14 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.

Comment 4 Scott Talbert 2019-09-20 00:51:28 UTC
Finally looked into this.  I ran the same procedure that was run in the linked ticket.  See the output below.  If I'm reading this correctly, it looks like one of the wxWidgets libraries is using a small bit of TLS (8 bytes), but even if I get rid of that I don't think it will help.  It looks like the big TLS user here is /lib64/libopenblasp.so.0.  I think the libopenblasp library is going to need to reduce its usage of TLS, so I'm going to reassign to that package.

lib=/lib64/libc.so.6
  TLS            0x1ecb60 0x00000000001fcb60 0x00000000001fcb60 0x000010 0x000090 R   0x8
lib=/lib64/libpython3.8.so.1.0
lib=/lib64/libpthread.so.0
lib=/lib64/libdl.so.2
lib=/lib64/libutil.so.1
lib=/lib64/libm.so.6
lib=/lib64/libwx_gtk3u_core-3.0.so.0
lib=/lib64/libwx_baseu_net-3.0.so.0
lib=/lib64/libwx_baseu-3.0.so.0
  TLS            0x323b80 0x0000000000333b80 0x0000000000333b80 0x000000 0x000008 R   0x8
lib=/lib64/libstdc++.so.6
  TLS            0x2741a8 0x00000000002841a8 0x00000000002841a8 0x000000 0x000020 R   0x8
lib=/lib64/libgcc_s.so.1
lib=/lib64/libgtk-3.so.0
lib=/lib64/libgdk-3.so.0
lib=/lib64/libpangocairo-1.0.so.0
lib=/lib64/libpango-1.0.so.0
lib=/lib64/libcairo.so.2
lib=/lib64/libgdk_pixbuf-2.0.so.0
lib=/lib64/libgobject-2.0.so.0
lib=/lib64/libglib-2.0.so.0
lib=/lib64/libX11.so.6
lib=/lib64/libXxf86vm.so.1
lib=/lib64/libSM.so.6
lib=/lib64/libpng16.so.16
lib=/lib64/libjpeg.so.62
lib=/lib64/libtiff.so.5
lib=/lib64/libz.so.1
lib=/lib64/libgmodule-2.0.so.0
lib=/lib64/libXi.so.6
lib=/lib64/libXfixes.so.3
lib=/lib64/libcairo-gobject.so.2
lib=/lib64/libatk-1.0.so.0
lib=/lib64/libatk-bridge-2.0.so.0
lib=/lib64/libwayland-client.so.0
lib=/lib64/libepoxy.so.0
lib=/lib64/libfribidi.so.0
lib=/lib64/libgio-2.0.so.0
lib=/lib64/libpangoft2-1.0.so.0
lib=/lib64/libharfbuzz.so.0
lib=/lib64/libfontconfig.so.1
lib=/lib64/libfreetype.so.6
lib=/lib64/libXinerama.so.1
lib=/lib64/libXrandr.so.2
lib=/lib64/libXcursor.so.1
lib=/lib64/libXcomposite.so.1
lib=/lib64/libXdamage.so.1
lib=/lib64/libxkbcommon.so.0
lib=/lib64/libwayland-cursor.so.0
lib=/lib64/libwayland-egl.so.1
lib=/lib64/libXext.so.6
lib=/lib64/librt.so.1
lib=/lib64/libthai.so.0
lib=/lib64/libpixman-1.so.0
  TLS            0x08ba40 0x000000000009ba40 0x000000000009ba40 0x000000 0x000180 R   0x8
lib=/lib64/libxcb-shm.so.0
lib=/lib64/libxcb.so.1
lib=/lib64/libxcb-render.so.0
lib=/lib64/libXrender.so.1
lib=/lib64/libffi.so.6
lib=/lib64/libpcre.so.1
lib=/lib64/libICE.so.6
lib=/lib64/libuuid.so.1
  TLS            0x00fb10 0x000000000001fb10 0x000000000001fb10 0x000004 0x00004a R   0x8
lib=/lib64/libjbig.so.2.1
lib=/lib64/libdbus-1.so.3
lib=/lib64/libatspi.so.0
lib=/lib64/libmount.so.1
  TLS            0x08d888 0x000000000009d888 0x000000000009d888 0x000000 0x000006 R   0x2
lib=/lib64/libselinux.so.1
  TLS            0x03f500 0x000000000004f500 0x000000000004f500 0x000028 0x0000e8 R   0x8
lib=/lib64/libresolv.so.2
lib=/lib64/libgraphite2.so.3
lib=/lib64/libexpat.so.1
lib=/lib64/libbz2.so.1
lib=/lib64/libdatrie.so.1
lib=/lib64/libXau.so.6
lib=/lib64/libsystemd.so.0
  TLS            0x0dcf08 0x00000000000ecf08 0x00000000000ecf08 0x000004 0x000090 R   0x8
lib=/lib64/libblkid.so.1
  TLS            0x06b6a0 0x000000000007b6a0 0x000000000007b6a0 0x000000 0x000006 R   0x2
lib=/lib64/libpcre2-8.so.0
lib=/lib64/liblzma.so.5
lib=/lib64/liblz4.so.1
lib=/lib64/libgcrypt.so.20
lib=/lib64/libgpg-error.so.0
lib=/lib64/libopenblasp.so.0
  TLS            0xd62668 0x0000000000d72668 0x0000000000d72668 0x000000 0x00f000 R   0x8
lib=/lib64/libgfortran.so.5
  TLS            0x1ef3b0 0x00000000001ff3b0 0x00000000001ff3b0 0x000000 0x000008 R   0x8
lib=/lib64/libquadmath.so.0
lib=/lib64/libcrypto.so.1.1
lib=/lib64/libssl.so.1.1
lib=/lib64/libopenjp2.so.7
lib=/lib64/libimagequant.so.0
lib=/lib64/libgomp.so.1
  TLS            0x04fc90 0x000000000005fc90 0x000000000005fc90 0x000000 0x000078 R   0x8


Note You need to log in before you can comment on or make changes to this bug.