RFR: 8276801: gc/stress/CriticalNativeStress.java fails intermittently with Shenandoah [v2]

Zhengyu Gu zgu at openjdk.java.net
Wed Nov 10 02:13:37 UTC 2021


On Tue, 9 Nov 2021 17:50:14 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Good catch! I revert the assertion in ShenandoahCodeRoots::unregister_nmethod().
>> 
>> Above code is racy, because there can be a drive-by safepoint when the test is performed. However, it is not problem, because Shenandoah (so as ZGC) only tags the nmethod is unregistered. 
>> 
>> It is not true for flush_nmethod(), where `CodeCache_lock` must be held.
>
> What about `register_nmethod`? I see it is called from `nmethod::nmethod` that itself does `assert_locked_or_safepoint(CodeCache_lock)`. Is that path guaranteed to always hold the `CodeCache_lock`?

I changed assert in `nmethod::nmethod()` to `assert_lock_strong(CodeCache_lock)` and ran tier1, no failure.

`nmethods` is installed by `CompilerThread` and `CompilerThread` is `JavaThread`, so I don't think it is possible to have `register_nmethod()` call at safepoints, because they have to participate in safepoints.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6316



More information about the hotspot-gc-dev mailing list