JDK-8214685 : Passing illegal value for JFR startupargs causes SEGV or errors
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jfr
  • Affected Version: 12,13,14,15,16,17
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_ubuntu,windows
  • CPU: x86_64
  • Submitted: 2018-12-02
  • Updated: 2025-01-20
  • Resolved: 2025-01-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20Resolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Sub Tasks
JDK-8259722 :  
JDK-8338062 :  
Description
At least 2 JFR tests fail with the same root cause: when passing illegal/unacceptable value for JFR startup arguments, the expected behavior is to exit with code -1. Instead, the JVM crashes with Segmentation Fault, and odd looking stack (possible stack corruption?)

Tests that fail:
    jdk/jfr/startupargs/TestStartName.java  (passing a numeric value for the 'name' parameter)
    jdk/jfr/startupargs/TestMemoryOptions.java (passing illegal value for memory buffer size, e.g. under the minimum acceptable value)
    jdk/jfr/startupargs/TestStartDuration.java
    


The following test failed due to an exception on Linux X64
in the fastdebug config using jdk-12+22 bits:

jdk/jfr/startupargs/TestStartName.java

The test only failed in 1 of 3 'fastdebug' bits runs so I'm
tagging this bug as intermittent. It did not fail at all in the
'release' or 'slowdebug' bits runs.

============== Initial analysis
 The test intentionally sets the numeric value for the JFR recording name (numeric values are not acceptable), and expects the JVM to fail with exit 1.
However, JVM crashes with Segmentation fault (exit code 139 commonly used for segmentation fault). The attached zip files contain hs_err files. Based on these files, the stack pointer is random and strange value (in one case it is 0x0000000000000065, other cases somewhere in libc). Possible stack corruption? 
==============

Here is a snippet from the log file: 

----------System.err:(24/1177)----------
 stdout: [Name of recording can't be numeric
Error occurred during initialization of VM
Failure when starting JFR on_vm_start
];
 stderr: []
 exitValue = 139

java.lang.RuntimeException: Expected to get exit value of [1]

        at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:419)
        at jdk.jfr.startupargs.TestStartName.testName(TestStartName.java:57)
        at jdk.jfr.startupargs.TestStartName.main(TestStartName.java:68)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:835)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Expected to get exit value of [1]

JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Expected to get exit value of [1]
----------rerun:(33/4073)*----------

The test case is expected to fail with an exit code of "1", but instead failed
with an exit code of "139". That exit code make me wonder if the test crashed,
but the test run directories have been already cleaned up. (This is run #1 of 3.)
Comments
The parsing of startup parameters was rewritten in Java in June 2021 (JDK 17) as part of JDK-8265271. The JVM now passes a String to Java, so it's hard to see how it can crash because some characters in the String are different. The return value for -XX:StartFlightRecording:help is perhaps 100 times larger than anything these tests return so an overflow also seems unlikely. I'm leaning toward removing the tests from ProblemList.txt, if I can run them 1000 without any failure. The jcmd with exit value -1073741819 described in this bug seems to be a different issue than "Error occurred during initialization of VM. Failure when starting JFR on_vm_start"
06-08-2024

I see similar(as described above) failures of TestStartDuration regularly in jdk21. the issue is intermittent once per 20 runs or so.
13-09-2023

Here's a snippet from the log file for the jdk-17+3-118-tier5 sighting: jdk/jfr/startupargs/TestStartDuration.java ----------System.err:(23/1140)---------- stdout: [Started recording 1. Use jcmd 1948 JFR.stop name=TestStartDuration filename=FILEPATH to copy recording data to file. Recording=TestStartDuration ]; stderr: [] exitValue = -1073741819 java.lang.RuntimeException: Expected to get exit value of [0] at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:474) at jdk.jfr.startupargs.TestStartDuration.testDurationInRange(TestStartDuration.java:63) at jdk.jfr.startupargs.TestStartDuration.main(TestStartDuration.java:89) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298) at java.base/java.lang.Thread.run(Thread.java:831) JavaTest Message: Test threw exception: java.lang.RuntimeException JavaTest Message: shutting down test result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Expected to get exit value of [0]
23-12-2020

Here are the logs for my jdk-15+33 Linux-X64 sightings: $ unzip -l jdk-15+33_linux.8214685.zip Archive: jdk-15+33_linux.8214685.zip Length Date Time Name --------- ---------- ----- ---- 22751 2020-07-23 19:23 jdk-15+33_1/failures.linux-x86_64/TestStartName.jtr.slowdebug 112226 2020-07-23 19:23 jdk-15+33_1/failures.linux-x86_64/hs_err_pid24531.log --------- ------- 134977 2 files
04-08-2020

Here are the logs for my jdk-15+19 Linux-X64 sightings: $ unzip -l jdk-15+19_linux.8214685.zip Archive: jdk-15+19_linux.8214685.zip Length Date Time Name --------- ---------- ----- ---- 25719 2020-04-17 16:49 jdk-15+19_2/failures.linux-x86_64/TestStartName.jtr.slowdebug 112348 2020-04-17 16:49 jdk-15+19_2/failures.linux-x86_64/hs_err_pid13651.log --------- ------- 138067 2 files
03-05-2020

Here are the logs for my jdk-15+14 Linux-X64 sightings: $ unzip -l jdk-15+14_linux.8214685.zip Archive: jdk-15+14_linux.8214685.zip Length Date Time Name --------- ---------- ----- ---- 111886 2020-03-13 16:52 jdk-15+14_2/failures.linux-x86_64/hs_err_pid5396.log 21613 2020-03-13 16:52 jdk-15+14_2/failures.linux-x86_64/TestStartName.jtr.slowdebug --------- ------- 133499 2 files
15-03-2020

Here are the logs for my jdk-14+19 Linux-X64 sightings: $ unzip -l jdk-14+19_linux.8214685.zip Archive: jdk-14+19_linux.8214685.zip Length Date Time Name --------- ---------- ----- ---- 21510 2019-10-19 09:58 jdk-14+19_1/failures.linux-x86_64/TestStartName.jtr.fastdebug 110856 2019-10-19 09:58 jdk-14+19_1/failures.linux-x86_64/hs_err_pid8616.log --------- ------- 132366 2 files
22-10-2019

A product bug, not a test bug. ILW = HLL = P4 I: Crash -> High L: highly intermittent -> Low W: L (do not set the recording name to a numeric value, which is not acceptable)
23-08-2019

Stack info from the hs_err files: ================= hs_err_pid24712.log --------------- T H R E A D --------------- Current thread (0x00002b5ac401e800): JavaThread "main" [_thread_in_native, id=24716, stack(0x00002b5abd49a000,0x00002b5abd59b000)] Stack: [0x00002b5abd49a000,0x00002b5abd59b000], sp=0x00002b5abd599a58, free space=1022k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) C 0x0000000000000065 siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000065 ================= hs_err_pid17662.log Current thread (0x00002ac1dc023800): JavaThread "main" [_thread_in_native, id=17665, stack(0x00002ac1d5bc8000,0x00002ac1d5cc9000)] Stack: [0x00002ac1d5bc8000,0x00002ac1d5cc9000], sp=0x00002ac1d5cc7a50, free space=1022k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) C [libc.so.6+0x7c3f4] siginfo: si_signo: 11 (SIGSEGV), si_code: 128 (SI_KERNEL), si_addr: 0x0000000000000000 ================= hs_err_pid5555.log Current thread (0x00002acc84019000): JavaThread "main" [_thread_in_native, id=5558, stack(0x00002acc7fde8000,0x00002acc7fee9000)] Stack: [0x00002acc7fde8000,0x00002acc7fee9000], sp=0x00002acc7fee7bb0, free space=1022k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) C [libc.so.6+0x7c3f4] siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x00002acc00000009
23-08-2019

