RFR: JDK-8255661: TestHeapDumpOnOutOfMemoryError fails with EOFException

Ralf Schmelter rschmelter at openjdk.java.net
Wed May 12 17:55:57 UTC 2021


On Wed, 12 May 2021 15:22:52 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

>> src/hotspot/share/services/heapDumperCompression.cpp line 262:
>> 
>>> 260: }
>>> 261: 
>>> 262: void CompressionBackend::thread_loop() {
>> 
>> You could simplify `CompressionBackend::thread_loop()` further:
>> 
>> 
>> void CompressionBackend::thread_loop() {
>>   {
>>     MonitorLocker ml(_lock, Mutex::_no_safepoint_check_flag);
>>     _nr_of_threads++;
>>   }
>> 
>>   WriteWork* work = get_work();
>>   while (work != NULL) {
>>       do_compress(work);
>>       finish_work(work);
>>       work = get_work();
>>   }
>> 
>>   MonitorLocker ml(_lock, Mutex::_no_safepoint_check_flag);
>>   _nr_of_threads--;
>>   assert(_nr_of_threads >= 0, "Too many threads finished");
>>   ml.notify_all();
>> }
>
> BTW: why is `ml.notify_all()` in line 275 needed at all?

Hi,

thanks for the review Lin and Richard. 

The notify_all() is indeed not needed anymore. It was originally needed when the worker threads were newly created threads and we had to wait for them to finish at the end of the dump operation. But since we now use the GC work gang, this can be removed.

I will update the PR with your suggestions.

Best regards,
Ralf

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

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


More information about the hotspot-runtime-dev mailing list