diff --git a/doc/FAQ.rst b/doc/FAQ.rst index 14c8f72c..161db130 100644 --- a/doc/FAQ.rst +++ b/doc/FAQ.rst @@ -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 +`_ and `#40503 +`_. + +Preload the library named in the error before Python starts, as in +`Apache Airflow #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!) ---------------------------------------- @@ -133,4 +160,3 @@ Other Resources * Read `PEP-249`_ .. _`PEP-249`: https://www.python.org/dev/peps/pep-0249/ -