[jboss-jira] [JBoss JIRA] (WFLY-10448) Obsolete java options -d32, -d64 in jdk-10 affect scripts domain.sh, standalone.sh, appclient.sh

Brian Stansberry (JIRA) issues at jboss.org
Thu May 24 18:15:00 EDT 2018


    [ https://issues.jboss.org/browse/WFLY-10448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13581978#comment-13581978 ] 

Brian Stansberry edited comment on WFLY-10448 at 5/24/18 6:14 PM:
------------------------------------------------------------------

AIUI, any -d32 or -d64 would only come from user supplied $JAVA_OPTS. And the presence of that in $JAVA_OPTS is going to prevent the server starting, which is fine, the user should be informed if they are providing useless params. So, the script missing out on including a -server doesn't matter much.

Adding a -d32 in domain.conf and running domain.sh I get:

{code}
$ dist/target/wildfly-13.0.0.Beta2-SNAPSHOT/bin/domain.sh 
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /Users/bstansberry/dev/wildfly/wildfly/dist/target/wildfly-13.0.0.Beta2-SNAPSHOT

  JAVA: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java

  JAVA_OPTS: -d32 -Xms64m -Xmx512m -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

=========================================================================

Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
{code}

In standalone.sh it's a bit different as there's this crufty stuff:

{code}
    elif $darwin && [ "x$SERVER_SET" = "x" ]; then
        # Use 32-bit on Mac, unless server has been specified or the user opts are incompatible
        "$JAVA" -d32 $JAVA_OPTS -version > /dev/null 2>&1 && PREPEND_JAVA_OPTS="-d32" && JVM_OPTVERSION="-d32"
    fi
{code}

There we're trying 'java -d32 -version' regardless of what the user says. It doesn't seem to break anything (in fact that call failing 'works', as it results as intended in not trying to pass -d32 in the java call that launches the server.)

OT: in 2018 this logic trying to force Macs to use -client and -d32 seems really crufty and not worth the complexity. Note also that standalone.sh doesn't actively prevent -server for Macs the way domain.sh and appclient.sh do.

Semi-OT: In the script snippet in the description I see two smelly things:

1) HAS_HOTSPOT=`"$JAVA" $JVM_OPTVERSION -version 2>&1 | $GREP -i HotSpot`

That '-version' is redundant as JVM_OPTVERSION already has -version in it. The JVM doesn't seem to mind the duplicate though, at least Hotspot doesn't.

2) The last block is pointless as JVM_OPTVERSION is not used after it:

{code}
else
    JVM_OPTVERSION="-server $JVM_OPTVERSION"
fi
{code}


was (Author: brian.stansberry):
AIUI, any -d32 or -d64 would only come from user supplied $JAVA_OPTS. And the presence of that in $JAVA_OPTS is going to prevent the server starting, which is fine, the user should be informed if they are providing useless params. So, the script missing out on including a -server doesn't matter much.

Adding a -d32 in domain.conf and running domain.sh I get:

{code}
$ dist/target/wildfly-13.0.0.Beta2-SNAPSHOT/bin/domain.sh 
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /Users/bstansberry/dev/wildfly/wildfly/dist/target/wildfly-13.0.0.Beta2-SNAPSHOT

  JAVA: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java

  JAVA_OPTS: -d32 -Xms64m -Xmx512m -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

=========================================================================

Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
{code}

In standalone.sh it's a bit different as there's this crufty stuff:

{code}
    elif $darwin && [ "x$SERVER_SET" = "x" ]; then
        # Use 32-bit on Mac, unless server has been specified or the user opts are incompatible
        "$JAVA" -d32 $JAVA_OPTS -version > /dev/null 2>&1 && PREPEND_JAVA_OPTS="-d32" && JVM_OPTVERSION="-d32"
    fi
{code}

There we're trying 'java -d32 -version' regardless of what the user says. It doesn't seem to break anything (in fact that calling failing 'works', as it results in not trying to pass -d32 in the java call that launches the server.)

OT: in 2018 this logic trying to force Macs to use -client and -d32 seems really crufty and not worth the complexity. Note also that standalone.sh doesn't actively prevent -server for Macs the way domain.sh and appclient.sh do.

Semi-OT: In the script snippet in the description I see two smelly things:

1) HAS_HOTSPOT=`"$JAVA" $JVM_OPTVERSION -version 2>&1 | $GREP -i HotSpot`

That '-version' is redundant as JVM_OPTVERSION already has -version in it. The JVM doesn't seem to mind the duplicate though, at least Hotspot doesn't.

2) The last block is pointless as JVM_OPTVERSION is not used after it:

{code}
else
    JVM_OPTVERSION="-server $JVM_OPTVERSION"
fi
{code}

