RFR: 8264752: JFR crash when only specify threadbuffersize=30M [v2]
Hui Shi
hshi at openjdk.java.net
Wed Apr 7 08:31:57 UTC 2021
> 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
Hui Shi has updated the pull request incrementally with one additional commit since the last revision:
use same method to compute memory_size with global_buffer_size
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/3355/files
- new: https://git.openjdk.java.net/jdk/pull/3355/files/8c56a1a4..0c03b4fb
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3355&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3355&range=00-01
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/3355.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3355/head:pull/3355
PR: https://git.openjdk.java.net/jdk/pull/3355
More information about the hotspot-jfr-dev
mailing list