glassfish
  1. glassfish
  2. GLASSFISH-17139

asadmin create-jvm-options does not handle colons as documented

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.1.2_b14
    • Component/s: docs
    • Labels:
      None
    • Environment:

      Description

      asadmin create-jvm-options does not seem to handle parsing options that have colons in them. Not a surprise since colons are used as the delimiter between pairs as well:

      1. asadmin create-jvm-options --help | grep -B3 PrintGCDetails
        This example sets the maximum available heap size to 1024
        and requests details about garbage collection.

      asadmin> create-jvm-options "-Xmx1024m:-XX:+PrintGCDetails"

      1. asadmin create-jvm-options "-Xmx1024m:-XX:+PrintGCDetails"
        remote failure: JVM option +PrintGCDetails is invalid because it does not start with a '-'
        Command create-jvm-options failed.

      So, I thought: "who cares? I'll just issue two separate commands":

      1. asadmin create-jvm-options "-Xmx1024m"
        Created 1 option(s)
        Command create-jvm-options executed successfully.
      2. asadmin create-jvm-options "-XX:+PrintGCDetails"
        remote failure: JVM option +PrintGCDetails is invalid because it does not start with a '-'
        Command create-jvm-options failed.

      Nope.. so the only way I can find to set "-XX:" options (I'm actually only interested in -XX:MaxPermSize) from the command line is to use external scripts such as some BASH or Python - but this is less than ideal.

      Additional Note: The asadmin create-jvm-options --help command also lists an example:
      asadmin> create-jvm-options --profiler=true -XX:MaxPermSize=192m

      ... naturally, this fails with the "invalid because it does not start with a '-'" error as well.

        Activity

        Hide
        Tom Mueller added a comment -

        A colon ( can be included in a JVM option using the create-jvm-options command by escaping it with a backslash (). For example, on Linux with bash:

        asadmin create-jvm-options -XX
        :MaxPermSize=192m

        or

        asadmin create-jvm-options "-XX\:MaxPermSize=192m"

        This is definitely a documentation issue as the manual page needs to be corrected.

        However, there is also a problem with passing a plus ("+") in a JVM option, as it is converted to a space due to the URL encoding that happens when the command is passed to the server. As a workaround, the PrintGCDetails option can be set using the following command:

        asadmin create-jvm-options "-XX\:%2BPrintGCDetails"

        Show
        Tom Mueller added a comment - A colon ( can be included in a JVM option using the create-jvm-options command by escaping it with a backslash (). For example, on Linux with bash: asadmin create-jvm-options -XX :MaxPermSize=192m or asadmin create-jvm-options "-XX\:MaxPermSize=192m" This is definitely a documentation issue as the manual page needs to be corrected. However, there is also a problem with passing a plus ("+") in a JVM option, as it is converted to a space due to the URL encoding that happens when the command is passed to the server. As a workaround, the PrintGCDetails option can be set using the following command: asadmin create-jvm-options "-XX\:%2BPrintGCDetails"
        Hide
        Tom Mueller added a comment -

        I created issue GLASSFISH-17141 to deal with the plus issue.

        Changing this issue to be a documentation issue for the create-jvm-options manual page. Then change to the manual page needs to explain how to escape the colon when it is passed in an argument. Also, the examples that use a colon need to be corrected.

        Show
        Tom Mueller added a comment - I created issue GLASSFISH-17141 to deal with the plus issue. Changing this issue to be a documentation issue for the create-jvm-options manual page. Then change to the manual page needs to explain how to escape the colon when it is passed in an argument. Also, the examples that use a colon need to be corrected.
        Hide
        Paul Davies added a comment - - edited

        The description of the operand (which is where colons would be specified) already states the need to escape the colon character:

        Note - If an option name or option value contains a colon, the backslash must be used to escape the colon in the name or value. Other characters might also require an escape character. For more information about escape characters in subcommand options, see the asadmin(1M) man page.

        In the online version of the create-jvm-options(1) man page, Examples 1-3 show the required backslash characters. The version that is displayed when --help is typed must be fixed to match the online version.

        The required backslash that is missing from Example 4 must be added.

        Show
        Paul Davies added a comment - - edited The description of the operand (which is where colons would be specified) already states the need to escape the colon character: Note - If an option name or option value contains a colon, the backslash must be used to escape the colon in the name or value. Other characters might also require an escape character. For more information about escape characters in subcommand options, see the asadmin(1M) man page. In the online version of the create-jvm-options(1) man page, Examples 1-3 show the required backslash characters. The version that is displayed when --help is typed must be fixed to match the online version. The required backslash that is missing from Example 4 must be added.
        Hide
        Mike Fitch added a comment -

        Corrected colon in example 4 in build 14 via svn commit 51521

        Show
        Mike Fitch added a comment - Corrected colon in example 4 in build 14 via svn commit 51521
        Hide
        emailnbw added a comment -

        @Tom Mueller

        You mentioned using %2B for the + character. eg. asadmin create-jvm-options "-XX\:%2BPrintGCDetails"

        Using %2B inside a text file that is fed into asadmin multimode on Windows 7 x64 w/Glassfish 3.1.2 FCS (build 23) failed for me. It did not translate %2B to +.

        What I ended up doing which did work was using single quotes and leaving the + and escaping the :. For example inside my multimode file:

        create-jvm-options '-XX\:+PrintGCDetails'

        -Noah

        Show
        emailnbw added a comment - @Tom Mueller You mentioned using %2B for the + character. eg. asadmin create-jvm-options "-XX\:%2BPrintGCDetails" Using %2B inside a text file that is fed into asadmin multimode on Windows 7 x64 w/Glassfish 3.1.2 FCS (build 23) failed for me. It did not translate %2B to +. What I ended up doing which did work was using single quotes and leaving the + and escaping the :. For example inside my multimode file: create-jvm-options '-XX\:+PrintGCDetails' -Noah
        Hide
        juliohm added a comment -

        I've also noted this issue while using asadmin via command line. I am able to create jvm options escaping the colon with a double slash only. For example:

         
        create-jvm-options -XX\\:+PrintGCDetails
        

        list-jvm-options will show the following:

         
        -XX: PrintGCDetails
        

        However, when I open the domain.xml file, the plus sign is there and it seems to be configured correctly. A list of running jobs on linux reveals that the command line executed for glassfish is also correct.

         
        /opt/jdk/bin/java -cp /opt/glassfish3/glassfish/modules/glassfish.jar -XX:+UnlockDiagnosticVMOptions -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+PrintGCDetails -server ## snipped
        

        So, unless this has any real effect during runtime, this might be considered not as major as reported. It seems more of a problem displaying the + character on the terminal while running list-jvm-options and parsing it during create-jvm-options.

        Show
        juliohm added a comment - I've also noted this issue while using asadmin via command line. I am able to create jvm options escaping the colon with a double slash only. For example: create-jvm-options -XX\\:+PrintGCDetails list-jvm-options will show the following: -XX: PrintGCDetails However, when I open the domain.xml file, the plus sign is there and it seems to be configured correctly. A list of running jobs on linux reveals that the command line executed for glassfish is also correct. /opt/jdk/bin/java -cp /opt/glassfish3/glassfish/modules/glassfish.jar -XX:+UnlockDiagnosticVMOptions -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+PrintGCDetails -server ## snipped So, unless this has any real effect during runtime, this might be considered not as major as reported. It seems more of a problem displaying the + character on the terminal while running list-jvm-options and parsing it during create-jvm-options.

          People

          • Assignee:
            Mike Fitch
            Reporter:
            pgiblox
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: