JDK-8132379 : -J options can cause crash or "Warning: app args parsing error passing arguments as-is"
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-07-27
  • Updated: 2016-07-26
  • Resolved: 2016-07-13
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
9 b128Fixed
Related Reports
Relates :  
Relates :  
Description
ILW=HMM

seems to be introduced with JDK-8077822, b66 and higher are broken, but b65 works fine

here is the output with "set _JAVA_LAUNCHER_DEBUG=true"

d:\Temp>d:\JDK_TEST\9b74\bin\java -showversion -jar d:\Soft\apache-jmeter-2.9\bin\ApacheJMeter.jar -n -t testplan.jmx -l r.jtl -Jjmeterengine.nongui.port=0 -Jaddress=127.0.0.1 -Jduration=90 -Jserver_port=7001
Windows original main args:
wwwd_args[0] = d:\JDK_TEST\9b74\bin\java
wwwd_args[1] = -showversion
wwwd_args[2] = -jar
wwwd_args[3] = d:\Soft\apache-jmeter-2.9\bin\ApacheJMeter.jar
wwwd_args[4] = -n
wwwd_args[5] = -t
wwwd_args[6] = testplan.jmx
wwwd_args[7] = -l
wwwd_args[8] = r.jtl
wwwd_args[9] = -Jjmeterengine.nongui.port=0
wwwd_args[10] = -Jaddress=127.0.0.1
wwwd_args[11] = -Jduration=90
wwwd_args[12] = -Jserver_port=7001
----_JAVA_LAUNCHER_DEBUG----
Launcher state:
        debug:on
        javargs:off
        program name:java
        launcher name:java
        javaw:off
        fullversion:1.9.0-ea-b74
        dotversion:1.9
        ergo_policy:DEFAULT_ERGONOMICS_POLICY
Command line args:
argv[0] = d:\JDK_TEST\9b74\bin\java
argv[1] = -showversion
argv[2] = -jar
argv[3] = d:\Soft\apache-jmeter-2.9\bin\ApacheJMeter.jar
argv[4] = -n
argv[5] = -t
argv[6] = testplan.jmx
argv[7] = -l
argv[8] = r.jtl
argv[9] = -Jjmeterengine.nongui.port=0
argv[10] = -Jaddress=127.0.0.1
argv[11] = -Jduration=90
argv[12] = -Jserver_port=7001
JRE path is d:\JDK_TEST\9b74
jvm.cfg[0] = ->-server<-
jvm.cfg[1] = ->-client<-
636 micro seconds to parse jvm.cfg
Default VM: server
JVM path is d:\JDK_TEST\9b74\bin\server\jvm.dll
JRE path is d:\JDK_TEST\9b74
CRT path is d:\JDK_TEST\9b74\bin\msvcr120.dll
JRE path is d:\JDK_TEST\9b74
PRT path is d:\JDK_TEST\9b74\bin\msvcp120.dll
5614 micro seconds to LoadJavaVM
JavaVM args:
    version 0x00010002, ignoreUnrecognized is JNI_FALSE, nOptions is 5
    option[ 0] = '-Dsun.java.launcher.diag=true'
    option[ 1] = '-Djava.class.path=.'
    option[ 2] = '-Djava.class.path=d:\Soft\apache-jmeter-2.9\bin\ApacheJMeter.jar'
    option[ 3] = '-Dsun.java.command=d:\Soft\apache-jmeter-2.9\bin\ApacheJMeter.jar -n -t testplan.jmx -l r.jtl -Jjmeter
engine.nongui.port=0 -Jaddress=127.0.0.1 -Jduration=90 -Jserver_port=7001'
    option[ 4] = '-Dsun.java.launcher=SUN_STANDARD'
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b74)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b74, mixed mode)

61549 micro seconds to InitializeJVM
JAR file is 'd:\Soft\apache-jmeter-2.9\bin\ApacheJMeter.jar'
App's argc is 9
    argv[ 0] = '-n'
    argv[ 1] = '-t'
    argv[ 2] = 'testplan.jmx'
    argv[ 3] = '-l'
    argv[ 4] = 'r.jtl'
    argv[ 5] = '-Jjmeterengine.nongui.port=0'
    argv[ 6] = '-Jaddress=127.0.0.1'
    argv[ 7] = '-Jduration=90'
    argv[ 8] = '-Jserver_port=7001'
23609 micro seconds to load main class
----_JAVA_LAUNCHER_DEBUG----
Warning: app args parsing error
passing arguments as-is
Could not open testplan.jmx

-------------
when no -showversion is specified, in most cases jvm crashes on launch. Sometimes there is no crash but the warning is printed
Comments
It looks like -J- should not be considered as a tunnel when it appears as an application argument, this is somewhat orthogonal to the original issue. However, I want to confirm if the test build fixes the original issue reported.
30-07-2015

Also the trouble is -J was being incorrectly parsed, so therefore likely that was also your problem since -J is being used an application argument.
28-07-2015

pardon "-J-" will help in my very case, but I guess it will crash again as soon as application argument will start with this prefix...
28-07-2015

I suspect, that "idx = filteredargc - argc" can be negative, that's how crash happens I did not test the suggested fix yet (and I doubt it will help, because my example command does not contain -J-, so nothing should change) I've added additional logging to the code in case of printing this warning: JLI_TraceLauncher("Warning: app args parsing error\n"); JLI_TraceLauncher("passing arguments as-is\n"); JLI_TraceLauncher("idx %d, filteredargc %d, argc %d, ostart %s, astart %s\n", idx, filteredargc, argc, ostart, astart); here what I've got: Warning: app args parsing error passing arguments as-is idx 1, filteredargc 9, argc 8, ostart -showversion, astart -n this shows at least there is a logic error, because what you compare is argument of java application and argument of jvm, but these 2 strings are expected to be the same
28-07-2015