Adding System.out.printlns causes tsan to miss a race?
Jiri Daněk
jdanek at redhat.com
Sun Jul 21 10:56:25 UTC 2019
On Sun, Jul 21, 2019 at 10:35 AM Jiri Daněk <jdanek at redhat.com> wrote:
> I compiled jdk-tsan with gcc9, because I had issues compiling with clang_8
> on nixOS. Does that make the test above invalid? I presume I could use
> ubuntu in docker, if asked.
>
Managed to compile with clang_8. With the VERBOSE=true, I get the sanitizer
warning in what feels about 1 in 10 runs. I don't have the gcc9 build any
more to compare, there I never saw warning with VERBOSE=true, but I did not
run it many times and I did not try running in a loop.
One of the lucky runs looks like this
$ build/linux-x86_64-server-release/jdk/bin/java -XX:+ThreadSanitizer
-classpath /home/jdanek/repos/java-sanitizer/out/production/java-sanitizer/
Main
Hello World!
pes
pes
pes
pes
pes
7
pes
==================
WARNING: ThreadSanitizer: data race (pid=22615)
Read of size 4 at 0x00066390da34 by thread T14:
#0 Main.lambda$main$0(LMain$1;)V Main.java:13
#1 Main$$Lambda$36.run()V ??
#2 java.lang.Thread.run()V Thread.java:835
#3 (Generated Stub) <null>
Previous write of size 4 at 0x00066390da34 by thread T1:
#0 Main.main([Ljava/lang/String;)V Main.java:22
#1 (Generated Stub) <null>
Thread T14 (tid=22631, running) created by thread T1 at:
#0 pthread_create ??:? (java+0x42c5d6)
#1 os::create_thread(Thread*, os::ThreadType, unsigned long)
/home/jdanek/repos/jdk-tsan/src/hotspot/os/linux/os_linux.cpp:774
(libjvm.so+0xb2683d)
#2 java.lang.Thread.start()V Thread.java:804
#3 Main.main([Ljava/lang/String;)V Main.java:19
#4 (Generated Stub) <null>
Thread T1 (tid=22617, running) created by main thread at:
#0 pthread_create ??:? (java+0x42c5d6)
#1 CallJavaMainInNewThread
/home/jdanek/repos/jdk-tsan/src/java.base/unix/native/libjli/java_md_solinux.c:769
(libjli.so+0x9cba)
SUMMARY: ThreadSanitizer: data race Main.java:13 in
Main.lambda$main$0(LMain$1;)V
==================
7
pes
pes
ThreadSanitizer: reported 1 warnings
ThreadSanitizer: reported 1 warnings
--
Mit freundlichen Grüßen / Kind regards
Jiri Daněk
More information about the tsan-dev
mailing list