Fix GraalVM Failures
sydney-munro opened this issue · 5 comments
Created this issue to track work being done for graal vm failures in java-storage-nio
Current GraalVM failures appear to be caused by the new version of shared dependencies which includes googleapis/java-shared-config#854 which updates to using the new graalvm community images. Graalvm for JDK 11 is no longer supported so this change was done in an effort to slowly migrate towards the current LTS JDK version (21).
This has resulted in
Error: No instances of jdk.internal.misc.InnocuousThread are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=jdk.internal.misc.InnocuousThread.
Build with --trace-object-instantiation=jdk.internal.misc.InnocuousThread results in
Error: No instances of jdk.internal.misc.InnocuousThread are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized by the com.google.cloud.storage.contrib.nio.CloudStorageFileSystemProvider class initializer with a trace:
at jdk.internal.misc.InnocuousThread.(InnocuousThread.java:128)
at jdk.internal.misc.InnocuousThread.createThread(InnocuousThread.java:119)
at jdk.internal.misc.InnocuousThread.newSystemThread(InnocuousThread.java:107)
at jdk.internal.misc.InnocuousThread.newSystemThread(InnocuousThread.java:98)
at sun.net.www.http.KeepAliveCache$1.run(KeepAliveCache.java:149)
at sun.net.www.http.KeepAliveCache$1.run(KeepAliveCache.java:147)
at java.security.AccessController.executePrivileged(AccessController.java:776)
at java.security.AccessController.doPrivileged(AccessController.java:318)
at sun.net.www.http.KeepAliveCache.put(KeepAliveCache.java:147)
at sun.net.www.http.HttpClient.putInKeepAliveCache(HttpClient.java:500)
at sun.net.www.http.HttpClient.finished(HttpClient.java:452)
at sun.net.www.http.KeepAliveStream.close(KeepAliveStream.java:101)
at sun.net.www.MeteredStream.justRead(MeteredStream.java:95)
at sun.net.www.MeteredStream.read(MeteredStream.java:142)
at java.io.FilterInputStream.read(FilterInputStream.java:132)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3698)
at com.google.api.client.http.javanet.NetHttpResponse$SizeValidatingInputStream.read(NetHttpResponse.java:164)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:244)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.io.BufferedInputStream.read(BufferedInputStream.java:343)
at java.io.FilterInputStream.read(FilterInputStream.java:106)
at com.google.api.client.util.ByteStreams.copy(ByteStreams.java:48)
at com.google.api.client.util.IOUtils.copy(IOUtils.java:91)
at com.google.api.client.util.IOUtils.copy(IOUtils.java:61)
at com.google.api.client.http.HttpResponse.parseAsString(HttpResponse.java:513)
at com.google.cloud.ServiceOptions.getAppEngineProjectIdFromMetadataServer(ServiceOptions.java:546)
at com.google.cloud.ServiceOptions.getAppEngineProjectId(ServiceOptions.java:514)
at com.google.cloud.ServiceOptions.getDefaultProjectId(ServiceOptions.java:421)
at com.google.cloud.ServiceOptions.getDefaultProject(ServiceOptions.java:398)
at com.google.cloud.ServiceOptions.(ServiceOptions.java:338)
at com.google.cloud.storage.StorageOptions.(StorageOptions.java:118)
at com.google.cloud.storage.HttpStorageOptions.(HttpStorageOptions.java:66)
at com.google.cloud.storage.HttpStorageOptions.(HttpStorageOptions.java:53)
at com.google.cloud.storage.HttpStorageOptions$Builder.build(HttpStorageOptions.java:262)
at com.google.cloud.storage.HttpStorageOptions$Builder.build(HttpStorageOptions.java:136)
at com.google.cloud.storage.contrib.nio.StorageOptionsUtil.(StorageOptionsUtil.java:40)
at com.google.cloud.storage.contrib.nio.CloudStorageFileSystemProvider.(CloudStorageFileSystemProvider.java:107)
. To fix the issue mark jdk.internal.misc.InnocuousThread for build-time initialization with --initialize-at-build-time=jdk.internal.misc.InnocuousThread or use the the information from the trace to find the culprit and --initialize-at-run-time= to prevent its instantiation.
Detailed message:
Trace: Object was reached by
reading field sun.net.www.http.KeepAliveCache.keepAliveTimer of constant
sun.net.www.http.KeepAliveCache@3810691b: {}
reading static field sun.net.www.http.HttpClient.kac
at sun.net.www.http.HttpClient.New(HttpClient.java:342)
parsing method sun.net.www.http.HttpClient.New(HttpClient.java:336) reachable via the parsing context
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1316)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1281)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1665)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
at java.net.URL.openStream(URL.java:1161)
at sun.security.provider.SeedGenerator$URLSeedGenerator$1.run(SeedGenerator.java:528)
at sun.security.provider.SeedGenerator$URLSeedGenerator$1.run(SeedGenerator.java:510)
at com.oracle.svm.core.jdk.Target_java_security_AccessController.executePrivileged(SecuritySubstitutions.java:147)
at java.security.AccessController.doPrivileged(AccessController.java:569)
at com.oracle.svm.core.containers.CgroupUtil.readAllLinesPrivileged(CgroupUtil.java:72)
at com.oracle.svm.core.containers.CgroupSubsystemFactory.determineType(CgroupSubsystemFactory.java:121)
at com.oracle.svm.core.containers.CgroupSubsystemFactory.create(CgroupSubsystemFactory.java:50)
at com.oracle.svm.core.containers.CgroupMetrics.getInstance(CgroupMetrics.java:164)
at static root method.(Unknown Source)
Attempted to follow guidance
To fix the issue mark jdk.internal.misc.InnocuousThread for build-time initialization with --initialize-at-build-time=jdk.internal.misc.InnocuousThread or use the the information from the trace to find the culprit and --initialize-at-run-time= to prevent its instantiation.
build with --initialize-at-build-time=jdk.internal.misc.InnocuousThread results in
[1/8] Initializing... (0.0s @ 0.23GB)
Error: Incompatible change of initialization policy for jdk.internal.misc.InnocuousThread: trying to change BUILD_TIME from 'META-INF/native-image/com/google/cloud/google-cloud-nio/native-image.properties' in 'file:///tmpfs/src/github/java-storage-nio/google-cloud-nio/target/classes/' with 'jdk.internal.misc.InnocuousThread' to RERUN Contains a thread group INNOCUOUSTHREADGROUP.
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Graal has an open issue oracle/graal#5134 which appears to be related. It is mentioned that there may be mitigations in later versions of graal which could explain why this issue is isolated to the build running GraalVM CE 17.0.9+9.1
and not the build running graalvm-ce-java17-22.3.3