RFR: 8261921: ClassListParser::current should be used only by main thread
Coleen Phillimore
coleenp at openjdk.java.net
Fri Feb 19 02:41:41 UTC 2021
On Thu, 18 Feb 2021 05:35:29 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> During -Xshare:dump, ClassListParser::current() should be used only by the main thread, which has created the only ClassListParser instance. Accessing it from other threads could cause intermittent failures. We observed this only on certain hosts with -Xcomp.
>>
>> The fix is to check for `ClassListParser::is_parsing_thread()` before calling `ClassListParser::current()`. After the fix, I can no longer reproduce the crash.
>>
>> I also did some renaming and comment cleaning.
>
> src/hotspot/share/classfile/classListParser.hpp line 86:
>
>> 84: };
>> 85:
>> 86: static Thread* _parsing_thread; // the thread that created _instance
>
> I forget whether we still want to use `volatile` here or not.
_parsing_thread and _instance are read by another thread so that's why they have Atomic::load and store. This should be volatile if they need that level of memory ordering.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2619
More information about the hotspot-runtime-dev
mailing list