ImportError libstdc++.so.6 cannot allocate memory after importing PyQt5.Qt PyQt5.QtCore and cv2

Bug #1890170 reported by White_Rabbit
This bug report is a duplicate of:  Bug #1889851: Driver QMysql can't be loaded. Edit Remove
266
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mysql-8.0 (Ubuntu)
Confirmed
Undecided
Unassigned
opencv (Ubuntu)
Confirmed
Undecided
Unassigned
pyqt5 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I'm using an updated Lubuntu focal. Starting maybe last week (monday July 27th), if in python3 I do
from PyQt5 import Qt, QtCore
import cv2

I get
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: cannot allocate memory in static TLS block

I noticed only now that the reverse (first import cv2, then Qt, QtCore) seems to work correctly and displays no errors. I'm afraid I might not be able to do the reverse in my real software...

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: python3 3.8.2-0ubuntu2
ProcVersionSignature: Ubuntu 5.4.0-42.46-generic 5.4.44
Uname: Linux 5.4.0-42-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.4
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: LXQt
Date: Mon Aug 3 17:49:20 2020
InstallationDate: Installed on 2020-07-15 (19 days ago)
InstallationMedia: Lubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
SourcePackage: python3-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
White_Rabbit (radiocane) wrote :
affects: python3-defaults (Ubuntu) → opencv (Ubuntu)
Revision history for this message
Kai Kasurinen (kai-kasurinen) wrote :

downgrading libmysqlclient21:amd64 from 8.0.21-0ubuntu0.20.04.3 to 8.0.19-0ubuntu5 fixes issue

Revision history for this message
David Cousens (davidcousens-u) wrote :

Same downgrad also fixed a build of GnuCash 4.1 on 20.04 throwing the same error

Revision history for this message
White_Rabbit (radiocane) wrote :

Indeed, downgrading libmysqlclient21 is an effective workaround. Thanks :)

tags: added: regression-update
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-8.0 (Ubuntu):
status: New → Confirmed
Changed in opencv (Ubuntu):
status: New → Confirmed
Changed in pyqt5 (Ubuntu):
status: New → Confirmed
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

I think this is related:

$ readelf --dynamic libmysqlclient.so.21.1.19 | grep BIND
 0x000000000000001e (FLAGS) BIND_NOW

$ readelf --dynamic libmysqlclient.so.21.1.21 | grep BIND
 0x000000000000001e (FLAGS) BIND_NOW STATIC_TLS

information type: Public → Public Security
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

I'm pretty sure this is a dupe of #1889851. Marking as such.

Revision history for this message
Egej Vencelj (even-gits) wrote :

I have the same issue while running python-qgis. I don't know how (or IF) it is related, but here's the log never the less:

even@even-ThinkPad-P53:~$ qgis --version
QGIS 3.14.1-Pi 'Pi' (de08d6b71d)
even@even-ThinkPad-P53:~$ python3 --version
Python 3.8.2
even@even-ThinkPad-P53:~$ python3
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import qgis
>>> from qgis import core
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/qgis/core/__init__.py", line 25, in <module>
    from qgis._core import *
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: cannot allocate memory in static TLS block
>>>

Revision history for this message
Rouzaud Denis (denis-rouzaud) wrote :

from this answer https://stackoverflow.com/a/62520135/1548052, this "solved" the issue for me:
LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6 python3 …

To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.