-
Bug
-
Resolution: Fixed
-
P4
-
18
-
b24
-
x86_64
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8290255 | 17.0.5-oracle | Harold Seigel | P4 | Resolved | Fixed | b02 |
JDK-8289912 | 17.0.5 | Yuri Nesterenko | P4 | Resolved | Fixed | b01 |
JDK-8290505 | 15.0.9 | Yuri Nesterenko | P4 | Resolved | Fixed | b01 |
JDK-8290883 | 13.0.13 | Yuri Nesterenko | P4 | Resolved | Fixed | b02 |
Linux (Fedora 35), verified against Java 18 and 17.0.3
A DESCRIPTION OF THE PROBLEM :
While trying to use AppCDS with an application with several dependencies outside of our control, we found a VerifyError that happens when a specific Kotlin class is loaded from a shared archive.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Download the following popular Kotlin jars from Maven Central:
https://search.maven.org/remotecontent?filepath=com/squareup/okio/okio/2.10.0/okio-2.10.0.jar
https://search.maven.org/remotecontent?filepath=com/squareup/okhttp3/okhttp/4.9.3/okhttp-4.9.3.jar
https://search.maven.org/remotecontent?filepath=org/jetbrains/kotlin/kotlin-stdlib/1.6.21/kotlin-stdlib-1.6.21.jar
Compile the attached source code against third-party JARs:
% javac -cp okhttp-4.9.3.jar:kotlin-stdlib-1.6.21.jar KtCdsVerifyError.java
Create a JAR for CDS:
% jar -cf KtCdsVerifyError.jar KtCdsVerifyError.class
Create a shared archive:
% java -XX:ArchiveClassesAtExit=ktcds.jsa -cp okio-2.10.0.jar:okhttp-4.9.3.jar:kotlin-stdlib-1.6.21.jar:KtCdsVerifyError.jar KtCdsVerifyError
Re-execute the program using the shared archive:
% java -XX:SharedArchiveFile=ktcds.jsa -cp okio-2.10.0.jar:okhttp-4.9.3.jar:kotlin-stdlib-1.6.21.jar:KtCdsVerifyError.jar KtCdsVerifyError
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should run successfully with no output whether launched with a shared archive or not.
ACTUAL -
When run with the created shared archive, the program fails:
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
okhttp3/internal/Util
Reason:
Type '[Ljava/lang/Object;' is not assignable to 'okhttp3/internal/Util'
at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1239)
at okhttp3.HttpUrl$Companion.get(HttpUrl.kt:1633)
at okhttp3.HttpUrl.get(HttpUrl.kt)
at KtCdsVerifyError.main(KtCdsVerifyError.java:5)
---------- BEGIN SOURCE ----------
import okhttp3.HttpUrl;
public class KtCdsVerifyError {
public static void main(final String[] args) {
HttpUrl.get("http://example.com");
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Avoid loading Kotlin classes at CDS archive time.
FREQUENCY : always
- backported by
-
JDK-8289912 CDS VerifyError when calling clone() on object array
- Resolved
-
JDK-8290255 CDS VerifyError when calling clone() on object array
- Resolved
-
JDK-8290505 CDS VerifyError when calling clone() on object array
- Resolved
-
JDK-8290883 CDS VerifyError when calling clone() on object array
- Resolved
- links to
-
Commit openjdk/jdk13u-dev/3a5ebd11
-
Commit openjdk/jdk15u-dev/ce091ab8
-
Commit openjdk/jdk17u-dev/363a8ffd
-
Commit openjdk/jdk/646c8aae
-
Review openjdk/jdk13u-dev/376
-
Review openjdk/jdk15u-dev/236
-
Review openjdk/jdk17u-dev/519
-
Review openjdk/jdk/8737