TSAN JDK crashes on startup
Vivek Jain
vivek.jain at databricks.com
Mon Dec 9 06:47:54 UTC 2024
On Tue, Dec 3, 2024 at 1:09 PM Vivek Jain <vivek.jain at databricks.com> wrote:
>
> Hi,
>
> I am interested in running Java with TSAN enabled for my applications. I
> followed the instructions to build and run the tsan fork of JDK, but when
> running the java binary it seems to fail a ThreadSanitizer internal check on
> startup. Here are the full commands I ran to build it, inside a docker
> container to make it more reproducible:
>
> $ docker run -it ubuntu:22.04 /bin/bash
> /# apt update && apt install -y git
> /# git clone --branch tsan https://github.com/openjdk/tsan.git jdk-tsan
> /jdk-tsan# cd jdk-tsan/
> /jdk-tsan# apt install -y autoconf openjdk-21-jdk libx11-dev
> libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev
> libcups2-dev libfontconfig1-dev libasound2-dev file unzip zip
> /jdk-tsan# bash configure --with-debug-level=release
> --disable-warnings-as-errors
> /jdk-tsan# make
> /jdk-tsan# ./build/linux-x86_64-server-release/jdk/bin/java -XX:+ThreadSanitizer
> FATAL: ThreadSanitizer CHECK failed:
> ../../../../src/libsanitizer/tsan/tsan_interface_java.cpp:244
> "((addr)) < ((jctx->heap_begin + jctx->heap_size))" (0x7f78c107f6d0,
> 0x800000000)
> #0 __tsan::TsanCheckFailed(char const*, int, char const*, unsigned
> long long, unsigned long long)
> ../../../../src/libsanitizer/tsan/tsan_rtl_report.cpp:47
> (libtsan.so.0+0xa24a6)
> #1 __sanitizer::CheckFailed(char const*, int, char const*,
> unsigned long long, unsigned long long)
> ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:78
> (libtsan.so.0+0xc240e)
> #2 __tsan_java_acquire
> ../../../../src/libsanitizer/tsan/tsan_interface_java.cpp:244
> (libtsan.so.0+0x8885a)
> #3 Unsafe_GetLongVolatile src/hotspot/share/prims/unsafe.cpp:365
> (libjvm.so+0xfabe45)
> #4 <null> <null> (0x7f78bc05e028)
>
> I did try building with LLVM also and had a similar CHECK failure on startup.
> Please let me know what else I can try.
It seems there are some necessary fixes in later versions of
gcc/libtsan that are required. Just by upgrading to gcc 13, I was able
to make it work.
More information about the tsan-dev
mailing list