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

Graal Native Image Build Warnings and Failure - ByteBufferUnmapper #185

Closed
4 tasks done
brianwyka opened this issue Jul 8, 2020 · 3 comments
Closed
4 tasks done
Labels
info: workaround available A workaround is available for the issue relates-to: graal

Comments

@brianwyka
Copy link
Contributor

brianwyka commented Jul 8, 2020

Micronaut kafka native image build error occurs when building within docker

Warnings

WARNING: Could not resolve io.micronaut.configuration.kafka.metrics.ConsumerKafkaMetricsReporter for reflection configuration.
WARNING: Could not resolve io.micronaut.configuration.kafka.metrics.ProducerKafkaMetricsReporter for reflection configuration.

Failure

Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call or single field access

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Clone github repository
  2. Run ./mvnw clean install
  3. Run docker build . --network host -t micronaut-app

Expected Behaviour

The native image should build successfully

Actual Behaviour

The native image build fails with following output:

Sending build context to Docker daemon   24.5MB
Step 1/10 : FROM oracle/graalvm-ce:20.1.0-java8 as graalvm
 ---> fa8819f7526a
Step 2/10 : RUN gu install native-image
 ---> Using cache
 ---> fc69ef741138
Step 3/10 : COPY . /home/app/micronaut-kafka-graal-native-image
 ---> c4406af5d788
Step 4/10 : WORKDIR /home/app/micronaut-kafka-graal-native-image
 ---> Running in 242b59fe5513
Removing intermediate container 242b59fe5513
 ---> 9852500d1ee3
Step 5/10 : RUN native-image --no-server --no-fallback --static -cp target/micronaut-kafka-graal-native-image-*.jar
 ---> Running in 184b483e7244
[micronaut-kafka-graal-native-image:22]    classlist:  10,197.00 ms,  2.06 GB
[micronaut-kafka-graal-native-image:22]        (cap):     983.43 ms,  2.06 GB
WARNING: Could not resolve io.micronaut.configuration.kafka.metrics.ConsumerKafkaMetricsReporter for reflection configuration.
WARNING: Could not resolve io.micronaut.configuration.kafka.metrics.ProducerKafkaMetricsReporter for reflection configuration.
[micronaut-kafka-graal-native-image:22]        setup:   3,545.22 ms,  2.06 GB
[micronaut-kafka-graal-native-image:22]     (clinit):   1,603.08 ms,  3.69 GB
[micronaut-kafka-graal-native-image:22]   (typeflow):  49,760.49 ms,  3.69 GB
[micronaut-kafka-graal-native-image:22]    (objects):  29,392.06 ms,  3.69 GB
[micronaut-kafka-graal-native-image:22]   (features):   6,575.06 ms,  3.69 GB
[micronaut-kafka-graal-native-image:22]     analysis:  91,660.55 ms,  3.69 GB
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call or single field access. The method handle must be a compile time constant, e.g., be loaded from a `static final` field. Method that contains the method handle invocation: java.lang.invoke.LambdaForm$MH/576509877.invokeExact_MT(Object, Object, Object)
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The error is then reported at run time when the invoke is executed.
Detailed message:
Trace: 
        at parsing org.apache.kafka.common.utils.ByteBufferUnmapper.unmap(ByteBufferUnmapper.java:81)
Call path from entry point to org.apache.kafka.common.utils.ByteBufferUnmapper.unmap(String, ByteBuffer): 
        at org.apache.kafka.common.utils.ByteBufferUnmapper.unmap(ByteBufferUnmapper.java:75)
        at org.apache.kafka.common.network.SslTransportLayer.close(SslTransportLayer.java:206)
        at java.io.FileDescriptor.closeAll(FileDescriptor.java:202)
        at java.io.RandomAccessFile.close(RandomAccessFile.java:617)
        at sun.nio.ch.FileChannelImpl.implCloseChannel(FileChannelImpl.java:139)
        at java.nio.channels.spi.AbstractInterruptibleChannel$1.interrupt(AbstractInterruptibleChannel.java:165)
        at java.lang.Thread.interrupt(Thread.java:922)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:514)
        at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
        at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)

Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
The command '/bin/sh -c native-image --no-server --no-fallback --static -cp target/micronaut-kafka-graal-native-image-*.jar' returned a non-zero code: 1

Environment Information

  • Operating System: Linux
  • Micronaut Version: 2.0.0
  • JDK Version: 1.8

Example Application

@silanpa
Copy link

silanpa commented Jul 21, 2020

With JDK 11 works I think is related to JDK 1.8

@graemerocher graemerocher added the info: workaround available A workaround is available for the issue label Jul 29, 2020
@vwiencek
Copy link

Hello
I get the same error with graalvm based on JDK 11

My JDK is
OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)

@graemerocher
Copy link
Contributor

Fixed in #375

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info: workaround available A workaround is available for the issue relates-to: graal
Projects
None yet
Development

No branches or pull requests

4 participants