-
Bug
-
Resolution: Fixed
-
P2
-
11.0.4, 14
-
b23
-
x86_64
-
windows_10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8246444 | 13.0.4 | Henry Jen | P2 | Resolved | Fixed | b04 |
JDK-8241558 | 11.0.8-oracle | Henry Jen | P2 | Closed | Fixed | b01 |
JDK-8241685 | 11.0.8 | Henry Jen | P2 | Resolved | Fixed | b01 |
ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows 10 Pro (10.0.17763 build 17763)
java version "11.0.4" 2019-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)
A DESCRIPTION OF THE PROBLEM :
When launching a Java app with -classpath argument read from a file without newline and
the app has an argument starting with dash e.g. "-test", JVM crashes, for example here is WinDbg stack trace of one crash:
(5c8c.6ed8): Unknown exception - code c0000374 (!!! second chance !!!)
ntdll!RtlReportFatalFailure+0x9:
00007ffe`a887b049 eb00 jmp ntdll!RtlReportFatalFailure+0xb (00007ffe`a887b04b)
0:013> k
# Child-SP RetAddr Call Site
00 00000074`651fe760 00007ffe`a887b013 ntdll!RtlReportFatalFailure+0x9
01 00000074`651fe7b0 00007ffe`a888389e ntdll!RtlReportCriticalFailure+0x97
02 00000074`651fe8a0 00007ffe`a8883baa ntdll!RtlpHeapHandleError+0x12
03 00000074`651fe8d0 00007ffe`a881ecb1 ntdll!RtlpHpHeapHandleError+0x7a
04 00000074`651fe900 00007ffe`a882d0ca ntdll!RtlpLogHeapFailure+0x45
05 00000074`651fe930 00007ffe`a496c7eb ntdll!RtlFreeHeap+0x9ac4a
06 00000074`651fe9d0 00007ffe`0a2e384c ucrtbase!_free_base+0x1b
07 00000074`651fea00 00007ffe`0a1cb545 jvm!c2v_reprofile+0x2b332c
08 00000074`651fea60 00007ffe`09e0a7ff jvm!c2v_reprofile+0x19b025
09 00000074`651feaa0 00007ffe`09e0a6a1 jvm!JVM_EnqueueOperation+0x12440f
If the app argument does not have dash: e.g. "test", everything works ok.
Here is an example of command line that causes the crash:
"C:\Program Files\Java\jdk-11.0.4\bin\java.exe" -Dfile.encoding=UTF-8 "@classpath.txt" Test -test
Excerpt from output before the crash when (with "set _JAVA_LAUNCHER_DEBUG=true"):
Main class is 'Test'
App's argc is 1
argv[ 0] = '-test'
6849 micro seconds to load main class
----_JAVA_LAUNCHER_DEBUG----
AppArgIndex: -1 points to (null)
Warning: app args count doesn't match, 7 1
passing arguments as-is.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create file "classpath.txt" with following content:
-classpath .;C:\Users\haapaan\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\27.1-jre\e47b59c893079b87743cdcfb6f17ca95c08c592c\guava-27.1-jre.jar
No newline at the end.
Compile the Test.java:
javac @classpath.txt Test.java
Run Test.class:
"C:\Program Files\Java\jdk-11.0.4\bin\java.exe" -Dfile.encoding=UTF-8 "@classpath.txt" Test -test
That crashes almost every time.
If I have a more complex Spring Boot Application, it crashes every time:
"C:\Program Files\Java\jdk-11.0.4\bin\java.exe" -Dfile.encoding=UTF-8 "@longclasspath.txt" fi.trimico.mbus.MBusBatchApplication -test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Print "Hello world" to stdout and not crash.
ACTUAL -
Access violation and the JVM crashes.
---------- BEGIN SOURCE ----------
import com.google.common.collect.Collections2;
import java.util.Arrays;
public class Test {
public static void main(String args[]) {
Collections2.permutations(java.util.Arrays.asList(1,2,3));
System.out.println("Hello world");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Pass classpath some other way, e.g. directly in command line:
"C:\Program Files\Java\jdk-11.0.4\bin\java.exe" -Dfile.encoding=UTF-8 -classpath .;C:\Users\haapaan\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\27.1-jre\e47b59c893079b87743cdcfb6f17ca95c08c592c\guava-27.1-jre.jar Test -test
FREQUENCY : often
Microsoft Windows 10 Pro (10.0.17763 build 17763)
java version "11.0.4" 2019-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)
A DESCRIPTION OF THE PROBLEM :
When launching a Java app with -classpath argument read from a file without newline and
the app has an argument starting with dash e.g. "-test", JVM crashes, for example here is WinDbg stack trace of one crash:
(5c8c.6ed8): Unknown exception - code c0000374 (!!! second chance !!!)
ntdll!RtlReportFatalFailure+0x9:
00007ffe`a887b049 eb00 jmp ntdll!RtlReportFatalFailure+0xb (00007ffe`a887b04b)
0:013> k
# Child-SP RetAddr Call Site
00 00000074`651fe760 00007ffe`a887b013 ntdll!RtlReportFatalFailure+0x9
01 00000074`651fe7b0 00007ffe`a888389e ntdll!RtlReportCriticalFailure+0x97
02 00000074`651fe8a0 00007ffe`a8883baa ntdll!RtlpHeapHandleError+0x12
03 00000074`651fe8d0 00007ffe`a881ecb1 ntdll!RtlpHpHeapHandleError+0x7a
04 00000074`651fe900 00007ffe`a882d0ca ntdll!RtlpLogHeapFailure+0x45
05 00000074`651fe930 00007ffe`a496c7eb ntdll!RtlFreeHeap+0x9ac4a
06 00000074`651fe9d0 00007ffe`0a2e384c ucrtbase!_free_base+0x1b
07 00000074`651fea00 00007ffe`0a1cb545 jvm!c2v_reprofile+0x2b332c
08 00000074`651fea60 00007ffe`09e0a7ff jvm!c2v_reprofile+0x19b025
09 00000074`651feaa0 00007ffe`09e0a6a1 jvm!JVM_EnqueueOperation+0x12440f
If the app argument does not have dash: e.g. "test", everything works ok.
Here is an example of command line that causes the crash:
"C:\Program Files\Java\jdk-11.0.4\bin\java.exe" -Dfile.encoding=UTF-8 "@classpath.txt" Test -test
Excerpt from output before the crash when (with "set _JAVA_LAUNCHER_DEBUG=true"):
Main class is 'Test'
App's argc is 1
argv[ 0] = '-test'
6849 micro seconds to load main class
----_JAVA_LAUNCHER_DEBUG----
AppArgIndex: -1 points to (null)
Warning: app args count doesn't match, 7 1
passing arguments as-is.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create file "classpath.txt" with following content:
-classpath .;C:\Users\haapaan\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\27.1-jre\e47b59c893079b87743cdcfb6f17ca95c08c592c\guava-27.1-jre.jar
No newline at the end.
Compile the Test.java:
javac @classpath.txt Test.java
Run Test.class:
"C:\Program Files\Java\jdk-11.0.4\bin\java.exe" -Dfile.encoding=UTF-8 "@classpath.txt" Test -test
That crashes almost every time.
If I have a more complex Spring Boot Application, it crashes every time:
"C:\Program Files\Java\jdk-11.0.4\bin\java.exe" -Dfile.encoding=UTF-8 "@longclasspath.txt" fi.trimico.mbus.MBusBatchApplication -test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Print "Hello world" to stdout and not crash.
ACTUAL -
Access violation and the JVM crashes.
---------- BEGIN SOURCE ----------
import com.google.common.collect.Collections2;
import java.util.Arrays;
public class Test {
public static void main(String args[]) {
Collections2.permutations(java.util.Arrays.asList(1,2,3));
System.out.println("Hello world");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Pass classpath some other way, e.g. directly in command line:
"C:\Program Files\Java\jdk-11.0.4\bin\java.exe" -Dfile.encoding=UTF-8 -classpath .;C:\Users\haapaan\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\27.1-jre\e47b59c893079b87743cdcfb6f17ca95c08c592c\guava-27.1-jre.jar Test -test
FREQUENCY : often
- backported by
-
JDK-8241685 Crash if classpath is read from @argument file and the main gets option argument
- Resolved
-
JDK-8246444 Crash if classpath is read from @argument file and the main gets option argument
- Resolved
-
JDK-8241558 Crash if classpath is read from @argument file and the main gets option argument
- Closed
- relates to
-
JDK-8234076 JVM crashes on Windows 10 using --module=NAME
- Resolved