aws-sdk-kotlin
aws-sdk-kotlin copied to clipboard
AWS Kotlin SDK Does Not Work With GraalVM
Describe the bug
When creating a static native image using GraalVM, we get runtime errors that seem to relate to the AWS Kotlin SDK.
Expected behavior
We are able to build and run native images that use the AWS Kotlin SDK.
Current behavior
We can create a static native image but we get an exception at runtime.
Steps to Reproduce
- Create a simple kotlin application (no web framework, just a main) that uses the aws sdk to perform a get and a put request.
- Create a fat jar
- Run the java native image agent to generate GraalVM config files, store them under the folder
META-INF/native-image
- Create a static native image using the following command :
native-image \
--static \
--no-fallback \
--install-exit-handlers \
--allow-incomplete-classpath \
--initialize-at-build-time=kotlinx,kotlin \
-H:+ReportUnsupportedElementsAtRuntime \
-H:+ReportExceptionStackTraces \
-cp ./your-backend-1.0.0-all.jar \
-H:ConfigurationFileDirectories=./META-INF \
-H:Class=MainKt \
-H:Name=your-backend
- Execute the application
- Notice how the appliation starts normally but after performing requests we get a runtime exception
Unable to unpack AWS CRT lib: java.io.IOException: Unable to open library in jar for AWS CRT: /linux/x86_64/libaws-crt-jni.so
java.io.IOException: Unable to open library in jar for AWS CRT: /linux/x86_64/libaws-crt-jni.so
at software.amazon.awssdk.crt.CRT.extractAndLoadLibrary(CRT.java:155)
at software.amazon.awssdk.crt.CRT.loadLibraryFromJar(CRT.java:220)
at software.amazon.awssdk.crt.CRT.<clinit>(CRT.java:33)
at software.amazon.awssdk.crt.CrtResource.<clinit>(CrtResource.java:103)
at java.lang.Class.ensureInitialized(DynamicHub.java:510)
at aws.sdk.kotlin.crt.auth.signing.AwsSignerJVMKt.into(AwsSignerJVM.kt:75)
at aws.sdk.kotlin.crt.auth.signing.AwsSignerJVMKt.access$into(AwsSignerJVM.kt:1)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invokeSuspend(AwsSignerJVM.kt:47)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invoke(AwsSignerJVM.kt)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invoke(AwsSignerJVM.kt)
at aws.sdk.kotlin.crt.CrtExceptionUtilKt.asyncCrtJniCall(CrtExceptionUtil.kt:27)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner.sign(AwsSignerJVM.kt:46)
at aws.sdk.kotlin.runtime.auth.signing.AwsSigV4SigningMiddleware.modifyRequest(AwsSigV4SigningMiddleware.kt:161)
at aws.sdk.kotlin.runtime.auth.signing.AwsSigV4SigningMiddleware.modifyRequest(AwsSigV4SigningMiddleware.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:64)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.MutateHandler.call(SdkOperationExecution.kt:131)
at aws.smithy.kotlin.runtime.http.operation.MutateHandler.call(SdkOperationExecution.kt:128)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invokeSuspend(Retry.kt:51)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invoke(Retry.kt)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invoke(Retry.kt)
at aws.smithy.kotlin.runtime.retries.StandardRetryStrategy.doTryLoop(StandardRetryStrategy.kt:51)
at aws.smithy.kotlin.runtime.retries.StandardRetryStrategy.retry(StandardRetryStrategy.kt:32)
at aws.smithy.kotlin.runtime.http.middleware.Retry.handle(Retry.kt:36)
at aws.smithy.kotlin.runtime.http.middleware.Retry.handle(Retry.kt:25)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:64)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.SerializeHandler.call(SdkOperationExecution.kt:124)
at aws.smithy.kotlin.runtime.http.operation.SerializeHandler.call(SdkOperationExecution.kt:107)
at aws.smithy.kotlin.runtime.http.operation.InitializeHandler.call(SdkOperationExecution.kt:104)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:60)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.SdkHttpOperationKt.execute(SdkHttpOperation.kt:83)
at aws.sdk.kotlin.services.s3.DefaultS3Client.getObject(DefaultS3Client.kt:2919)
at com.mdai.backend.datasources.inputs.InputArtifactsHttpDataSource$getInputs$2.invokeSuspend(InputArtifactsHttpDataSource.kt:28)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:597)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:194)
19:33:16.225 [DefaultDispatcher-worker-1] DEBUG Retry - sdkRequestId: 0767b6e8-dd00-415f-8f10-d7ddb434eb5c; service: S3; operation: GetObject; - request failed with non-retryable error
Exception in thread "main" java.lang.ExceptionInInitializerError
at software.amazon.awssdk.crt.CrtResource.<clinit>(CrtResource.java:103)
at java.lang.Class.ensureInitialized(DynamicHub.java:510)
at aws.sdk.kotlin.crt.auth.signing.AwsSignerJVMKt.into(AwsSignerJVM.kt:75)
at aws.sdk.kotlin.crt.auth.signing.AwsSignerJVMKt.access$into(AwsSignerJVM.kt:1)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invokeSuspend(AwsSignerJVM.kt:47)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invoke(AwsSignerJVM.kt)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invoke(AwsSignerJVM.kt)
at aws.sdk.kotlin.crt.CrtExceptionUtilKt.asyncCrtJniCall(CrtExceptionUtil.kt:27)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner.sign(AwsSignerJVM.kt:46)
at aws.sdk.kotlin.runtime.auth.signing.AwsSigV4SigningMiddleware.modifyRequest(AwsSigV4SigningMiddleware.kt:161)
at aws.sdk.kotlin.runtime.auth.signing.AwsSigV4SigningMiddleware.modifyRequest(AwsSigV4SigningMiddleware.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:64)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.MutateHandler.call(SdkOperationExecution.kt:131)
at aws.smithy.kotlin.runtime.http.operation.MutateHandler.call(SdkOperationExecution.kt:128)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invokeSuspend(Retry.kt:51)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invoke(Retry.kt)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invoke(Retry.kt)
at aws.smithy.kotlin.runtime.retries.StandardRetryStrategy.doTryLoop(StandardRetryStrategy.kt:51)
at aws.smithy.kotlin.runtime.retries.StandardRetryStrategy.retry(StandardRetryStrategy.kt:32)
at aws.smithy.kotlin.runtime.http.middleware.Retry.handle(Retry.kt:36)
at aws.smithy.kotlin.runtime.http.middleware.Retry.handle(Retry.kt:25)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:64)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.SerializeHandler.call(SdkOperationExecution.kt:124)
at aws.smithy.kotlin.runtime.http.operation.SerializeHandler.call(SdkOperationExecution.kt:107)
at aws.smithy.kotlin.runtime.http.operation.InitializeHandler.call(SdkOperationExecution.kt:104)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:60)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.SdkHttpOperationKt.execute(SdkHttpOperation.kt:83)
at aws.sdk.kotlin.services.s3.DefaultS3Client.getObject(DefaultS3Client.kt:2919)
at com.mdai.backend.datasources.inputs.InputArtifactsHttpDataSource$getInputs$2.invokeSuspend(InputArtifactsHttpDataSource.kt:28)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:597)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:194)
Caused by: software.amazon.awssdk.crt.CrtRuntimeException: software.amazon.awssdk.crt.CrtRuntimeException: Unable to unpack AWS CRT library UNKNOWN(-1) UNKNOWN(-1)
at software.amazon.awssdk.crt.CRT.loadLibraryFromJar(CRT.java:230)
at software.amazon.awssdk.crt.CRT.<clinit>(CRT.java:33)
... 49 more
Possible Solution
Provide the necessary configuration missing (reflection config or jni config) for GraalVM to work.
Context
Tested with GraalVM 22.0.0.2 java 11 and GraalVM 22.0.0.2 java 17, both yield same result.
AWS Kotlin SDK version used
0.14.2-beta
Platform (JVM/JS/Native)
JVM/Native
Operating System and version
Ubuntu 20.04.3 LTS
FYI setting --initialize-at-build-time=software.amazon.awssdk.crt,kotlinx,kotlin
gives a different error message at runtime :
19:40:43.428 [DefaultDispatcher-worker-1] DEBUG Retry - sdkRequestId: 79b44a45-0cbe-4f30-a04e-814beb02f797; service: S3; operation: GetObject; - request failed with non-retryable error
Exception in thread "main" java.lang.UnsatisfiedLinkError: software.amazon.awssdk.crt.auth.signing.AwsSigner.awsSignerSignRequest(Lsoftware/amazon/awssdk/crt/http/HttpRequest;[BLsoftware/amazon/awssdk/crt/auth/signing/AwsSigningConfig;Ljava/util/concurrent/CompletableFuture;)V [symbol: Java_software_amazon_awssdk_crt_auth_signing_AwsSigner_awsSignerSignRequest or Java_software_amazon_awssdk_crt_auth_signing_AwsSigner_awsSignerSignRequest__Lsoftware_amazon_awssdk_crt_http_HttpRequest_2_3BLsoftware_amazon_awssdk_crt_auth_signing_AwsSigningConfig_2Ljava_util_concurrent_CompletableFuture_2]
at com.oracle.svm.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:153)
at com.oracle.svm.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:57)
at software.amazon.awssdk.crt.auth.signing.AwsSigner.awsSignerSignRequest(AwsSigner.java)
at software.amazon.awssdk.crt.auth.signing.AwsSigner.sign(AwsSigner.java:76)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invokeSuspend(AwsSignerJVM.kt:47)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invoke(AwsSignerJVM.kt)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner$sign$2.invoke(AwsSignerJVM.kt)
at aws.sdk.kotlin.crt.CrtExceptionUtilKt.asyncCrtJniCall(CrtExceptionUtil.kt:27)
at aws.sdk.kotlin.crt.auth.signing.AwsSigner.sign(AwsSignerJVM.kt:46)
at aws.sdk.kotlin.runtime.auth.signing.AwsSigV4SigningMiddleware.modifyRequest(AwsSigV4SigningMiddleware.kt:161)
at aws.sdk.kotlin.runtime.auth.signing.AwsSigV4SigningMiddleware.modifyRequest(AwsSigV4SigningMiddleware.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:64)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.MutateHandler.call(SdkOperationExecution.kt:131)
at aws.smithy.kotlin.runtime.http.operation.MutateHandler.call(SdkOperationExecution.kt:128)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invokeSuspend(Retry.kt:51)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invoke(Retry.kt)
at aws.smithy.kotlin.runtime.http.middleware.Retry$handle$outcome$1.invoke(Retry.kt)
at aws.smithy.kotlin.runtime.retries.StandardRetryStrategy.doTryLoop(StandardRetryStrategy.kt:51)
at aws.smithy.kotlin.runtime.retries.StandardRetryStrategy.retry(StandardRetryStrategy.kt:32)
at aws.smithy.kotlin.runtime.http.middleware.Retry.handle(Retry.kt:36)
at aws.smithy.kotlin.runtime.http.middleware.Retry.handle(Retry.kt:25)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.ModifyRequestMiddleware.handle(ModifyRequest.kt:24)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:64)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.SerializeHandler.call(SdkOperationExecution.kt:124)
at aws.smithy.kotlin.runtime.http.operation.SerializeHandler.call(SdkOperationExecution.kt:107)
at aws.smithy.kotlin.runtime.http.operation.InitializeHandler.call(SdkOperationExecution.kt:104)
at aws.smithy.kotlin.runtime.io.middleware.Phase.handle(Phase.kt:60)
at aws.smithy.kotlin.runtime.io.middleware.DecoratedHandler.call(Middleware.kt:40)
at aws.smithy.kotlin.runtime.http.operation.SdkHttpOperationKt.execute(SdkHttpOperation.kt:83)
at aws.sdk.kotlin.services.s3.DefaultS3Client.getObject(DefaultS3Client.kt:2919)
at com.mdai.backend.datasources.inputs.InputArtifactsHttpDataSource$getInputs$2.invokeSuspend(InputArtifactsHttpDataSource.kt:28)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:597)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:194)
Hi @AlexandreBrown, thanks for the issue report. Currently the AWS SDK for Kotlin does not support GraalVM although we'd like to in the future. We believe that running the SDK with the CRT on GraalVM will likely require build configuration changes to aws-crt-java in order to work.
That being said, we are actively working on removing the CRT as a hard requirement for the SDK. Once those changes are complete, it'll be much simpler to offer GraalVM support.
We'll leave this open as a tracking issue and other users can 👍 to vote for its prioritization.
Useful info for setting up graal native tests when we get around to this:
- https://medium.com/graalvm/gradle-and-maven-plugins-for-native-image-with-initial-junit-testing-support-dde00a8caf0b
- https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html
I have not verified anything but it's worth mentioning that the CRT is no longer a hard dependency in the default configuration of the SDK. If you tried to create a native image before and got stuck on CRT/linking issues maybe give it another go and report back what you find.
Has anyone tried this with the GA release? 🤔
@zeletrik I tried to build a Kotlin (w/ Quarkus) application, using AWS Kotlin SDK v1.0.51, and here is the output:
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/io.netty/netty-transport/reflection-config.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: Please re-evaluate whether any experimental option is required, and either remove or unlock it. The build output lists all active experimental options, including where they come from and possible alternatives. If you think an experimental option should be considered as stable, please file an issue.
========================================================================================================================
GraalVM Native Image: Generating 'api-0.0.1-SNAPSHOT-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... (5.7s @ 0.33GB)
Java version: 21.0.2+13, vendor version: GraalVM CE 21.0.2+13.1
Graal compiler: optimization level: 2, target machine: x86-64-v3
C compiler: gcc (linux, x86_64, 11.4.0)
Garbage collector: Serial GC (max heap size: 80% of RAM)
3 user-specific feature(s):
- com.oracle.svm.thirdparty.gson.GsonFeature
- io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
- io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
------------------------------------------------------------------------------------------------------------------------
4 experimental option(s) unlocked:
- '-H:+AllowFoldMethods' (origin(s): command line)
- '-H:BuildOutputJSONFile' (origin(s): command line)
- '-H:-UseServiceLoaderFeature' (origin(s): command line)
- '-H:ReflectionConfigurationResources' (origin(s): 'META-INF/native-image/io.netty/netty-transport/native-image.properties' in 'file:///home/clement.guillot/sources/nx-cloud-ce/apps/api/build/api-0.0.1-SNAPSHOT-native-image-source-jar/lib/io.netty.netty-transport-4.1.100.Final.jar')
------------------------------------------------------------------------------------------------------------------------
Build resources:
- 26.49GB of memory (42.2% of 62.72GB system memory, determined at start)
- 16 thread(s) (100.0% of 16 available processor(s), determined at start)
17:51:58,269 INFO [org.mon.dri.authenticator] Using built-in driver implementation to retrieve AWS credentials. Consider adding a dependency to AWS SDK v2's software.amazon.awssdk:auth artifact to get access to additional AWS authentication functionality.
[2/8] Performing analysis... [*****] (29.7s @ 4.39GB)
20,553 reachable types (89.4% of 22,987 total)
29,028 reachable fields (63.1% of 45,987 total)
100,891 reachable methods (58.3% of 172,965 total)
6,003 types, 337 fields, and 4,906 methods registered for reflection
61 types, 61 fields, and 55 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
Error: Unsupported features in 2 methods
Detailed message:
Error: Discovered unresolved method during parsing: okhttp3.Request$Builder.tag(kotlin.reflect.KClass, java.lang.Object). This error is reported at image build time because class aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpUtilsKt is registered for linking at image build time by command line and command line.
Error encountered while parsing aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine.roundTrip(OkHttpEngine.kt)
Parsing context:
at aws.smithy.kotlin.runtime.http.SdkHttpClient$executeWithCallContext$2.invokeSuspend(SdkHttpClient.kt:44)
at aws.smithy.kotlin.runtime.http.SdkHttpClient$executeWithCallContext$2.invoke(SdkHttpClient.kt)
at aws.smithy.kotlin.runtime.http.SdkHttpClient$executeWithCallContext$2.invoke(SdkHttpClient.kt)
at aws.sdk.kotlin.services.s3.endpoints.internal.EndpointResolverAdapterKt.resolveEndpointParams(EndpointResolverAdapter.kt:124)
------------------------------------------------------------------------------------------------------------------------
at aws.sdk.kotlin.services.s3.endpoints.internal.EndpointResolverAdapter.resolve(EndpointResolverAdapter.kt:111)
at aws.smithy.kotlin.runtime.auth.awssigning.PresignerKt.presignRequest(Presigner.kt:34)
at aws.sdk.kotlin.services.s3.presigners.PresignersKt.presignGetObject(Presigners.kt:52)
at aws.sdk.kotlin.services.s3.presigners.PresignersKt.presignGetObject-exY8QGI(Presigners.kt:30)
at org.nxcloudce.api.storage.s3.S3Repository.generateGetUrl(S3Repository.kt:26)
...
Error: Discovered unresolved method during parsing: okio.BufferedSink.getBuffer(). This error is reported at image build time because class aws.smithy.kotlin.runtime.io.AbstractBufferedSinkAdapter is registered for linking at image build time by command line and command line.
Error encountered while parsing aws.smithy.kotlin.runtime.io.AbstractBufferedSinkAdapter.getBuffer(BufferedSinkAdapter.kt:21)
Parsing context:
at aws.smithy.kotlin.runtime.io.SdkByteReadChannelKt$readAll$2.invokeSuspend(SdkByteReadChannel.kt:111)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:179)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:168)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:474)
at kotlinx.coroutines.CancellableContinuationImpl.cancel(CancellableContinuationImpl.kt:217)
at kotlinx.coroutines.CancellableContinuationImpl.releaseClaimedReusableContinuation$kotlinx_coroutines_core(CancellableContinuationImpl.kt:364)
at kotlinx.coroutines.CancellableContinuationImpl.getResult(CancellableContinuationImpl.kt:319)
at io.smallrye.mutiny.coroutines.UniKt.awaitSuspending(Uni.kt:87)
at org.nxcloudce.api.presentation.controller.RunController.end$suspendImpl(RunController.kt:64)
at static root method.(Unknown Source)
com.oracle.svm.core.util.UserError$UserException: Unsupported features in 2 methods
Detailed message:
Error: Discovered unresolved method during parsing: okhttp3.Request$Builder.tag(kotlin.reflect.KClass, java.lang.Object). This error is reported at image build time because class aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpUtilsKt is registered for linking at image build time by command line and command line.
Error encountered while parsing aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine.roundTrip(OkHttpEngine.kt)
Parsing context:
at aws.smithy.kotlin.runtime.http.SdkHttpClient$executeWithCallContext$2.invokeSuspend(SdkHttpClient.kt:44)
3.1s (8.6% of total time) in 27 GCs | Peak RSS: 7.70GB | CPU load: 7.78
at aws.smithy.kotlin.runtime.http.SdkHttpClient$executeWithCallContext$2.invoke(SdkHttpClient.kt)
at aws.smithy.kotlin.runtime.http.SdkHttpClient$executeWithCallContext$2.invoke(SdkHttpClient.kt)
at aws.sdk.kotlin.services.s3.endpoints.internal.EndpointResolverAdapterKt.resolveEndpointParams(EndpointResolverAdapter.kt:124)
at aws.sdk.kotlin.services.s3.endpoints.internal.EndpointResolverAdapter.resolve(EndpointResolverAdapter.kt:111)
at aws.smithy.kotlin.runtime.auth.awssigning.PresignerKt.presignRequest(Presigner.kt:34)
at aws.sdk.kotlin.services.s3.presigners.PresignersKt.presignGetObject(Presigners.kt:52)
at aws.sdk.kotlin.services.s3.presigners.PresignersKt.presignGetObject-exY8QGI(Presigners.kt:30)
at org.nxcloudce.api.storage.s3.S3Repository.generateGetUrl(S3Repository.kt:26)
... and so one
All errors have same pattern This error is reported at image build time because class ...... is registered for linking at image build time by command line and command line.
EDIT: all issues where related to Quarkus build which enables --link-at-build-time
when wrapping native-image
command. Works like a charm without this feature!
Hi, I'm happy to share that the latest version of the AWS SDK for Kotlin (v1.2.44) now supports GraalVM native image compilation for both the OkHttpEngine (default) and CrtHttpEngine!
Note that log4j2 does not support GraalVM native image compilation yet, so you may need to change your logging configuration to get it working.
If you run into any problems, please feel free to open a new issue.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.