RFR: 8336911: ZGC: Division by zero in heuristics after JDK-8332717 [v2]

Matthias Baesken mbaesken at openjdk.org
Wed Oct 16 13:40:23 UTC 2024


On Wed, 9 Oct 2024 13:29:12 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> When running with ubsan enabled binaries, the following issue is reported,
>> e.g. in test
>> compiler/uncommontrap/TestDeoptOOM_ZGenerational.jtr
>> also in gc/z/TestSmallHeap.jtr
>> 
>> 
>> jdk/src/hotspot/share/gc/z/zDirector.cpp:537:84: runtime error: division by zero
>>     #0 0x7f422495bd1f in calculate_young_to_old_worker_ratio src/hotspot/share/gc/z/zDirector.cpp:537
>>     #1 0x7f422495bd1f in select_worker_threads src/hotspot/share/gc/z/zDirector.cpp:694
>>     #2 0x7f42282a0d97 in select_worker_threads src/hotspot/share/gc/z/zDirector.cpp:689
>>     #3 0x7f42282a0d97 in initial_workers src/hotspot/share/gc/z/zDirector.cpp:784
>>     #4 0x7f42282a2485 in initial_workers src/hotspot/share/gc/z/zDirector.cpp:795
>>     #5 0x7f42282a2485 in start_minor_gc src/hotspot/share/gc/z/zDirector.cpp:797
>>     #6 0x7f42282a2485 in start_gc src/hotspot/share/gc/z/zDirector.cpp:826
>>     #7 0x7f42282a2485 in ZDirector::run_thread() src/hotspot/share/gc/z/zDirector.cpp:912
>>     #8 0x7f422840bdd8 in ZThread::run_service() src/hotspot/share/gc/z/zThread.cpp:29
>>     #9 0x7f4225ab6979 in ConcurrentGCThread::run() src/hotspot/share/gc/shared/concurrentGCThread.cpp:48
>>     #10 0x7f4227e1137a in Thread::call_run() src/hotspot/share/runtime/thread.cpp:225
>>     #11 0x7f42274619b1 in thread_native_entry src/hotspot/os/linux/os_linux.cpp:858
>>     #12 0x7f422c8d36e9 in start_thread (/lib64/libpthread.so.0+0xa6e9) (BuildId: 9a146bd267419cb6a8cf08d7c602953a0f2e12c5)
>>     #13 0x7f422c1dc58e in clone (/lib64/libc.so.6+0x11858e) (BuildId: f2d1cb1ef49f8c47d43a4053910ba6137673ccce)
>> 
>> 
>> The division by 0 leads to  'infinity'  on most of our platforms. So instead of relying on this behavior, we can add a small check and  set 'infinity'  for divisor == 0.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   adjustment from xmas - Update src/hotspot/share/gc/z/zDirector.cpp
>   
>   Co-authored-by: Axel Boldt-Christmas <xmas1915 at gmail.com>

Thanks for the reviews !

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

PR Comment: https://git.openjdk.org/jdk/pull/21304#issuecomment-2416861985


More information about the hotspot-gc-dev mailing list