TSAN cannot allocate memory in static TLS block

212 views
Skip to first unread message

Jie Zhang

unread,
Jan 28, 2023, 4:13:51 AM1/28/23
to thread-sanitizer
Hi all,

When java app links a c/c++ so that is compiled with TSAN option, it gives error:  java.lang.UnsatisfiedLinkError: /usr/lib64/libtsan.so.0: cannot allocate memory in static TLS block. 

I tried following steps:
1.runs the app with glibc 2.34
2.compile the so with -pthread
3.increase java thread size
4.preload tsan(not working while asan works fine)

They all failed to solve the problem. The java app runs fine when links a c/c++ so that is compiled with asan and asan library preloaded.

Thanks,
Jie

Dmitry Vyukov

unread,
Jan 30, 2023, 3:55:12 AM1/30/23
to Jie Zhang, thread-sanitizer
Hi Jie,

Tsan has a very large TLS size, which is marked initial-exec for
performance reasons. So this is semi-intentional.
Ideally tsan is linked into the main executable (Java launcher in this
case). Though, tsan may need tighter integration with the launcher
since they generally do strange things as well (e.g. with signals). So
I am not sure if it will work with a stock Java launcher.

Jie Zhang

unread,
Feb 20, 2023, 6:22:38 AM2/20/23
to thread-sanitizer

Hi,
I tried preload tsan again, and it worked. Currently there is no more TLS error, and all c/c++ so are loaded by the java application. But the java application still keeps failing, and we got a weired report in TSAN report. 20230220-153357(WeLinkPC).png Any idea on how to fix this?

Thanks!
Reply all
Reply to author
Forward
0 new messages