-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Netty requires more classes to be runtime initialized #37633
Netty requires more classes to be runtime initialized #37633
Conversation
This comment has been minimized.
This comment has been minimized.
.addRuntimeReinitializedClass("io.netty.buffer.UnpooledByteBufAllocator") | ||
.addRuntimeReinitializedClass("io.netty.buffer.Unpooled") | ||
.addRuntimeReinitializedClass("io.vertx.core.http.impl.Http1xServerResponse") | ||
.addRuntimeReinitializedClass("io.netty.handler.codec.http.HttpObjectAggregator"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised, we use it? In theory Vertx should handle the whole http 1.1 stack with https://github.com/eclipse-vertx/vert.x/blob/4.x/src/main/java/io/vertx/core/http/impl/HttpServerWorker.java#L284
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 - who's loading this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have a look on Monday (along with the rest of the failing tests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franz1981 @cescoffier The stack trace (according to GraalVM) leading to the use of this class is:
The following detailed trace displays from which field in the code the object was reached.
Detailed message:
Trace: Object was reached by
reading field io.netty.buffer.EmptyByteBuf.alloc of constant
io.netty.buffer.EmptyByteBuf@546adc44: EmptyByteBufBE
scanning root io.netty.buffer.EmptyByteBuf@546adc44: EmptyByteBufBE embedded in
io.netty.handler.codec.http.HttpObjectAggregator.handleOversizedMessage(HttpObjectAggregator.java)
parsing method io.netty.handler.codec.http.HttpObjectAggregator.handleOversizedMessage(HttpObjectAggregator.java:245) reachable via the parsing context
at io.netty.handler.codec.http.HttpObjectAggregator.handleOversizedMessage(HttpObjectAggregator.java:86)
at io.netty.handler.codec.MessageAggregator.invokeHandleOversizedMessage(MessageAggregator.java:403)
at io.netty.handler.codec.MessageAggregator.decode(MessageAggregator.java:291)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
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.processSelectedKeysPlain(NioEventLoop.java:689)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:652)
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 java.util.OptionalInt.ifPresentOrElse(OptionalInt.java:185)
at root method.(Unknown Source)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum it may have found a path that is actually not used. However, adding a substitution might be a bit overkill. So, +1 to re-initialize it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cescoffier FYI to our so far understanding this happens because when using --enable-monitoring=jfr
(i.e. -Dquarkus.native.monitoring=jfr
) GraalVM opens all packages of java.base
to the unnamed module, which appears to have side-effects on the code reachability of netty.
In quarkusio#37347 we moved `PlatformDependent` and `PlatformDependent0` classes to run-time-initialization as they are platform-dependent and thus need to be initialized on the target platform. It looks like there are more classes like these that need to be runtime initialized as they transitively rely on platform dependent values. Closes Karm/mandrel-integration-tests#236 Supersedes quarkusio#37628
3d01c78
to
72d7b79
Compare
✔️ The latest workflow run for the pull request has completed successfully. It should be safe to merge provided you have a look at the other checks in the summary. |
I ended up adding even more classes to the set of runtime initialized ones. All native tests look good now. |
@zakkak Could you please trigger another run. Many of the shown failures should be gone with a later run. Thanks! |
I scheduled a re-run https://github.com/graalvm/mandrel/actions/runs/7147836492 (same url). |
Mandrel IT tests are OK with this now, so +1. |
`io.netty.buffer.PooledByteBufAllocator` is already registered for runtime initialization earlier in NettyProcessor.java Follow up to quarkusio#37633 Also fixes the following warning when using Mandrel and GraalVM 23.0: ``` com.oracle.svm.core.util.UserError$UserException: Incompatible change of initialization policy for io.netty.buffer.PooledByteBufAllocator: trying to change RUN_TIME from 'META-INF/native-image/io.netty/netty-buffer/native-image.properties' in 'file:///home/zakkak/code/mandrel-integration-tests/apps/jfr-native-image-performance/target/jfr-plaintext-native-image-source-jar/lib/io.netty.netty-buffer-4.1.100.Final.jar' with 'io.netty.buffer.PooledByteBufAllocator' and from feature io.quarkus.runner.Feature.beforeAnalysis with 'PooledByteBufAllocator.class' to RERUN Quarkus at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:73) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:103) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:117) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:117) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:117) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:117) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insert(ClassInitializationConfiguration.java:64) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ProvenSafeClassInitializationSupport.rerunInitialization(ProvenSafeClassInitializationSupport.java:162) at io.quarkus.runner.Feature.runtimeReinitializedClasses(Unknown Source) at io.quarkus.runner.Feature.beforeAnalysis(Unknown Source) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$9(NativeImageGenerator.java:757) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:89) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:757) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:539) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:408) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:612) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:134) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94) ```
@gsmet it looks like we should have backported this to 3.6 but missed it. |
This is important enough that I'll try to release a 3.6.6 next Tuesday. Still unsure about my availability to do it but I'll try. |
That was for @ThoSap ^ |
In #37347 we moved
PlatformDependent
andPlatformDependent0
classes torun-time-initialization as they are platform-dependent and thus need to
be initialized on the target platform. It looks like there are more
classes like these that need to be runtime initialized as they
transitively rely on platform dependent values.
Closes Karm/mandrel-integration-tests#236
Supersedes #37628
CI run with latest Mandrel 24.0-dev https://github.com/graalvm/mandrel/actions/runs/7147836492