square / retrofit

A type-safe HTTP client for Android and the JVM
https://square.github.io/retrofit/
Apache License 2.0
43.1k stars 7.3k forks source link

kotlin.coroutines.Continuation issue, maybe just error on graalvm #4180

Open liuziyuan opened 4 months ago

liuziyuan commented 4 months ago

I wrote a quarkis extension for retorfit in the quarkis framework, and it worked fine with local compilation and UT. However, during the Github CI process, I found that the integration test UT was incorrect. in my local :jvm is temurin-17 I want to know the reason for this anomaly

This is github auto CI CI Link

and This is the error message

GraalVM Native Image: Generating 'quarkus-easy-retrofit-integration-tests-1.0.0-runner' (executable)...

For detailed information and explanations on the build output, visit: https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md

[1/8] Initializing... (6.4s @ 0.19GB) Java version: 21.0.3+9-LTS, vendor version: Mandrel-23.1.3.1-Final Graal compiler: optimization level: 2, target machine: x86-64-v3 C compiler: gcc (redhat, x86_64, 8.5.0) Garbage collector: Serial GC (max heap size: 80% of RAM) 3 user-specific feature(s):

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.HttpServiceMethod$SuspendForBody is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.HttpServiceMethod$SuspendForBody.adapt(HttpServiceMethod.java:215) Parsing context: at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.HttpServiceMethod$SuspendForResponse is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.HttpServiceMethod$SuspendForResponse.adapt(HttpServiceMethod.java:183) Parsing context: at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.RequestFactory$Builder is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.RequestFactory$Builder.build(RequestFactory.java:180) Parsing context: at retrofit2.RequestFactory.parseAnnotations(RequestFactory.java:67) at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:26) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:202) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

com.oracle.svm.core.util.UserError$UserException: Unsupported features in 4 methods Detailed message: Error: Discovered unresolved type during parsing: kotlin.Unit. This error is reported at image build time because class retrofit2.BuiltInConverters is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.BuiltInConverters.responseBodyConverter(BuiltInConverters.java:34) Parsing context: at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:362) at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:124) at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:85) at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:39) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:202) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.HttpServiceMethod$SuspendForBody is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.HttpServiceMethod$SuspendForBody.adapt(HttpServiceMethod.java:215) Parsing context: at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.HttpServiceMethod$SuspendForResponse is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.HttpServiceMethod$SuspendForResponse.adapt(HttpServiceMethod.java:183) Parsing context: at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.RequestFactory$Builder is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.RequestFactory$Builder.build(RequestFactory.java:180) Parsing context: at retrofit2.RequestFactory.parseAnnotations(RequestFactory.java:67) at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:26) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:202) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:248)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:814)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:592)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)

Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 4 methods Detailed message: Error: Discovered unresolved type during parsing: kotlin.Unit. This error is reported at image build time because class retrofit2.BuiltInConverters is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.BuiltInConverters.responseBodyConverter(BuiltInConverters.java:34) Parsing context: at retrofit2.Retrofit.nextResponseBodyConverter(Retrofit.java:362) at retrofit2.HttpServiceMethod.createResponseConverter(HttpServiceMethod.java:124) at retrofit2.HttpServiceMethod.parseAnnotations(HttpServiceMethod.java:85) at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:39) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:202) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.HttpServiceMethod$SuspendForBody is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.HttpServiceMethod$SuspendForBody.adapt(HttpServiceMethod.java:215) Parsing context: at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.HttpServiceMethod$SuspendForResponse is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.HttpServiceMethod$SuspendForResponse.adapt(HttpServiceMethod.java:183) Parsing context: at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

Error: Discovered unresolved type during parsing: kotlin.coroutines.Continuation. This error is reported at image build time because class retrofit2.RequestFactory$Builder is registered for linking at image build time by command line and command line. Error encountered while parsing retrofit2.RequestFactory$Builder.build(RequestFactory.java:180) Parsing context: at retrofit2.RequestFactory.parseAnnotations(RequestFactory.java:67) at retrofit2.ServiceMethod.parseAnnotations(ServiceMethod.java:26) at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:202) at retrofit2.Retrofit$1.invoke(Retrofit.java:160) at jdk.proxy4.$Proxy111.annotationType(Unknown Source) at root method.(Unknown Source)

at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:809)
... 6 more
    4 native libraries: dl, pthread, rt, z

                   6.5s (12.4% of total time) in 112 GCs | Peak RSS: 2.07GB | CPU load: 3.75

======================================================================================================================== Finished generating 'quarkus-easy-retrofit-integration-tests-1.0.0-runner' in 52.0s. [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for Quarkus Easy Retrofit - Parent 1.0.0: [INFO] [INFO] Quarkus Easy Retrofit - Parent ..................... SUCCESS [ 0.996 s] [INFO] Quarkus Easy Retrofit - Runtime .................... SUCCESS [ 2.317 s] [INFO] Quarkus Easy Retrofit - Deployment ................. SUCCESS [ 5.564 s] [INFO] Quarkus Easy Retrofit - Documentation .............. SUCCESS [ 4.668 s] [INFO] Quarkus Easy Retrofit - Integration Tests .......... FAILURE [01:10 min] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:24 min [INFO] Finished at: 2024-06-28T06:34:28Z [INFO] ------------------------------------------------------------------------ Error: Failed to execute goal io.quarkus:quarkus-maven-plugin:3.10.1:build (default) on project quarkus-easy-retrofit-integration-tests: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors Error: [ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1 Error: at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:468) Error: at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:258) Error: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Error: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) Error: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) Error: at java.base/java.lang.reflect.Method.invoke(Method.java:568) Error: at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849) Error: at io.quarkus.builder.BuildContext.run(BuildContext.java:256) Error: at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) Error: at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) Error: at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) Error: at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) Error: at java.base/java.lang.Thread.run(Thread.java:840) Error: at org.jboss.threads.JBossThread.run(JBossThread.java:483) Error: -> [Help 1] Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch. Error: Re-run Maven using the -X switch to enable full debug logging. Error:
Error: For more information about the errors and possible solutions, please read the following articles: Error: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Error:
Error: After correcting the problems, you can resume the build with the command Error: mvn -rf :quarkus-easy-retrofit-integration-tests Error: Process completed with exit code 1.

JakeWharton commented 4 months ago

The listed types are optional for conditional Kotlin support. You can safely tell GraalVM to ignore them, assuming that's a possibility.

liuziyuan commented 3 months ago

added this dependency could fix this issue

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-kotlin-deployment</artifactId>
        </dependency>