JDK-8061616 : HotspotDiagnosticMXBean.getVMOption() throws IllegalArgumentException for flags of type double
  • Type: Bug
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-10-21
  • Updated: 2020-08-17
  • Resolved: 2014-11-03
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 9 Other
9 b40Fixed openjdk8u272Fixed
Related Reports
Duplicate :  
Description
HotspotDiagnosticMXBean.getVMOption() fails looking up VM options of type double. This can be easily reproduced with the following test-patch:


diff -r 3c4254d2df12 test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java
--- a/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java	Fri Oct 17 15:35:25 2014 -0700
+++ b/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java	Tue Oct 21 11:15:58 2014 +0200
@@ -34,7 +34,7 @@
  */
 
 public class DoubleTest {
-    private static final String FLAG_NAME = null;
+    private static final String FLAG_NAME = "CompileThresholdScaling";
     private static final Double[] TESTS = {0d, -0d, -1d, 1d,
             Double.MAX_VALUE, Double.MIN_VALUE, Double.NaN,
             Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY};


The output then looks like this:

java.lang.RuntimeException: Expected null to equal 1.0
   at com.oracle.java.testlibrary.Asserts.error(Asserts.java:450)
   at com.oracle.java.testlibrary.Asserts.assertEquals(Asserts.java:166)
   at com.oracle.java.testlibrary.Asserts.assertEquals(Asserts.java:152)
   at com.oracle.java.testlibrary.Asserts.assertEQ(Asserts.java:133)
   at VmFlagTest.testPositive(VmFlagTest.java:95)
   at VmFlagTest$$Lambda$10/447683165.accept(Unknown Source)
   at VmFlagTest.test(VmFlagTest.java:77)
   at VmFlagTest.runTest(VmFlagTest.java:69)
   at VmFlagTest.runTest(VmFlagTest.java:63)
   at DoubleTest.main(DoubleTest.java:43)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
   at java.lang.Thread.run(Thread.java:745)

Comments
Fix Request (8u) Fixes a bug we (Amazon) have encountered. The substance of the fix is small, confined to 3 files (management.cpp, HotSpotDiagnostic.java, and Flag.c), and purely additive, thus low risk. Includes a new test which passes. Also passed jdk/test/com/sun/management/HotSpotDiagnosticMXBean (multiple tests, including the new one) hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java Review thread: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2020-July/012122.html Review approval: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2020-July/012266.html (last email in the thread, scroll down for Volker's approval)
30-07-2020

I don't agree because the test was specifically designed for testing the getVMOption() method. Right now, the test does not work because the FLAG_NAME is set to NULL. This should be changed with the fix such that it becomes a regression test for this bug.
29-10-2014

IMO, the update to the 'test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java' should be tracked by a separate issue that should be blocked by this issue.
29-10-2014

The fix for this bug should also update the test 'test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java' to use a valid FLAG_NAME.
27-10-2014

Double flags are already used. For example, -XX:CompileThresholdScaling or GC flags like -XX:FLSLargestBlockCoalesceProximity. I stumbled upon this while writing tests for JDK-8061443.
27-10-2014

The problem is that the method 'add_global_entry()' in 'share/vm/services/management.cpp' does not handle flags of type double. There is also no support code in 'com.sun.management.HotSpotDiagnostic.setVMOption()'.
21-10-2014