Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion doc/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,33 @@ every major release of GCC changes the ABI in some why, so linking
code compiled with GCC-3.3 and GCC-4.0, for example, can be
problematic.

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

Previously loaded native extensions can consume glibc's static-TLS
surplus. The dynamic loader can then fail to load ``MySQLdb._mysql`` or
one of its dependencies when it needs more static TLS, particularly
with the initial-exec TLS model. The static allocation cannot grow
after process startup, so this can occur even with a correct
mysqlclient build. Examples include `Apache Airflow #17546
<https://github.com/apache/airflow/issues/17546>`_ and `#40503
<https://github.com/apache/airflow/issues/40503>`_.

Preload the library named in the error before Python starts, as in
`Apache Airflow #19010 <https://github.com/apache/airflow/pull/19010>`_.
An exported ``LD_PRELOAD`` is inherited by child processes, including
programs that would not otherwise load that library. Scope it to the
affected service or container; startup and memory costs depend on the
program and platform.

On Debian-based systems with ``dpkg-dev`` installed, use the platform's
multiarch name rather than ``uname -m``:

.. code-block:: sh

export LD_PRELOAD="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/libstdc++.so.6"

On other distributions, use the path from the error. For example,
RHEL/CentOS commonly uses ``/lib64/libstdc++.so.6`` instead.

My data disappeared! (or won't go away!)
----------------------------------------
Expand Down Expand Up @@ -133,4 +160,3 @@ Other Resources
* Read `PEP-249`_

.. _`PEP-249`: https://www.python.org/dev/peps/pep-0249/