error: cannot allocate memory in static TLS block
2017-12-29 16:08
3971 查看
https://sourceware.org/bugzilla/show_bug.cgi?id=14898
https://github.com/dyninst/dyninst/issues/101 https://bugzilla.redhat.com/show_bug.cgi?id=89692
https://github.com/dyninst/dyninst/issues/101 https://bugzilla.redhat.com/show_bug.cgi?id=89692
If shared library declease a single TLS global variable of size 1 (one) byte, and this TLS variable is accessed by the binary linking against it the shared library doesnt get loaded because there is an error creating the static TLS block. The attached test case shows both the failed and expected behavior. Untar the files from the tar ball. To reproduce the bug please compile the shared library as follows: libfoo: gcc -g -Wall -Wextra -fPIC -pthread -shared -DBUG -o libfoo.so foo.c test: gcc -g -Wall -Wextra -DBUG -o test test.c -Wl,-rpath . -L . -lfoo $ ./test ./test: error while loading shared libraries: ./libfoo.so: cannot allocate memory in static TLS block To get the expected behavior recompile the tests as follows libfoo: gcc -g -Wall -Wextra -fPIC -pthread -shared -o libfoo.so foo.c test: gcc -g -Wall -Wextra -o test test.c -Wl,-rpath . -L . -lfoo $ ./test foo: 1 address of foo: 0x7f3d359c56fe The behavior is same if the library is compiled without -pthread. I have tested this bug in my system running Ubuntu precise using eglibc-2.15.
-----------------------------------------------------------------------------------------------------------------------------------------------
Just for reference, the fix was to adjust the internal constant not to be the same value as a small sized static TLS image. A workaround is always to increase the size of the TLS storage.
相关文章推荐
- mxnet-model-server 运行出现 libjemalloc.so.2: cannot allocate memory in static TLS block
- redis Can’t save in background: fork: Cannot allocate memory 解决及原理
- redis 故障处理 "Can't save in background: fork: Cannot allocate memory"
- mount mount error:cannot allocate memory (12) 处理
- kali linux ERROR 12 Cannot allocate memory
- Error using * LAPACK loading error: dlopen: cannot load any more object with static TLS
- redis 写磁盘出错 Can’t save in background: fork: Cannot allocate memory (转)
- Fatal error: cannot allocate memory for the buffer pool
- redis Can’t save in background: fork: Cannot allocate memory
- Ora-27102: Out Of Memory: Linux Error: 12: Cannot Allocate Memory with LOCK_SGA=TRUE[ID 401077.1]
- OpenCV Error: Insufficient memory (Failed to allocate 47752340 bytes) in cv::OutOfMemoryError, file
- Java HotSpot(TM) 64-Bit Server VM warning(error='Cannot allocate memory' (errno=12))
- Ora-27102: Out Of Memory: Linux Error: 12: Cannot Allocate Memory with LOCK_SGA=TRUE[ID 401077.1]
- 执行Runtime.exec异常: error=12,Cannot allocate memory
- kafka 容器报内存不足异常(failed; error='Cannot allocate memory' (errno=12))
- 【数据库】InnoDB: Fatal error: cannot allocate memory for the buffer pool
- Can’t save in background: fork: Cannot allocate memory
- PHP运行错最有效解决办法Fatal error: Out of memory (allocated 786432) (tried to allocate 98304 bytes) in H:\freehost\zhengbao2\web\includes\lib_common.php on line 744
- "Cannot allocate memory" OutofMemory when call Ant to build Polish project in Tomcat
- redis Can’t save in background: fork: Cannot allocate memory