RFR: 8264752: SIGFPE crash with option FlightRecorderOptions:threadbuffersize=30M

Hui Shi hshi at openjdk.java.net
Sat Apr 17 04:58:33 UTC 2021


On Fri, 16 Apr 2021 14:35:42 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

>> …ize=30M
>> 
>> Fix misc explicit JFR memory option caused crash and assertion (https://bugs.openjdk.java.net/browse/JDK-8241773).
>> 
>> 1. Fix SIGFPE crash in div_total_by_per_unit.
>>    a) In valid_memory_relations, check threadbuffersize should not larger than memorysize.
>>    b) In "void thread_buffer_size(JfrMemoryOptions* options)", calculate memorysize if it isn't configured, avoid SIGFPE when thread buffer size is larger than default memorysize.
>>    
>> 2. Fix "assert(free_size() == size, "invariant");" in JfrBuffer::initialize.
>>    Limit globalbuffersize and threadbuffersize under 2G, avoid size_t to u4 coversion lost.
>>    
>> 3. Check and report possible inconsistent conditions after jfr memory size adjustment.
>>    a) globalbuffercount < MIN_BUFFER_COUNT
>>    b) globalbuffersize < threadbuffersize
>
> I did see this test fail when running on linux-aarch64:
> 
> [2021-04-16T12:55:44,162Z] java.lang.RuntimeException: 'Decrease globalbuffersize or increase memorysize or adjust global/threadbuffersize' missing from stdout/stderr 
> [2021-04-16T12:55:44,163Z] 
> [2021-04-16T12:55:44,163Z] 	at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:206)
> [2021-04-16T12:55:44,163Z] 	at jdk.jfr.startupargs.TestBadOptionValues.test(TestBadOptionValues.java:56)
> [2021-04-16T12:55:44,163Z] 	at jdk.jfr.startupargs.TestBadOptionValues.main(TestBadOptionValues.java:139)
> [2021-04-16T12:55:44,163Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [2021-04-16T12:55:44,163Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
> [2021-04-16T12:55:44,163Z] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [2021-04-16T12:55:44,164Z] 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
> [2021-04-16T12:55:44,164Z] 	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
> [2021-04-16T12:55:44,164Z] 	at java.base/java.lang.Thread.run(Thread.java:831)
> [2021-04-16T12:55:44,164Z] 
> [2021-04-16T12:55:44,164Z] JavaTest Message: Test threw exception: java.lang.RuntimeException
> [2021-04-16T12:55:44,165Z] JavaTest Message: shutting down test

@mgronlun Thanks for your reivew and test!

Is default page size larger than 4k in your aarch64 enivronment? I found an aarch64 mchine default page size 64k.
In this case both local/global buffer size is aligned to 64K page size and not fail. 
Fix is checking vm page size isn't larger than 4K before running test "memorysize=1m,numglobalbuffers=256".

Testing on both linux aarch64/x64 pass now.

./build/linux-aarch64-server-release/jdk/bin/java -XX:StartFlightRecording -XX:FlightRecorderOptions:memorysize=1m,numglobalbuffers=256 -Xlog:arguments=trace -version
[0.157s][trace][arguments] Memory size (original) 1048576 B (user defined: true)
[0.157s][trace][arguments] Memory size (adjusted) 1048576 B (modified: false)
[0.157s][trace][arguments] Memory size (adjustment) +0 B
[0.157s][trace][arguments] Global buffer size (original) 524288 B (user defined: false)
[0.157s][trace][arguments] Global buffer size (adjusted) 65536 B (modified: true)
[0.157s][trace][arguments] Global buffer size (adjustment) -458752 B
[0.157s][trace][arguments] Thread local buffer size (original) 8192 B (user defined: false)
[0.157s][trace][arguments] Thread local buffer size (adjusted) 65536 B (modified: true)
[0.157s][trace][arguments] Thread local buffer size (adjustment) +57344 B
[0.157s][trace][arguments] Number of global buffers (original) 256 (user defined: true)
[0.157s][trace][arguments] Number of global buffers (adjusted) 16 (modified: true)
[0.157s][trace][arguments] Number of global buffers (adjustment) -240
Started recording 1. No limit specified, using maxsize=250MB as default.

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

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


More information about the hotspot-jfr-dev mailing list