My initial analysis shows the following: The test intentionally sets the numeric value for the JFR recording name (numeric values are not acceptable), and expects the JVM to fail with exit 1. However, JVM crashes with Segmentation fault (exit code 139 commonly used for segmentation fault). The attached zip files contain hs_err files. Based on these files, the stack pointer is random and strange value (in one case it is 0x0000000000000065, other cases somewhere in libc). Possible stack corruption?
23-08-2019

Also similar failures with jdk/jfr/startupargs/TestStartDuration.java but I don't have failure output available right now.
09-08-2019

We are seeing similar failures with JDK 11 and Graal: stdout: [Name of recording can't be numeric Error occurred during initialization of VM Failure when starting JFR on_vm_start ]; stderr: [OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. pure virtual method called terminate called without an active exception ] exitValue = 134 java.lang.RuntimeException: Expected to get exit value of [1] at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:396) at jdk.jfr.startupargs.TestStartName.testName(TestStartName.java:57) at jdk.jfr.startupargs.TestStartName.main(TestStartName.java:70) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.sun.javatest.regtest.agent.MainActionHelper$SameVMRunnable.run(MainActionHelper.java:229) at java.base/java.lang.Thread.run(Thread.java:834)
09-08-2019

Here are the logs for my jdk-14+8 sighting: $ unzip -l jdk-14+8_linux.8214685.zip Archive: jdk-14+8_linux.8214685.zip Length Date Time Name --------- ---------- ----- ---- 23011 2019-08-02 12:48 jdk-14+8_1/failures.linux-x86_64/TestStartName.jtr.release 108910 2019-08-02 12:48 jdk-14+8_1/failures.linux-x86_64/hs_err_pid5555.log --------- ------- 131921 2 files
05-08-2019

Here are the logs for my jdk-13+30 Linux-X64 sightings: $ unzip -l jdk-13+30_linux.8214685.zip Archive: jdk-13+30_linux.8214685.zip Length Date Time Name --------- ---------- ----- ---- 111293 07-18-2019 17:59 jdk-13+30_1/failures.linux-x86_64/hs_err_pid17662.log 21875 07-18-2019 17:59 jdk-13+30_1/failures.linux-x86_64/TestStartName.jtr.slowdebug --------- ------- 133168 2 files
21-07-2019

Here are the logs for my jdk-13+12 Linux-X64 sightings: $ unzip -l jdk-13+12_linux.8214685.zip Archive: jdk-13+12_linux.8214685.zip Length Date Time Name --------- ---------- ----- ---- 109087 2019-03-14 16:15 jdk-13+12_1/failures.linux-x86_64/hs_err_pid24712.log 20558 2019-03-14 16:15 jdk-13+12_1/failures.linux-x86_64/TestStartName.jtr.slowdebug --------- ------- 129645 2 files
17-03-2019

This failure is similar to: JDK-8207970 jfr/startupargs/TestMemoryOptions.java fails intermittently on Linux-X64
02-12-2018

Here are the logs for my jdk-12+22 linux sightings: $ unzip -l jdk-12+22_linux.8214685.zip Archive: jdk-12+22_linux.8214685.zip Length Date Time Name --------- ---------- ----- ---- 19045 2018-11-29 21:46 jdk-12+22_1/failures.linux-x86_64/TestStartName.jtr.fastdebug --------- ------- 19045 1 file
02-12-2018