Uploaded image for project: 'Java Mission Control'
  1. Java Mission Control
  2. JMC-6692

JMC is asking to unlock Commercial Features on JFR enabled OpenJDK8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8.0.0
    • None
    • Mission Control Client
    • None

        Summary: when trying to use Flight Recorder on a JFR-enabled OpenJDK8 JVM, a dialog opens asking if the user wants to unlock Commercial Features. Only once "yes" is selected in the dialog does JFR work as expected.

        I've attached a screenshot of this happening using a JDK8 I patched and built myself.

        After some digging, I think this is related to JMC-6554. More specifically, this line change: https://github.com/openjdk/jmc/commit/4b315fe62adb44c5524b55cac2e286fa22324573#diff-0b04383b19ec0cdc6a41720dddc19a70R62

        If I grab the Java information using

        -XshowSettings:properties -version

        then I see:

            java.runtime.name = OpenJDK Runtime Environment
            java.runtime.version = 1.8.0_242-b08
            java.specification.name = Java Platform API Specification
            java.specification.vendor = Oracle Corporation
            java.specification.version = 1.8
            java.vendor = Oracle Corporation
            java.vendor.url = http://java.oracle.com/
            java.vendor.url.bug = http://bugreport.sun.com/bugreport/
            java.version = 1.8.0_242
            java.vm.info = mixed mode
            java.vm.name = OpenJDK 64-Bit Server VM
            java.vm.specification.name = Java Virtual Machine Specification
            java.vm.specification.vendor = Oracle Corporation
            java.vm.specification.version = 1.8
            java.vm.vendor = Oracle Corporation
            java.vm.version = 25.242-b08
        

        As a result, the CommercialFeaturesServiceFactory returns a Hotspot23CommercialFeaturesService instead of a NoCommercialFeaturesService, because the ConnectionToolkit checks the vendor string to see if it contains "Oracle", which it does. The Hotspot23CommercialFeaturesService always returns true when returning hasCommercialFeatures(), so when it checks if the features are enabled, it returns false, causing the dialog to appear in order to have the user enable commercial features.

        Additionally, the it seems OpenJDK11 doesn't complain this way because of an if-statement (in ConnectionToolkit) that forces NoCommercialFeaturesService to be used if the JDK version is 11 or higher. If I comment out that if-statement, JMC will also ask me to unlock Commercial Features on my Fedora supplied OpenJDK 11.

        Unless I'm missing something here, is a potential fix just changing the check on "jvm.vendor" to "java.vm.name" ?

              aptmac Alex Macdonald
              aptmac Alex Macdonald
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: