Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecosystem CI for Google Cloud Services fails with Quarkus main #25501

Closed
loicmathieu opened this issue May 11, 2022 · 12 comments
Closed

Ecosystem CI for Google Cloud Services fails with Quarkus main #25501

loicmathieu opened this issue May 11, 2022 · 12 comments
Assignees
Labels

Comments

@loicmathieu
Copy link
Contributor

Describe the bug

The Quarkiverse extension Google Cloud Services fails to runs the ecosystem CI due to an issue to build a native image with the current Quarkus main.

See the failing build: https://github.com/quarkiverse/quarkus-google-cloud-services/actions/runs/2304956797

Expected behavior

Eciosystem CI build is OK

Actual behavior

It fails with

Fatal error: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a PlatformManagedObject (a MXBean defined by the virtual machine) in the image heap. This bean is introspecting the VM that runs the image builder, i.e., a VM instance that is no longer available at image runtime. Class of disallowed object: com.sun.management.internal.HotSpotDiagnostic  Object has been initialized by the com.oracle.svm.hosted.jfr.JfrFeature class initializer with a trace: 
 	at com.sun.management.internal.HotSpotDiagnostic.<init>(HotSpotDiagnostic.java:42)
	at com.sun.management.internal.PlatformMBeanProviderImpl.getDiagnosticMXBean(PlatformMBeanProviderImpl.java:274)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Unknown Source)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at com.oracle.svm.hosted.jfr.JfrFeature.getDiagnosticBean(JfrFeature.java:154)
	at com.oracle.svm.hosted.jfr.JfrFeature.<clinit>(JfrFeature.java:125)
. Try to avoid initializing the class that stores the object in a static field The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
	at com.oracle.graal.pointsto.util.AnalysisFuture.setException(AnalysisFuture.java:49)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:269)
	at com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
	at com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$postTask$9(ImageHeapScanner.java:611)
	at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a PlatformManagedObject (a MXBean defined by the virtual machine) in the image heap. This bean is introspecting the VM that runs the image builder, i.e., a VM instance that is no longer available at image runtime. Class of disallowed object: com.sun.management.internal.HotSpotDiagnostic  Object has been initialized by the com.oracle.svm.hosted.jfr.JfrFeature class initializer with a trace: 
 	at com.sun.management.internal.HotSpotDiagnostic.<init>(HotSpotDiagnostic.java:42)
	at com.sun.management.internal.PlatformMBeanProviderImpl.getDiagnosticMXBean(PlatformMBeanProviderImpl.java:274)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Unknown Source)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at com.oracle.svm.hosted.jfr.JfrFeature.getDiagnosticBean(JfrFeature.java:154)
	at com.oracle.svm.hosted.jfr.JfrFeature.<clinit>(JfrFeature.java:125)
. Try to avoid initializing the class that stores the object in a static field The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
	at com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.error(DisallowedImageHeapObjectFeature.java:173)
	at com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.checkDisallowedMBeanObjects(DisallowedImageHeapObjectFeature.java:162)
	at com.oracle.svm.hosted.image.DisallowedImageHeapObjectFeature.replacer(DisallowedImageHeapObjectFeature.java:119)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.replaceObject(AnalysisUniverse.java:582)
	at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.replaceObject(AnalysisConstantReflectionProvider.java:257)
	at com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.interceptValue(AnalysisConstantReflectionProvider.java:228)
	at com.oracle.svm.hosted.heap.SVMImageHeapScanner.transformFieldValue(SVMImageHeapScanner.java:126)
	at com.oracle.graal.pointsto.heap.ImageHeapScanner.onFieldValueReachable(ImageHeapScanner.java:331)
	at com.oracle.graal.pointsto.heap.ImageHeapScanner.onFieldValueReachable(ImageHeapScanner.java:310)
	at com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$computeTypeData$1(ImageHeapScanner.java:153)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	... 10 more

How to Reproduce?

This can be reproduced using the integration test of the extension pack.

Fork the repository: https://github.com/quarkiverse/quarkus-google-cloud-services
Update the pom.xml to use Quarkus version 999-SNAPSHOT
Build everything: mvn clean install -DskipTests
Build the native executable the main integration test :

cd integration-test/main
mvn clean package -DskipTests -Pnative

Output of uname -a or ver

Linux

Output of java -version

11

GraalVM version (if different from Java)

22.1

Quarkus version or git rev

main

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.8

Additional information

The repo uses a Google provided native image support library: https://github.com/GoogleCloudPlatform/native-image-support-java

@loicmathieu loicmathieu added the kind/bug Something isn't working label May 11, 2022
@zakkak zakkak self-assigned this May 11, 2022
@zakkak
Copy link
Contributor

zakkak commented May 13, 2022

I tried this with Quarkus 2.9.0.Final and 22.0 and it works as expected, while with 22.1 it fails. So as a first step @gsmet we might want to reconsider the backport of #25366 to 2.9.1.

The issue is already reported upstream as well oracle/graal#4543

@loicmathieu
Copy link
Contributor Author

I think I understand what's going on.

Google native image support have this dependency:

    <dependency>
      <groupId>org.graalvm.nativeimage</groupId>
      <artifactId>svm</artifactId>
      <version>${graalvm.version}</version>
      <scope>provided</scope>
    </dependency>

It's provided but as we switch to the new artifact org.graalvm.sdk:graal-sdk:jar:22.1.0:compile the Google support may not work correctly.

I'll open an issue on there side for us to migrate to the new artifact.

@loicmathieu
Copy link
Contributor Author

They are aware of the issue at Google side and someone already report it for Camel Quarkus, see GoogleCloudPlatform/native-image-support-java#393

@zakkak
Copy link
Contributor

zakkak commented May 13, 2022

@loicmathieu there is no switch from org.graalvm.nativeimage:svm to org.graalvm.sdk:graal-sdk:jar we still need both, but the former is not released for 22.1.0 yet (see oracle/graal#4518) so that's why we are stll using 22.0.0.2 for that artifact.

This, however, shouldn't cause any issues (see #25366 (comment)).

I am still investigating it but I believe that this is a GraalVM bug.

@loicmathieu
Copy link
Contributor Author

@zakkak thanks, I mis-understood it. This will be a blocker for Quarkus 2.10 platform release.

@gsmet
Copy link
Member

gsmet commented May 15, 2022

Can we work around it? Because I doubt we will have a fix in GraalVM by then and AFAICS it should just be about making a class runtime initialized?
I certainly don't want to go back to 22.0 for 2.10.

@loicmathieu
Copy link
Contributor Author

@gsmet I'll try to dig a little deeper tomorrow on this one but it seems to be an issue on GraalVM 22.1, Google team is working on it and the stacktrace lead to nothing inside our (or Google's) code base so it may be hard to solve on our side.

I don't know if @zakkak had some time to have a look as I don't know how to work on this, it didn't seems to be "just about making a class runtime initialized" or maybe but I have no idea which one.

@zakkak
Copy link
Contributor

zakkak commented May 16, 2022

We can work around it this way for now, but it's certainly not a proper fix. Done in #25598

zakkak added a commit to zakkak/quarkus that referenced this issue May 17, 2022
zakkak added a commit to zakkak/quarkus that referenced this issue May 17, 2022
@zakkak
Copy link
Contributor

zakkak commented May 18, 2022

Update: A proper fix has landed in GoogleCloudPlatform/native-image-support-java#395 and is expected to be released this week.

@loicmathieu
Copy link
Contributor Author

The fix has been released, we will know tomorrow if it works as I cannot relaunch the ecosystem CI.

@zakkak
Copy link
Contributor

zakkak commented Jul 20, 2022

@loicmathieu can you please confirm whether this is now fixed?

@loicmathieu
Copy link
Contributor Author

Yes it was ok 2 months ago I forgot to close the issue. Closing it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants