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

Java 17 records don't work in native image with GraalVM 21.3.0 JDK 17 #20891

Closed
Tracked by #21481
michael-simons opened this issue Oct 20, 2021 · 19 comments
Closed
Tracked by #21481
Labels
env/graalvm-java17 Relating to using GraalVM native generation Java 11 kind/bug Something isn't working
Milestone

Comments

@michael-simons
Copy link
Contributor

Describe the bug

Java 17 records don't work with GraalVM 21.3.0 when used as return types of resources that produce application/json. They also fail with SmallRye GraphQL.

In the reproducer I used quarkus-resteasy-jackson because Jackson supports records out of the box without any configuration.

When I create a native image like that with GraalVM 21.3 it works as expected.

public class App {

	public static void main(String[] args) {

		System.out.println(new F("x"));
	}

	static record F(String x) {
	}
}

Expected behavior

Quarkus native should produce a binary.

Actual behavior

Native compilation fails with:

Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:2262)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:2262)
	at java.lang.reflect.RecordComponent.declaredAnnotations(RecordComponent.java:198)
	at java.lang.reflect.RecordComponent.getAnnotation(RecordComponent.java:181)
	at io.smallrye.config.ConfigMappingInterface.getPropertyName(ConfigMappingInterface.java:691)
	at io.smallrye.config.ConfigMappingInterface.getPropertyDef(ConfigMappingInterface.java:622)
	at io.smallrye.config.ConfigMappingInterface.getProperties(ConfigMappingInterface.java:607)
	at io.smallrye.config.ConfigMappingInterface.createConfigurationInterface(ConfigMappingInterface.java:564)
	at io.smallrye.config.ConfigMappingInterface.access$000(ConfigMappingInterface.java:27)
	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:32)
	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:30)
	at com.oracle.svm.core.jdk.Target_java_lang_ClassValue.get(JavaLangSubstitutions.java:596)
	at io.quarkus.runtime.configuration.Substitutions$Target_ConfigMappingInterface.getConfigurationInterface(Substitutions.java:86)
	at io.smallrye.config.ConfigMappingContext.lambda$getKeyConverter$6(ConfigMappingContext.java:142)
	at io.smallrye.config.ConfigMappingContext$$Lambda$1290/0x00000007c1585240.apply(Unknown Source)
	at sun.security.ec.ParametersMap$1.get(ParametersMap.java:78)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:216)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:169)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:287)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY_System_getProperty_deeeaa72a006d330408a3b7d002c7533e108bc28(generated:0)

How to Reproduce?

Given the following dependency:

<dependency>
	<groupId>io.quarkus</groupId>
	<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>

This record:

public record Thing(String name) {
}

and the following resource

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class ExampleResource {

	@GET
	@Produces(MediaType.APPLICATION_JSON)
	public Thing hello() {
		return new Thing("Hello RESTEasy");
	}
}

A request like curl localhost:8080/hello returns

{"name":"Hello RESTEasy"}

The whole project is here: restrecords.zip

Reproduce with

 ./mvnw clean package -Pnative

on GraalVM 21.3 Java 17

An example using SmallRye GraphQL is available here: https://github.com/michael-simons/neo4j-aura-quarkus-graphql/tree/jdk17

Output of uname -a or ver

Darwin bs62.XXX 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)

GraalVM version (if different from Java)

21.3.0

Quarkus version or git rev

2.3.0

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

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

Additional information

No response

@michael-simons michael-simons added the kind/bug Something isn't working label Oct 20, 2021
@robp94
Copy link
Contributor

robp94 commented Oct 20, 2021

smallrye/smallrye-graphql#1045 Record support for graphql is not yet in quarkus. And you need some extra config.

@michael-simons
Copy link
Contributor Author

The GraphQL example works in JVM mode.

but don't let yourself distracte from the GraphQL thing, it happens with pure REST as well (even with Jackson, which supports records ootb)

@luiguip
Copy link

luiguip commented Oct 23, 2021

I added --report-unsupported-elements-at-runtime to quarkus.native.additional-build-args on the pom.xml and It worked.
At github of graalvm have an issue where it's recommended: oracle/graal#3125.

@michael-simons
Copy link
Contributor Author

Well, that will eventually lead to a failure during runtime, wouldn't it? Not what I desire :)

@geoand
Copy link
Contributor

geoand commented Nov 3, 2021

@zakkak this is still an issue with the released version of 21.3. Do you know anything about this?

@zakkak
Copy link
Contributor

zakkak commented Nov 3, 2021

@geoand not much.

After looking a bit into it, it appears to be an issue with smallrye-config not being native-image friendly and not with Java records support in GraalVM or Quarkus.

GraalVM doesn't provide java.lang.Class.getConstantPool(), yet smallrye-config somehow ends up invoking it judging by the stacktrace.

