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

Native image build failure #17343

Closed
rohit-gandhe opened this issue May 19, 2021 · 2 comments
Closed

Native image build failure #17343

rohit-gandhe opened this issue May 19, 2021 · 2 comments
Labels
kind/bug Something isn't working

Comments

@rohit-gandhe
Copy link

rohit-gandhe commented May 19, 2021

Describe the bug

Native image build fails when using DynamoDB Enhanced Client

Expected behavior

Build succeeds

Actual behavior

Error: Unsupported features in 2 methods
Detailed message:
Error: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected. To see how this object got instantiated use --trace-object-instantiation=java.util.Random. 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=. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
reading field software.amazon.awssdk.core.retry.backoff.FullJitterBackoffStrategy.random of
constant software.amazon.awssdk.core.retry.backoff.FullJitterBackoffStrategy@493a12c reached by
scanning method software.amazon.awssdk.services.dynamodb.DynamoDbRetryPolicy.resolveRetryPolicy(DynamoDbRetryPolicy.java:82)
Call path from entry point to software.amazon.awssdk.services.dynamodb.DynamoDbRetryPolicy.resolveRetryPolicy(SdkClientConfiguration):
at software.amazon.awssdk.services.dynamodb.DynamoDbRetryPolicy.resolveRetryPolicy(DynamoDbRetryPolicy.java:62)
at software.amazon.awssdk.services.dynamodb.DefaultDynamoDbBaseClientBuilder.finalizeServiceConfiguration(DefaultDynamoDbBaseClientBuilder.java:67)
at software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder.finalizeChildConfiguration(AwsDefaultClientBuilder.java:132)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:157)
at software.amazon.awssdk.services.dynamodb.DefaultDynamoDbClientBuilder.buildClient(DefaultDynamoDbClientBuilder.java:44)
at software.amazon.awssdk.services.dynamodb.DefaultDynamoDbClientBuilder.buildClient(DefaultDynamoDbClientBuilder.java:22)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:129)
at com.augmentor.dao.QuantaResource.createQuanta(QuantaResource.java:29)
at com.oracle.svm.reflect.QuantaResource_createQuanta_67c7b58fb5daa5a5db921ac1e2bbccd0a5707888_181.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:566)
at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:737)
at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:720)
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:291)
at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected. Object has been initialized by the org.apache.http.impl.auth.NTLMEngineImpl class initializer with a trace:
at java.security.SecureRandom.(SecureRandom.java:323)
at java.security.SecureRandom.getInstance(SecureRandom.java:383)

To Reproduce

Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).

Or attach an archive containing the reproducer to the issue.

Steps to reproduce the behavior:
1.
2.
3.

Configuration

# Add your application.properties here, if applicable.

Screenshots

(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

Output of uname -a or ver

Output of java -version

GraalVM version (if different from Java)

Quarkus version or git rev

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

Additional context

(Add any other context about the problem here.)

@rohit-gandhe rohit-gandhe added the kind/bug Something isn't working label May 19, 2021
@gsmet
Copy link
Member

gsmet commented May 19, 2021

You probably are using GraalVM 21.1 with Quarkus 1.13.x.

The issue has been fixed here #15897 but not backported to 1.13.x yet. I will do it for the next one.

In the meantime, you should use GraalVM 21.0.x as it is the version primarily supported by 1.13.x.

@rohit-gandhe
Copy link
Author

rohit-gandhe commented May 19, 2021

@gsmet Thanks for a quick response. I am using 21.0 version of GraalVM

GraalVM Version 21.0.0.2 (Java Version 11.0.10+8-jvmci-21.0-b06)

and Quarkus version 1.13.4

I got around the problem by added the -Dquarkus.native.container-build=true flag to the build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants