RFR: 8259067: bootclasspath append takes out object lock

Coleen Phillimore coleenp at openjdk.java.net
Mon Jan 4 19:01:56 UTC 2021


On Mon, 4 Jan 2021 18:45:54 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> See CR for details.
>> I made the classpath append list lock-free.  Calling experts in Atomic operations...
>> Tested with tier1-6.
>> Thanks,
>> Coleen
>
> src/hotspot/share/classfile/classLoader.cpp line 843:
> 
>> 841:           assert(first_append_entry() == NULL, "boot loader's append class path entry list not empty");
>> 842:           Atomic::store(&_first_append_entry_list, new_entry);
>> 843:           return;
> 
> Not sure if it is a problem. There is a chance that an entry is added, e.g. _last_append_entry = new_entry, but _first_append_entry_list == NULL. If contains_append_entry() queries on this new entry, it may return false.

That race also exists in the current code, since contains_append_entry() never acquired the same lock.  Even if it did, there's a race when one thread adds an entry and the other reads the list.

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

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


More information about the serviceability-dev mailing list