Two options I see are:

  1. Find why smallrye-config ends up following that path for a record, is this by mistake?
  2. Susbstitute one of the methods in the call-tree to avoid the issue (probably by stopping early when working on a record?).

HTH

@geoand
Copy link
Contributor

geoand commented Nov 3, 2021

@radcortez ^

Thanks @zakkak

@radcortez
Copy link
Member

I'll have a look.

@zakkak
Copy link
Contributor

zakkak commented Nov 3, 2021

After posting the above answer I got another idea to try and toying around a bit more with records and GraalVM 21.3 I was able to replicate the issue without Quarkus or smallrye.

You can find the reproducer here https://github.com/zakkak/issue-reproducers/tree/record-annotations-21.3

I am going to have a better look and open an upstream issue after all.

@radcortez sorry for the false alarm

@geoand
Copy link
Contributor

geoand commented Nov 3, 2021

Very interesting @zakkak. Do you plan to open an issue on GraalVM?

@zakkak
Copy link
Contributor

zakkak commented Nov 3, 2021

Upstream GraalVM issue: oracle/graal#3984

@crilofer
Copy link

Same issue here. Working adding --report-unsupported-elements-at-runtime but shouldn't be the best option IMO...

@maxandersen maxandersen mentioned this issue Nov 16, 2021
11 tasks
@zakkak zakkak added the env/graalvm-java17 Relating to using GraalVM native generation Java 11 label Nov 17, 2021
@michael-simons
Copy link
Contributor Author

A bit of more information and less dependencies:

Given

package org.acme;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class GreetingResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        System.out.printf(new Thing("asd").toString());
        return "Hello RESTEasy";
    }
}

and Thing being a record:

package org.acme;

import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection
public record Thing(String aValue) {
}

things fail.

This happens as soon as a record is registered for reflection with one or the other mechanism. Quarkus 2.7.1, GraalVM 21.3 Java17.

Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:2262)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:2262)
	at java.lang.reflect.RecordComponent.declaredAnnotations(RecordComponent.java:198)
	at java.lang.reflect.RecordComponent.getAnnotation(RecordComponent.java:181)
	at io.smallrye.config.ConfigMappingInterface.getPropertyName(ConfigMappingInterface.java:762)
	at io.smallrye.config.ConfigMappingInterface.getPropertyDef(ConfigMappingInterface.java:667)
	at io.smallrye.config.ConfigMappingInterface.getProperties(ConfigMappingInterface.java:647)
	at io.smallrye.config.ConfigMappingInterface.createConfigurationInterface(ConfigMappingInterface.java:604)
	at io.smallrye.config.ConfigMappingInterface.access$000(ConfigMappingInterface.java:27)
	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:32)
	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:30)
	at com.oracle.svm.core.jdk.Target_java_lang_ClassValue.get(JavaLangSubstitutions.java:596)
	at io.quarkus.runtime.configuration.Substitutions$Target_ConfigMappingInterface.getConfigurationInterface(Substitutions.java:86)
	at io.smallrye.config.ConfigMappingContext.lambda$getKeyConverter$6(ConfigMappingContext.java:142)
	at io.smallrye.config.ConfigMappingContext$$Lambda$1186/0x00000007c14b5170.apply(Unknown Source)
	at sun.security.ec.ParametersMap$1.get(ParametersMap.java:78)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:216)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:169)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:287)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY_System_getProperty_deeeaa72a006d330408a3b7d002c7533e108bc28(generated:0)

com.oracle.svm.core.util.UserError$UserException: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:2262)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:2262)
	at java.lang.reflect.RecordComponent.declaredAnnotations(RecordComponent.java:198)
	at java.lang.reflect.RecordComponent.getAnnotation(RecordComponent.java:181)
	at io.smallrye.config.ConfigMappingInterface.getPropertyName(ConfigMappingInterface.java:762)
	at io.smallrye.config.ConfigMappingInterface.getPropertyDef(ConfigMappingInterface.java:667)
	at io.smallrye.config.ConfigMappingInterface.getProperties(ConfigMappingInterface.java:647)
	at io.smallrye.config.ConfigMappingInterface.createConfigurationInterface(ConfigMappingInterface.java:604)
	at io.smallrye.config.ConfigMappingInterface.access$000(ConfigMappingInterface.java:27)
	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:32)
	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:30)
	at com.oracle.svm.core.jdk.Target_java_lang_ClassValue.get(JavaLangSubstitutions.java:596)
	at io.quarkus.runtime.configuration.Substitutions$Target_ConfigMappingInterface.getConfigurationInterface(Substitutions.java:86)
	at io.smallrye.config.ConfigMappingContext.lambda$getKeyConverter$6(ConfigMappingContext.java:142)
	at io.smallrye.config.ConfigMappingContext$$Lambda$1186/0x00000007c14b5170.apply(Unknown Source)
	at sun.security.ec.ParametersMap$1.get(ParametersMap.java:78)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:216)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:169)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:287)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY_System_getProperty_deeeaa72a006d330408a3b7d002c7533e108bc28(generated:0)

	at com.oracle.svm.core.util.UserError.abort(UserError.java:87)
	at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:759)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:529)
	at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:2262)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:2262)
	at java.lang.reflect.RecordComponent.declaredAnnotations(RecordComponent.java:198)
	at java.lang.reflect.RecordComponent.getAnnotation(RecordComponent.java:181)
	at io.smallrye.config.ConfigMappingInterface.getPropertyName(ConfigMappingInterface.java:762)
	at io.smallrye.config.ConfigMappingInterface.getPropertyDef(ConfigMappingInterface.java:667)
	at io.smallrye.config.ConfigMappingInterface.getProperties(ConfigMappingInterface.java:647)
	at io.smallrye.config.ConfigMappingInterface.createConfigurationInterface(ConfigMappingInterface.java:604)
	at io.smallrye.config.ConfigMappingInterface.access$000(ConfigMappingInterface.java:27)
	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:32)
	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:30)
	at com.oracle.svm.core.jdk.Target_java_lang_ClassValue.get(JavaLangSubstitutions.java:596)
	at io.quarkus.runtime.configuration.Substitutions$Target_ConfigMappingInterface.getConfigurationInterface(Substitutions.java:86)
	at io.smallrye.config.ConfigMappingContext.lambda$getKeyConverter$6(ConfigMappingContext.java:142)
	at io.smallrye.config.ConfigMappingContext$$Lambda$1186/0x00000007c14b5170.apply(Unknown Source)
	at sun.security.ec.ParametersMap$1.get(ParametersMap.java:78)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:216)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:169)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:287)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY_System_getProperty_deeeaa72a006d330408a3b7d002c7533e108bc28(generated:0)

	at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:756)
	... 6 more
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:188)
	at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:140)
	at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:140)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:414)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupMethod(WrappedConstantPool.java:125)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethodInPool(BytecodeParser.java:4350)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.lookupMethodInPool(SharedGraphBuilderPhase.java:140)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:4344)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeVirtual(BytecodeParser.java:1718)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5417)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3477)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3437)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3282)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1145)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:81)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:212)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:132)
	at com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:621)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:163)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:321)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.createTypeFlow(MethodTypeFlow.java:293)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureTypeFlowCreated(MethodTypeFlow.java:282)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
	at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:222)
	at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:490)
	at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:559)
	at com.oracle.graal.pointsto.PointsToAnalysis$2.run(PointsToAnalysis.java:595)
	at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:188)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:172)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5783]      [total]:  21.563,19 ms,  5,06 GB
# Printing build artifacts to: /Users/msimons/Downloads/code-with-quarkus 3/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner.build_artifacts.txt

@Aleksandr-Filichkin
Copy link

any progress so far?

@jorsol
Copy link
Contributor

jorsol commented Mar 18, 2022

any progress so far?

haven't tested myself, but it looks like Mandrel 21.3.1.1 fixes this issue:
https://github.com/graalvm/mandrel/releases/tag/mandrel-21.3.1.1-Final

@jerboaa
Copy link
Contributor

jerboaa commented Mar 25, 2022

Upstream Graal VM will have this fixed in 21.3.2 and 22.1 releases (April 2022). Mandrel included this fix in 21.3.1.1-Final early, but will sync with upstream in April.

@juanmbellini
Copy link

juanmbellini commented Apr 4, 2022

In my case I have the issue when instantiating a record. If record is declared, but the instantiation is not called, then native-image works. In fact, using a JSON as a response (i.e which will be deserialized), works perfectly well.

@pjgg
Copy link
Contributor

pjgg commented May 4, 2022

package org.acme;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class GreetingResource {

   @GET
   @Produces(MediaType.TEXT_PLAIN)
   public String hello() {
       System.out.printf(new Thing("asd").toString());
       return "Hello RESTEasy";
   }
}

Based on the above reproducer given by @michael-simons I could reproduce it with ubi-quarkus-mandrel:21.3.0.0-Final-java17

Fails: mvn clean package -Pnative -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel:21.3.0.0-Final-java17 -Dquarkus.platform.version=2.7.5.Final

Is fixed if you use ubi-quarkus-mandrel:21.3.1.1-Final-java17 as a build base image

Works: mvn clean package -Pnative -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel:21.3.1.1-Final-java17 -Dquarkus.platform.version=2.7.5.Final

Or directly you can use ubi-quarkus-mandrel:21.3-java17

@geoand
Copy link
Contributor

geoand commented May 17, 2022

Closing this as Quarkus 2.10 will use GraalVM 22.1.

@geoand geoand closed this as completed May 17, 2022
Repository owner moved this from Todo to Done in Quarkus Roadmap/Planning May 17, 2022
@geoand geoand added this to the 2.10 - main milestone May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
env/graalvm-java17 Relating to using GraalVM native generation Java 11 kind/bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests