FS#54711 - [jemalloc] cannot allocate memory in static TLS block
Attached to Project:
Arch Linux
Opened by Kenny MacDermid (kenmacd) - Thursday, 06 July 2017, 00:43 GMT
Last edited by Toolybird (Toolybird) - Wednesday, 20 September 2023, 22:55 GMT
Opened by Kenny MacDermid (kenmacd) - Thursday, 06 July 2017, 00:43 GMT
Last edited by Toolybird (Toolybird) - Wednesday, 20 September 2023, 22:55 GMT
|
Details
Description:
I had to downgrade this package to continue running rocksdb which was being loaded by python-rocksdb. The error I was getting was: from ._rocksdb import * ImportError: /usr/lib/libjemalloc.so.2: cannot allocate memory in static TLS block This appears to be related to this issue: https://github.com/jemalloc/jemalloc/issues/937 Downgrading from jemalloc-5.0.0-2-x86_64 to jemalloc-4.5.0-1-x86_64 fixed this issue. Steps to reproduce: Install rocksdb from AUR pip install python-rocksdb python -c 'import rocksdb' |
This task depends upon
Closed by Toolybird (Toolybird)
Wednesday, 20 September 2023, 22:55 GMT
Reason for closing: Upstream
Additional comments about closing: Old and stale. Fedora/Debian don't use "--disable-initial-exec-tls" nor should we. Apps dlopening jemalloc is an edge case anyway.
Wednesday, 20 September 2023, 22:55 GMT
Reason for closing: Upstream
Additional comments about closing: Old and stale. Fedora/Debian don't use "--disable-initial-exec-tls" nor should we. Apps dlopening jemalloc is an edge case anyway.
Can you report upstream, please?
I suspect this bug will come up with any packages that dynamically load jemalloc.
When loading php, it loaded imagick.so which tried to load libjemalloc.so.2 and give the TLS stack error message.
Downgrading jemalloc is a successful workaround.
I'm a bit confused as to what's happening here. I can't get Python's rocksdb to work:
```
klm@kc ~ ➤ pip install rocksdb
Defaulting to user installation because normal site-packages is not writeable
Collecting rocksdb
Downloading rocksdb-0.7.0.tar.gz (27 kB)
Requirement already satisfied: setuptools>=25 in /usr/lib/python3.10/site-packages (from rocksdb) (59.1.1)
Using legacy 'setup.py install' for rocksdb, since package 'wheel' is not installed.
Installing collected packages: rocksdb
Running setup.py install for rocksdb ... done
Successfully installed rocksdb-0.7.0
klm@kc ~ ➤ python 20s
Python 3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rocksdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/klm/.local/lib/python3.10/site-packages/rocksdb/__init__.py", line 1, in <module>
from ._rocksdb import *
ImportError: /usr/lib/libjemalloc.so.2: cannot allocate memory in static TLS block
>>>
```
I believe this was working before (way before 2017 when this issue was created). Could this commit from September be the cause?
https://github.com/archlinux/svntogit-packages/commit/52d5af7e914fa71f37741398d651013bacf4322a#diff-b9f413d26ce524388c207d66ccbc6e6140d0b33eb7cca912f6b45843c63232f1L23
I think the "disable-initial-exec-tls" configure flag needs to be there, but as the above commit suggests - it isn't:
```
klm@kc ~ ➤ /usr/bin/jemalloc-config --config 134s
--enable-autogen --prefix=/usr CC=clang 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection' LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now CXX=clang++ 'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS'
```
jemalloc 5.2.1-3 does have this flag set:
```
klm@kc ~ ➤ cat /var/cache/pacman/pkg/jemalloc-1:5.2.1-3-x86_64.pkg.tar.zst | zstd -d | grep -a -- --disable-initial-exec-tls
echo "--disable-initial-exec-tls --enable-autogen --prefix=/usr 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt' LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now CPPFLAGS=-D_FORTIFY_SOURCE=2 'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt'"
```