RFR: 8264752: JFR crash when only specify threadbuffersize=30M

Hui Shi hshi at openjdk.java.net
Mon Apr 12 03:23:19 UTC 2021


On Tue, 6 Apr 2021 13:30:13 GMT, Hui Shi <hshi at openjdk.org> wrote:

> SIGFPE crash happens in release build with following JFR crash options. Because div_total_by_per_unit try to divide smaller memorysize with larger threadbuffersize. 
> div_total_by_per_unit
>   const julong units = total_pages / per_unit_pages;    // units is zero
>   const julong rem = total_pages % per_unit_pages;
> 
>   assert(units > 0, "invariant");
> 
>   if (rem > 0) {
>     total_pages -= rem % units;
>     per_unit_pages += rem / units;     // SIGFPE happen
>   }
> 
> -XX:StartFlightRecording -XX:FlightRecorderOptions:threadbuffersize=30M
> -XX:StartFlightRecording -XX:FlightRecorderOptions:threadbuffersize=30M,memorysize=10M
> 
> Fix includes
> 1. if threadbuffersize is larger than memorysize, fail with message
> [0.019s][error][arguments] Value specified for option "memorysize" is 10M
> [0.019s][error][arguments] Value specified for option "threadbuffersize" is 30M
> [0.019s][error][arguments] The value for option "threadbuffersize" should not be larger than the value specified for option "memorysize
> 2. In "thread_buffer_size(JfrMemoryOptions* options)", If memor_size is not configured, calculate new memory_size according to buffer_size and buffer_count. Avoid possible SIGFPE in div_total_by_per_unit.
> 
> 
> There are other assertions in debug build with JFR options, leave them in other bug fix (https://bugs.openjdk.java.net/browse/JDK-8241773) 
> 1. -XX:FlightRecorderOptions:threadbuffersize=6M,memorysize=10M    assert(options.buffer_count >= MIN_BUFFER_COUNT) failed: invariant 
> 2. -XX:FlightRecorderOptions:globalbuffersize=4G   assert(free_size() == size) failed: invariant  
> 3. -XX:FlightRecorderOptions:threadbuffersize=4G    assert(free_size() == size) failed: invariant

Will fix with https://bugs.openjdk.java.net/browse/JDK-8241773

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

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


More information about the hotspot-jfr-dev mailing list