You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Damir Murat <da...@gmail.com> on 2023/12/24 17:36:50 UTC
Groovy issue with GraalVM native-image for a large number of consecutive method calls
I had an issue with Groovy and GraalVM native-image that occurs rarely but consistently.
It is especially problematic because it happens only at runtime without any warning from
the native-image builder.
I cannot claim I understand all underlying mechanics precisely, but I will try to explain it
according to my understanding.
Since I spent some time fighting with this thing, I thought it might be helpful for others to
know about it and maybe even mention the issue in Groovy documentation somewhere.
I did not find any mention of a similar problem online.
So, back to the problem. In the native image built with GraalVM, when executing some
methods repeatedly for a huge number of times (more than 10000 to be exact), Groovy
can cause the following exception:
com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite, MethodHandle) is reachable
The exception is caused by
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:315)
method. Here is an example of a full stack trace:
11:41:22.349 [main] INFO o.k.t.g.s.r.r.GradleSourceRepackager - Repackaging Gradle sources: /Users/dmurat/work/dev/croz/klokwrk/klokwrk-project/modules/other/tool/klokwrk-tool-gradle-source-repack/gradle-8.5-all.zip ===> /Users/dmurat/.gradle/caches/8.5/generated-gradle-jars/gradle-api-8.5-sources.jar
Exception in thread "main" com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite, MethodHandle) is reachable
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:121)
at java.base@21.0.1/java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(MethodHandleNatives.java)
at java.base@21.0.1/java.lang.invoke.CallSite.setTargetNormal(CallSite.java:291)
at java.base@21.0.1/java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:155)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:315)
at java.base@21.0.1/java.lang.invoke.LambdaForm$DMH/s7887ae77.invokeStaticInit(LambdaForm$DMH)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackagerInfo.getGradleDistributionSrcDirPath(GradleSourceRepackagerInfo.groovy:61)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager$_calculateCountOfTargetZipEntries_closure1$_closure4.doCall(GradleSourceRepackager.groovy:62)
at java.base@21.0.1/java.lang.reflect.Method.invoke(Method.java:580)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
at groovy.lang.Closure.call(Closure.java:433)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:52)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:113)
at jdk.proxy1/jdk.proxy1.$Proxy50.test(Unknown Source)
at java.base@21.0.1/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
at java.base@21.0.1/java.util.zip.ZipFile$EntrySpliterator.tryAdvance(ZipFile.java:573)
at java.base@21.0.1/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
at java.base@21.0.1/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base@21.0.1/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base@21.0.1/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base@21.0.1/java.util.stream.ReduceOps$5.evaluateSequential(ReduceOps.java:258)
at java.base@21.0.1/java.util.stream.ReduceOps$5.evaluateSequential(ReduceOps.java:248)
at java.base@21.0.1/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base@21.0.1/java.util.stream.ReferencePipeline.count(ReferencePipeline.java:709)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager$_calculateCountOfTargetZipEntries_closure1.doCall(GradleSourceRepackager.groovy:61)
at java.base@21.0.1/java.lang.reflect.Method.invoke(Method.java:580)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
at groovy.lang.Closure.call(Closure.java:433)
at groovy.lang.Closure.call(Closure.java:422)
at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1616)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager.calculateCountOfTargetZipEntries(GradleSourceRepackager.groovy:59)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager.repackGradleSource(GradleSourceRepackager.groovy:53)
at org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.run(GradleSourceRepackCommand.groovy:130)
at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:137)
at io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:114)
at org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.main(GradleSourceRepackCommand.groovy:64)
When looking at the source, the corresponding "if" branch is triggered, besides other things,
because "INDY_OPTIMIZE_THRESHOLD" is exceeded. After looking at the definition of the
constant, it is visible that it is read from the "groovy.indy.optimize.threshold" system property
and has a default of 10_000.
I tried to change the value to 100_000 by passing the property to the native executable, but
that does not work, unfortunately. The property must be set during native image building to
become effective. I've used the following options with native-builder:
"-J-Dgroovy.indy.optimize.threshold=100000",
"-J-Dgroovy.indy.fallback.threshold=100000"
As can be seen, besides "groovy.indy.optimize.threshold," there is also a related "groovy.indy.fallback.threshold"
system property set. After those changes, the created native image no longer throws the
exception mentioned above.
I hope this description will be helpful to anyone encountering similar issues.
Best regards,
Damir Murat
Re: Groovy issue with GraalVM native-image for a large number of consecutive method calls
Posted by Jochen Theodorou <bl...@gmx.org>.
I think we have two different issues to deal with here.
(1) graal native does not allow us to set the callsite target again.
(2) static compiled code relies on dynamic code via ConvertedClosure.
If we fix (2) then (1) is no issue for static code. But even for dynamic
code we should maybe have some documentation and settings that allows
native images to at least some extend.
bye Jochen
On 25.12.23 11:47, Damir Murat wrote:
> Oh, the source is not a problem. It is part of the open-source project -
> https://github.com/croz-ltd/klokwrk-project
> <https://github.com/croz-ltd/klokwrk-project>
>
> Previously, I mentioned only one occurrence of the problem, but I have
> two actually. I did some refactorings in the
> meantime, so one of the stack traces differs from the previous example.
>
> I can also provide full reproducible if that is helpful.
>
> ----------
> org.klokwrk.tool.gradle.source.repack.downloader.GradleDownloader
> https://github.com/croz-ltd/klokwrk-project/blob/master/modules/other/tool/klokwrk-tool-gradle-source-repack/src/main/groovy/org/klokwrk/tool/gradle/source/repack/downloader/GradleDownloader.groovy <https://github.com/croz-ltd/klokwrk-project/blob/master/modules/other/tool/klokwrk-tool-gradle-source-repack/src/main/groovy/org/klokwrk/tool/gradle/source/repack/downloader/GradleDownloader.groovy>
>
> reactor.core.Exceptions$ReactiveException:
> com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method
> java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite,
> MethodHandle) is reachable
> at reactor.core.Exceptions.propagate(Exceptions.java:408)
> at
> reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:101)
> at reactor.core.publisher.Flux.blockLast(Flux.java:2753)
> at
> org.klokwrk.tool.gradle.source.repack.downloader.GradleDownloader$_download_closure1.doCall(GradleDownloader.groovy:75)
> at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
> at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
> at groovy.lang.Closure.call(Closure.java:433)
> at groovy.lang.Closure.call(Closure.java:422)
> at
> org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1616)
> at
> org.klokwrk.tool.gradle.source.repack.downloader.GradleDownloader.download(GradleDownloader.groovy:72)
> at
> org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.fetchGradleDistributionZipFile(GradleSourceRepackCommand.groovy:183)
> at
> org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.run(GradleSourceRepackCommand.groovy:118)
> at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
> at picocli.CommandLine.access$1500(CommandLine.java:148)
> at
> picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
> at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
> at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
> at
> picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
> at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
> at picocli.CommandLine.execute(CommandLine.java:2170)
> at
> io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:137)
> at
> io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:114)
> at
> org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.main(GradleSourceRepackCommand.groovy:64)
> Suppressed: java.lang.Exception: #block terminated with an error
> at
> reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:103)
> ... 24 more
> Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported
> method
> java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite,
> MethodHandle) is reachable
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:92)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(MethodHandleNatives.java)
> at
> java.base@17.0.7/java.lang.invoke.CallSite.setTargetNormal(CallSite.java:290)
> at
> java.base@17.0.7/java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:155)
> at
> org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:315)
> at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:212)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:76)
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.MethodHandleIntrinsicImpl.execute(MethodHandleIntrinsicImpl.java:181)
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:142)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:76)
> at
> java.base@17.0.7/java.lang.invoke.LambdaForm$NamedFunction.invokeWithArguments(LambdaForm.java:96)
> at
> java.base@17.0.7/java.lang.invoke.LambdaForm.interpretName(LambdaForm.java:964)
> at
> java.base@17.0.7/java.lang.invoke.LambdaForm.interpretWithArguments(LambdaForm.java:941)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:82)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:0)
> at
> java.base@17.0.7/java.lang.invoke.Invokers$Holder.linkToCallSite(Invokers$Holder)
> at
> org.klokwrk.tool.gradle.source.repack.downloader.GradleDownloader$_download_closure1$_closure3.doCall(GradleDownloader.groovy:78)
> at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
> at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
> at groovy.lang.Closure.call(Closure.java:433)
> at
> org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:52)
> at
> org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:113)
> at jdk.proxy1/jdk.proxy1.$Proxy49.apply(Unknown Source)
> at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
> at
> io.micronaut.http.client.netty.MicronautFlux$AfterNextOperator$1.onNext(MicronautFlux.java:92)
> at
> reactor.core.publisher.FluxSwitchMapNoPrefetch$SwitchMapInner.onNext(FluxSwitchMapNoPrefetch.java:407)
> at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
> at
> reactor.core.publisher.FluxFilter$FilterSubscriber.onNext(FluxFilter.java:113)
> at
> io.micronaut.http.client.netty.ReactiveClientReader.channelRead(ReactiveClientReader.java:139)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at
> io.netty.handler.flow.FlowControlHandler.dequeue(FlowControlHandler.java:202)
> at
> io.netty.handler.flow.FlowControlHandler.channelRead(FlowControlHandler.java:164)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at
> io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at
> io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
> at
> io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at
> io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
> at
> io.netty.handler.codec.http2.AbstractHttp2StreamChannel$Http2ChannelUnsafe.doRead0(AbstractHttp2StreamChannel.java:955)
> at
> io.netty.handler.codec.http2.AbstractHttp2StreamChannel.fireChildRead(AbstractHttp2StreamChannel.java:600)
> at
> io.netty.handler.codec.http2.Http2MultiplexHandler.channelRead(Http2MultiplexHandler.java:195)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at
> io.netty.handler.codec.http2.Http2FrameCodec.onHttp2Frame(Http2FrameCodec.java:712)
> at
> io.netty.handler.codec.http2.Http2FrameCodec$FrameListener.onDataRead(Http2FrameCodec.java:651)
> at
> io.netty.handler.codec.http2.Http2FrameListenerDecorator.onDataRead(Http2FrameListenerDecorator.java:36)
> at
> io.netty.handler.codec.http2.Http2EmptyDataFrameListener.onDataRead(Http2EmptyDataFrameListener.java:49)
> at
> io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onDataRead(DefaultHttp2ConnectionDecoder.java:322)
> at
> io.netty.handler.codec.http2.DefaultHttp2FrameReader.readDataFrame(DefaultHttp2FrameReader.java:415)
> at
> io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:250)
> at
> io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159)
> at
> io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:188)
> at
> io.netty.handler.codec.http2.DecoratingHttp2ConnectionDecoder.decodeFrame(DecoratingHttp2ConnectionDecoder.java:63)
> at
> io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:393)
> at
> io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:453)
> at
> io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
> at
> io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
> at
> io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
> at
> io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1338)
> at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1387)
> at
> io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
> at
> io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
> at
> io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at
> io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
> at
> io.micronaut.http.client.netty.ResettableReadTimeoutHandler$NextInterceptor.channelRead(ResettableReadTimeoutHandler.java:92)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at
> io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
> at
> io.micronaut.http.client.netty.ResettableReadTimeoutHandler.channelRead(ResettableReadTimeoutHandler.java:64)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
> at
> io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
> at
> io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
> at
> io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
> at
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
> at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
> at
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
> at
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
> at
> io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
> at java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:807)
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:210)
>
> ----------
>
> org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager
> https://github.com/croz-ltd/klokwrk-project/blob/master/modules/other/tool/klokwrk-tool-gradle-source-repack/src/main/groovy/org/klokwrk/tool/gradle/source/repack/repackager/GradleSourceRepackager.groovy <https://github.com/croz-ltd/klokwrk-project/blob/master/modules/other/tool/klokwrk-tool-gradle-source-repack/src/main/groovy/org/klokwrk/tool/gradle/source/repack/repackager/GradleSourceRepackager.groovy>
>
> Exception in thread "main"
> com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method
> java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite,
> MethodHandle) is reachable
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:92)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(MethodHandleNatives.java)
> at
> java.base@17.0.7/java.lang.invoke.CallSite.setTargetNormal(CallSite.java:290)
> at
> java.base@17.0.7/java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:155)
> at
> org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:315)
> at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:212)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:76)
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.MethodHandleIntrinsicImpl.execute(MethodHandleIntrinsicImpl.java:181)
> at
> org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:142)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:76)
> at
> java.base@17.0.7/java.lang.invoke.LambdaForm$NamedFunction.invokeWithArguments(LambdaForm.java:96)
> at
> java.base@17.0.7/java.lang.invoke.LambdaForm.interpretName(LambdaForm.java:964)
> at
> java.base@17.0.7/java.lang.invoke.LambdaForm.interpretWithArguments(LambdaForm.java:941)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:82)
> at
> java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:0)
> at
> java.base@17.0.7/java.lang.invoke.Invokers$Holder.linkToCallSite(Invokers$Holder)
> at
> org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackagerInfo.getGradleDistributionSrcDirPath(GradleSourceRepackagerInfo.groovy:61)
> at
> org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager$_calculateCountOfTargetZipEntries_closure2$_closure5.doCall(GradleSourceRepackager.groovy:68)
> at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
> at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
> at groovy.lang.Closure.call(Closure.java:433)
> at
> org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:52)
> at
> org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:113)
> at jdk.proxy1/jdk.proxy1.$Proxy50.test(Unknown Source)
> at
> java.base@17.0.7/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
> at
> java.base@17.0.7/java.util.zip.ZipFile$EntrySpliterator.tryAdvance(ZipFile.java:558)
> at
> java.base@17.0.7/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
> at
> java.base@17.0.7/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
> at
> java.base@17.0.7/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
> at
> java.base@17.0.7/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
> at
> java.base@17.0.7/java.util.stream.ReduceOps$5.evaluateSequential(ReduceOps.java:258)
> at
> java.base@17.0.7/java.util.stream.ReduceOps$5.evaluateSequential(ReduceOps.java:248)
> at
> java.base@17.0.7/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> at
> java.base@17.0.7/java.util.stream.ReferencePipeline.count(ReferencePipeline.java:709)
> at
> org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager$_calculateCountOfTargetZipEntries_closure2.doCall(GradleSourceRepackager.groovy:67)
> at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
> at
> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
> at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
> at groovy.lang.Closure.call(Closure.java:433)
> at groovy.lang.Closure.call(Closure.java:422)
> at
> org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1616)
> at
> org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager.calculateCountOfTargetZipEntries(GradleSourceRepackager.groovy:65)
> at
> org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager.repackGradleSource(GradleSourceRepackager.groovy:54)
> at
> org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.run(GradleSourceRepackCommand.groovy:130)
> at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
> at picocli.CommandLine.access$1500(CommandLine.java:148)
> at
> picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
> at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
> at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
> at
> picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
> at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
> at picocli.CommandLine.execute(CommandLine.java:2170)
> at
> io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:137)
> at
> io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:114)
> at
> org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.main(GradleSourceRepackCommand.groovy:64)
Re: Groovy issue with GraalVM native-image for a large number of consecutive method calls
Posted by Damir Murat <da...@gmail.com>.
Oh, the source is not a problem. It is part of the open-source project - https://github.com/croz-ltd/klokwrk-project
Previously, I mentioned only one occurrence of the problem, but I have two actually. I did some refactorings in the
meantime, so one of the stack traces differs from the previous example.
I can also provide full reproducible if that is helpful.
----------
org.klokwrk.tool.gradle.source.repack.downloader.GradleDownloader
https://github.com/croz-ltd/klokwrk-project/blob/master/modules/other/tool/klokwrk-tool-gradle-source-repack/src/main/groovy/org/klokwrk/tool/gradle/source/repack/downloader/GradleDownloader.groovy
reactor.core.Exceptions$ReactiveException: com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite, MethodHandle) is reachable
at reactor.core.Exceptions.propagate(Exceptions.java:408)
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:101)
at reactor.core.publisher.Flux.blockLast(Flux.java:2753)
at org.klokwrk.tool.gradle.source.repack.downloader.GradleDownloader$_download_closure1.doCall(GradleDownloader.groovy:75)
at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
at groovy.lang.Closure.call(Closure.java:433)
at groovy.lang.Closure.call(Closure.java:422)
at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1616)
at org.klokwrk.tool.gradle.source.repack.downloader.GradleDownloader.download(GradleDownloader.groovy:72)
at org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.fetchGradleDistributionZipFile(GradleSourceRepackCommand.groovy:183)
at org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.run(GradleSourceRepackCommand.groovy:118)
at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:137)
at io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:114)
at org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.main(GradleSourceRepackCommand.groovy:64)
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:103)
... 24 more
Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite, MethodHandle) is reachable
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:92)
at java.base@17.0.7/java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(MethodHandleNatives.java)
at java.base@17.0.7/java.lang.invoke.CallSite.setTargetNormal(CallSite.java:290)
at java.base@17.0.7/java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:155)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:315)
at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:212)
at java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:76)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.MethodHandleIntrinsicImpl.execute(MethodHandleIntrinsicImpl.java:181)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:142)
at java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:76)
at java.base@17.0.7/java.lang.invoke.LambdaForm$NamedFunction.invokeWithArguments(LambdaForm.java:96)
at java.base@17.0.7/java.lang.invoke.LambdaForm.interpretName(LambdaForm.java:964)
at java.base@17.0.7/java.lang.invoke.LambdaForm.interpretWithArguments(LambdaForm.java:941)
at java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:82)
at java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:0)
at java.base@17.0.7/java.lang.invoke.Invokers$Holder.linkToCallSite(Invokers$Holder)
at org.klokwrk.tool.gradle.source.repack.downloader.GradleDownloader$_download_closure1$_closure3.doCall(GradleDownloader.groovy:78)
at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
at groovy.lang.Closure.call(Closure.java:433)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:52)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:113)
at jdk.proxy1/jdk.proxy1.$Proxy49.apply(Unknown Source)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
at io.micronaut.http.client.netty.MicronautFlux$AfterNextOperator$1.onNext(MicronautFlux.java:92)
at reactor.core.publisher.FluxSwitchMapNoPrefetch$SwitchMapInner.onNext(FluxSwitchMapNoPrefetch.java:407)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
at reactor.core.publisher.FluxFilter$FilterSubscriber.onNext(FluxFilter.java:113)
at io.micronaut.http.client.netty.ReactiveClientReader.channelRead(ReactiveClientReader.java:139)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.flow.FlowControlHandler.dequeue(FlowControlHandler.java:202)
at io.netty.handler.flow.FlowControlHandler.channelRead(FlowControlHandler.java:164)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.handler.codec.http2.AbstractHttp2StreamChannel$Http2ChannelUnsafe.doRead0(AbstractHttp2StreamChannel.java:955)
at io.netty.handler.codec.http2.AbstractHttp2StreamChannel.fireChildRead(AbstractHttp2StreamChannel.java:600)
at io.netty.handler.codec.http2.Http2MultiplexHandler.channelRead(Http2MultiplexHandler.java:195)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.http2.Http2FrameCodec.onHttp2Frame(Http2FrameCodec.java:712)
at io.netty.handler.codec.http2.Http2FrameCodec$FrameListener.onDataRead(Http2FrameCodec.java:651)
at io.netty.handler.codec.http2.Http2FrameListenerDecorator.onDataRead(Http2FrameListenerDecorator.java:36)
at io.netty.handler.codec.http2.Http2EmptyDataFrameListener.onDataRead(Http2EmptyDataFrameListener.java:49)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onDataRead(DefaultHttp2ConnectionDecoder.java:322)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readDataFrame(DefaultHttp2FrameReader.java:415)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:250)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:188)
at io.netty.handler.codec.http2.DecoratingHttp2ConnectionDecoder.decodeFrame(DecoratingHttp2ConnectionDecoder.java:63)
at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:393)
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:453)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1338)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1387)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
at io.micronaut.http.client.netty.ResettableReadTimeoutHandler$NextInterceptor.channelRead(ResettableReadTimeoutHandler.java:92)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.micronaut.http.client.netty.ResettableReadTimeoutHandler.channelRead(ResettableReadTimeoutHandler.java:64)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:807)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:210)
----------
org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager
https://github.com/croz-ltd/klokwrk-project/blob/master/modules/other/tool/klokwrk-tool-gradle-source-repack/src/main/groovy/org/klokwrk/tool/gradle/source/repack/repackager/GradleSourceRepackager.groovy
Exception in thread "main" com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite, MethodHandle) is reachable
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:92)
at java.base@17.0.7/java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(MethodHandleNatives.java)
at java.base@17.0.7/java.lang.invoke.CallSite.setTargetNormal(CallSite.java:290)
at java.base@17.0.7/java.lang.invoke.MutableCallSite.setTarget(MutableCallSite.java:155)
at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:315)
at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:212)
at java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:76)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.MethodHandleIntrinsicImpl.execute(MethodHandleIntrinsicImpl.java:181)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.methodhandles.Util_java_lang_invoke_MethodHandle.invokeInternal(Target_java_lang_invoke_MethodHandle.java:142)
at java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:76)
at java.base@17.0.7/java.lang.invoke.LambdaForm$NamedFunction.invokeWithArguments(LambdaForm.java:96)
at java.base@17.0.7/java.lang.invoke.LambdaForm.interpretName(LambdaForm.java:964)
at java.base@17.0.7/java.lang.invoke.LambdaForm.interpretWithArguments(LambdaForm.java:941)
at java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:82)
at java.base@17.0.7/java.lang.invoke.MethodHandle.invokeBasic(MethodHandle.java:0)
at java.base@17.0.7/java.lang.invoke.Invokers$Holder.linkToCallSite(Invokers$Holder)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackagerInfo.getGradleDistributionSrcDirPath(GradleSourceRepackagerInfo.groovy:61)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager$_calculateCountOfTargetZipEntries_closure2$_closure5.doCall(GradleSourceRepackager.groovy:68)
at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
at groovy.lang.Closure.call(Closure.java:433)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:52)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:113)
at jdk.proxy1/jdk.proxy1.$Proxy50.test(Unknown Source)
at java.base@17.0.7/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
at java.base@17.0.7/java.util.zip.ZipFile$EntrySpliterator.tryAdvance(ZipFile.java:558)
at java.base@17.0.7/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
at java.base@17.0.7/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base@17.0.7/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base@17.0.7/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base@17.0.7/java.util.stream.ReduceOps$5.evaluateSequential(ReduceOps.java:258)
at java.base@17.0.7/java.util.stream.ReduceOps$5.evaluateSequential(ReduceOps.java:248)
at java.base@17.0.7/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base@17.0.7/java.util.stream.ReferencePipeline.count(ReferencePipeline.java:709)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager$_calculateCountOfTargetZipEntries_closure2.doCall(GradleSourceRepackager.groovy:67)
at java.base@17.0.7/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1008)
at groovy.lang.Closure.call(Closure.java:433)
at groovy.lang.Closure.call(Closure.java:422)
at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1616)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager.calculateCountOfTargetZipEntries(GradleSourceRepackager.groovy:65)
at org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager.repackGradleSource(GradleSourceRepackager.groovy:54)
at org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.run(GradleSourceRepackCommand.groovy:130)
at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:137)
at io.micronaut.configuration.picocli.PicocliRunner.run(PicocliRunner.java:114)
at org.klokwrk.tool.gradle.source.repack.GradleSourceRepackCommand.main(GradleSourceRepackCommand.groovy:64)
Re: Groovy issue with GraalVM native-image for a large number of consecutive method calls
Posted by Jochen Theodorou <bl...@gmx.org>.
On 24.12.23 18:36, Damir Murat wrote:
[...]
> So, back to the problem. In the native image built with GraalVM, when
> executing some
> methods repeatedly for a huge number of times (more than 10000 to be
> exact), Groovy
> can cause the following exception:
>
> com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method
> java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite,
> MethodHandle) is reachable
[...]
> org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:113)
> at jdk.proxy1/jdk.proxy1.$Proxy50.test(Unknown Source)
[...]
> org.klokwrk.tool.gradle.source.repack.repackager.GradleSourceRepackager$_calculateCountOfTargetZipEntries_closure1.doCall(GradleSourceRepackager.groovy:61)
It would be interesting what is in this line 61, but especially why
ConversionHandler gets involved
It should be either some SAM call involvement here or a map that got
converted using "as".
If we can identify the case specifically, maybe we can prevent that case
in static compilation mode.
bye Jochen