RFR: Finalizer support
Man Cao
manc at google.com
Tue Sep 10 01:34:15 UTC 2019
> For checking whether TSAN is enabled, is it possible to use the following
directly? Then we don't need to change jvm.h/cpp and symbols-unix.
>
ManagementFactory.getRuntimeMXBean().getInputArguments().contains("-XX:+ThreadSanitizer");
I take it back.
It is a bad practice to depend on string matching here. And it would
incorrectly return true for "java -XX:+ThreadSanitizer -XX:-ThreadSanitizer
Foo".
-Man
On Mon, Sep 9, 2019 at 6:03 PM Man Cao <manc at google.com> wrote:
> Apology for the delay.
>
> I don't see how the TSAN code is guarded by the build-time option. Does it
> work with "--with-jvm-features=-tsan".
>
> For checking whether TSAN is enabled, is it possible to use the following
> directly? Then we don't need to change jvm.h/cpp and symbols-unix.
>
> ManagementFactory.getRuntimeMXBean().getInputArguments().contains("-XX:+ThreadSanitizer");
>
> In Finalizer.java
> private static boolean TSAN_ENABLED = isTsanEnabled();
> It is better to mark TSAN_ENABLED field as "final".
>
> if (TSAN_ENABLED) {
> tsanFinalize();
> }
> I think we can keep the TODO for this code, that it could be moved to
> when a batch of finalizers was queued.
>
> In Finalizer.c, should it add this line?
> #include "java_lang_ref_Finalizer.h"
> I see other files in the directory have includes for corresponding .h
> files.
>
> In NonRacyFinalizerLoopTest.java:
> * @build AbstractLoop TsanRunner
>
> public static void main(String[] args) throws InterruptedException {
>
> We can remove "AbstractLoop" and "throws InterruptedException", right?
>
>
> -Man
>
>
> On Mon, Sep 9, 2019 at 3:27 PM Jean Christophe Beyler <jcbeyler at google.com>
> wrote:
>
>> Took me a while to get to this, my apologies Arthur :)
>>
>> I looks good to me!
>> Jc
>>
>> On Tue, Sep 3, 2019 at 2:45 PM Arthur Eubanks <aeubanks at google.com>
>> wrote:
>>
>> > webrev: http://cr.openjdk.java.net/~aeubanks/tsanfinalizer/webrev.00/
>> >
>> > This patch makes the finalizer thread call __tsan_java_finalize(),
>> > preventing reports of false positives in finalizers.
>> >
>>
>>
>> --
>>
>> Thanks,
>> Jc
>>
>
More information about the tsan-dev
mailing list