> Obsolete java options -d32, -d64 in jdk-10 affect scripts domain.sh, standalone.sh, appclient.sh
> ------------------------------------------------------------------------------------------------
>
>                 Key: WFLY-10448
>                 URL: https://issues.jboss.org/browse/WFLY-10448
>             Project: WildFly
>          Issue Type: Bug
>          Components: Scripts
>    Affects Versions: 13.0.0.CR1
>            Reporter: R Searls
>            Assignee: R Searls
>            Priority: Minor
>
> bin\scripts domain.sh, standalone.sh and appclient.sh have a section of code that uses java option -d32 and -d64 when calling java to check the HotSpot type.  These 2 options have been removed from JDK-10.  They are marked as deprecated in JDK-9 but still function.
> These options are used in determining if '-server' is added to JAVA_OPTS.  Enhancements need to be made to the scripts to check the JDK version and take appropriate action is assigning the value '-server'.
> The code affected
> {code:java}
> # Check for -d32/-d64 in JAVA_OPTS
> JVM_OPTVERSION="-version"
> JVM_D64_OPTION=`echo $JAVA_OPTS | $GREP "\-d64"`
> JVM_D32_OPTION=`echo $JAVA_OPTS | $GREP "\-d32"`
> test "x$JVM_D64_OPTION" != "x" && JVM_OPTVERSION="-d64 $JVM_OPTVERSION"
> test "x$JVM_D32_OPTION" != "x" && JVM_OPTVERSION="-d32 $JVM_OPTVERSION"
> # If -server not set in JAVA_OPTS, set it, if supported
> SERVER_SET=`echo $JAVA_OPTS | $GREP "\-server"`
> if [ "x$SERVER_SET" = "x" ]; then
>     # Check for SUN(tm) JVM w/ HotSpot support
>     if [ "x$HAS_HOTSPOT" = "x" ]; then
>         HAS_HOTSPOT=`"$JAVA" $JVM_OPTVERSION -version 2>&1 | $GREP -i HotSpot`
>     fi
>     # Check for OpenJDK JVM w/server support
>     if [ "x$HAS_OPENJDK" = "x" ]; then
>         HAS_OPENJDK=`"$JAVA" $JVM_OPTVERSION 2>&1 | $GREP -i OpenJDK`
>     fi
>     # Check for IBM JVM w/server support
>     if [ "x$HAS_IBM" = "x" ]; then
>         HAS_IBM=`"$JAVA" $JVM_OPTVERSION 2>&1 | $GREP -i "IBM J9"`
>     fi
>     # Enable -server if we have Hotspot or OpenJDK, unless we can't
>     if [ "x$HAS_HOTSPOT" != "x" -o "x$HAS_OPENJDK" != "x" -o "x$HAS_IBM" != "x" ]; then
>         # MacOS does not support -server flag
>         if [ "$darwin" != "true" ]; then
>             PROCESS_CONTROLLER_JAVA_OPTS="-server $PROCESS_CONTROLLER_JAVA_OPTS"
>             HOST_CONTROLLER_JAVA_OPTS="-server $HOST_CONTROLLER_JAVA_OPTS"
>             JVM_OPTVERSION="-server $JVM_OPTVERSION"
>         fi
>     fi
> else
>     JVM_OPTVERSION="-server $JVM_OPTVERSION"
> fi
> {code}
> Here is the output of the currently supported java versions
> Doc for jdk-8 states
> >  java -help
>     where options include:
>         -d32	  use a 32-bit data model if available
>         -d64	  use a 64-bit data model if available
> Using these options tell if the version supports 32-bit or 64-bit
> > java -d32 -version
>     Error: This Java instance does not support a 32-bit JVM.
>     Please install the desired version.
> > java -d64 -version
>     java version "1.8.0_72"
>     Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
>     Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
> Doc for jdk-9 states
> >  java -help
>     where options include:
>        -d32	  Deprecated, will be removed in a future release
>        -d64	  Deprecated, will be removed in a future release
> > java -d32 -version
>     Error: This Java instance does not support a 32-bit JVM.
>     Please install the desired version.
> > java -d64 -version
>     openjdk version "9.0.4"
>     OpenJDK Runtime Environment (build 9.0.4+11)
>     OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)
> Doc for jdk-10
> > java -help
>     No documentation for these options listed
> > java -d32 -version
>     Unrecognized option: -d32
>     Error: Could not create the Java Virtual Machine.
>     Error: A fatal exception has occurred. Program will exit.
> > java -d64 -version
>     Unrecognized option: -d64
>     Error: Could not create the Java Virtual Machine.
>     Error: A fatal exception has occurred. Program will exit.
> Obsolete java options -d32, -d64 in jdk-10 affect scripts domain.sh, standalone.sh



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list