azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

[BUG] GraalVM Netty Support NoClassDefFoundError due to Netty change

Open melloware opened this issue 3 years ago • 1 comments

Describe the bug Use GraalVM native image with Netty 4.1.78, Azure Blob 12.18.0, Azure GraalVM suport 1.0.0-beta.2 is broken with...

com.azure.aot.graalvm.support.netty.implementation.features.TargetIoNettyUtilConcurrentScheduledFutureTask.initialNanoTime() com.oracle.svm.core.util.UserError$UserException: Could not find target method: static long

Netty 4.1.78 changed ScheduledFutureTask with this commit: https://github.com/netty/netty/commit/c18fc2bc68c08805b2553336a3bf02f0c8c50972

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-aot-graalvm-support-netty</artifactId>
    <version>1.0.0-beta.2</version>
</dependency>

So these lines need to be updated: https://github.com/Azure/azure-sdk-for-java/blob/430d546b6b136a150c2a77f4502a4dc174362c8b/sdk/aot/azure-aot-graalvm-support-netty/src/main/java/com/azure/aot/graalvm/support/netty/implementation/features/NettySubstitutions.java#L449-L480

Exception or Stack Trace

Error: Could not find target method: static long com.azure.aot.graalvm.support.netty.implementation.features.TargetIoNettyUtilConcurrentScheduledFutureTask.initialNanoTime()
com.oracle.svm.core.util.UserError$UserException: Could not find target method: static long com.azure.aot.graalvm.support.netty.implementation.features.TargetIoNettyUtilConcurrentScheduledFutureTask.initialNanoTime()
        at com.oracle.svm.core.util.UserError.abort(UserError.java:72)
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findOriginalMethod(AnnotationSubstitutionProcessor.java:764)
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleMethodInAliasClass(AnnotationSubstitutionProcessor.java:381)
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleAliasClass(AnnotationSubstitutionProcessor.java:353)
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:323)
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:279)
        at com.oracle.svm.hosted.NativeImageGenerator.createAnnotationSubstitutionProcessor(NativeImageGenerator.java:933)
        at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:846)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:515)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)

melloware avatar Aug 08 '22 19:08 melloware

Thank you for reporting this issue, @melloware. @srnagar could you please take a look?

joshfree avatar Aug 09 '22 19:08 joshfree

Thank you for the bug report @melloware - we will resolve this as we work towards getting our GraalVM support officially in place. Appreciate your feedback - please keep it coming!

JonathanGiles avatar Sep 29 '22 00:09 JonathanGiles

@JonathanGiles that is fantastic! I know Netty 5.0 is working on better GraalVM support so hopefully 5.0 will also alleviate your need for these shims. But really appreciate the effort!

melloware avatar Sep 29 '22 11:09 melloware