RFR: 8251570: 8215624 causes assert(worker_id <' _n_workers) failed: Invalid worker_id

Stefan Karlsson stefan.karlsson at oracle.com
Fri Aug 14 16:25:44 UTC 2020

Thanks, Kim!


On 2020-08-14 18:00, Kim Barrett wrote:
>> On Aug 14, 2020, at 10:40 AM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
>> Hi all,
>> Please review this patch to fix a newly introduced bug where there can be a mismatch between the number of parallel heap inspection threads and the number of used GC threads
>> https://cr.openjdk.java.net/~stefank/8251570/webrev.01/
>> https://bugs.openjdk.java.net/browse/JDK-8251570
>> The assert triggers because of this code:
>>      ParallelObjectIterator* poi = Universe::heap()->parallel_object_iterator(parallel_thread_num);
>>      if (poi != NULL) {
>>        ParHeapInspectTask task(poi, cit, filter);
>>       Universe::heap()->run_task(&task);
>> G1's parallel_object_iterator sets up a HeapRegionClaimer with parallel_thread_num, while run_task uses active_workers() of the used WorkGang.
>> The original patch also has another, latent bug. Both ZGC and Shenandoah uses the wrong WorkGang in run_task. Currently, non of those GCs provide a parallel_object_iterator, so the code isn't executed ATM.
>> The proposed fix for this is to simplify the code and introduce a concrete function CollectedHeap::run_task_at_safepoint that takes the number of requested workers as a parameter, and dispatches the task through the CollectedHeap::get_safepoint_workers() workers (if provided by the GC).
>> Testing:
>> - Locally with the failing tests and all GCs
>> - tier1-tier5 on Linux
>> Thanks,
>> StefanK
> Looks good.

More information about the hotspot-gc-dev mailing list