spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.4k stars 40.74k forks source link

Spring Boot 3.4.0 and 3.3.6 native Image fails on Netty netty-common-4.1.115. java.lang.NoSuchFieldException: producerIndex #43273

Closed rowi1de closed 5 days ago

rowi1de commented 6 days ago

Using Spring Boot 3.4.0 Native Image fails on Netty netty-common-4.1.115. java.lang.NoSuchFieldException: producerIndex See https://github.com/rowi1de/netty-native

2024-11-23 01:03:57 2024-11-23T00:03:57.949Z ERROR 1 --- [netty-native] [ctor-http-nio-2] r.netty.transport.ServerTransport        : [71e5e572, L:/172.18.0.4:8080 - R:/192.168.65.1:29377] onUncaughtException(SimpleConnection{channel=[id: 0x71e5e572, L:/172.18.0.4:8080 - R:/192.168.65.1:29377]})
2024-11-23 01:03:57 
2024-11-23 01:03:57 java.lang.ExceptionInInitializerError: null
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Class.ensureInitialized(DynamicHub.java:604) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Class.ensureInitialized(DynamicHub.java:604) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Class.ensureInitialized(DynamicHub.java:604) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Class.ensureInitialized(DynamicHub.java:604) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Class.ensureInitialized(DynamicHub.java:604) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Class.ensureInitialized(DynamicHub.java:604) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at io.netty.util.internal.PlatformDependent.newFixedMpscUnpaddedQueue(PlatformDependent.java:1102) ~[na:na]
2024-11-23 01:03:57     at io.netty.buffer.PoolThreadCache$MemoryRegionCache.<init>(PoolThreadCache.java:337) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.buffer.PoolThreadCache$SubPageMemoryRegionCache.<init>(PoolThreadCache.java:302) ~[na:na]
2024-11-23 01:03:57     at io.netty.buffer.PoolThreadCache.createSubPageCaches(PoolThreadCache.java:113) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.buffer.PoolThreadCache.<init>(PoolThreadCache.java:77) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.buffer.PooledByteBufAllocator$PoolThreadLocalCache.initialValue(PooledByteBufAllocator.java:541) ~[na:na]
2024-11-23 01:03:57     at io.netty.buffer.PooledByteBufAllocator$PoolThreadLocalCache.initialValue(PooledByteBufAllocator.java:518) ~[na:na]
2024-11-23 01:03:57     at io.netty.util.concurrent.FastThreadLocal.initialize(FastThreadLocal.java:177) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.util.concurrent.FastThreadLocal.get(FastThreadLocal.java:142) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:398) ~[na:na]
2024-11-23 01:03:57     at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:188) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:179) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.buffer.AbstractByteBufAllocator.ioBuffer(AbstractByteBufAllocator.java:140) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator$MaxMessageHandle.allocate(DefaultMaxMessagesRecvByteBufAllocator.java:120) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:150) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[na:na]
2024-11-23 01:03:57     at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[na:na]
2024-11-23 01:03:57     at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[na:na]
2024-11-23 01:03:57     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[na:na]
2024-11-23 01:03:57     at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[na:na]
2024-11-23 01:03:57     at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[na:na]
2024-11-23 01:03:57     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[na:na]
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Thread.runWith(Thread.java:1596) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Thread.run(Thread.java:1583) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:902) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:878) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57 Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: producerIndex
2024-11-23 01:03:57     at io.netty.util.internal.shaded.org.jctools.util.UnsafeAccess.fieldOffset(UnsafeAccess.java:111) ~[na:na]
2024-11-23 01:03:57     at io.netty.util.internal.shaded.org.jctools.queues.unpadded.MpscUnpaddedArrayQueueProducerIndexField.<clinit>(MpscUnpaddedArrayQueue.java:38) ~[netty.graalvm.NettyNativeApiApplicationKt:4.1.115.Final]
2024-11-23 01:03:57     ... 32 common frames omitted
2024-11-23 01:03:57 Caused by: java.lang.NoSuchFieldException: producerIndex
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Class.checkField(DynamicHub.java:1044) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at java.base@21.0.5/java.lang.Class.getDeclaredField(DynamicHub.java:1159) ~[netty.graalvm.NettyNativeApiApplicationKt:na]
2024-11-23 01:03:57     at io.netty.util.internal.shaded.org.jctools.util.UnsafeAccess.fieldOffset(UnsafeAccess.java:107) ~[na:na]
2024-11-23 01:03:57     ... 33 common frames omitted
2024-11-23 01:03:57 
snicoll commented 5 days ago

Thanks for trying the latest release. Before opening an issue, please review the release notes. There is a section about that particular issue.

rowi1de commented 5 days ago

Thanks for trying the latest release. Before opening an issue, please review the release notes. There is a section about that particular issue.

@snicoll thanks for the hint, usually spring boot starters just work out of the box, will try this

bclozel commented 5 days ago

@rowi1de it was either shipping with this Netty version or shipping with the one before and then: https://github.com/netty/netty/security/advisories/GHSA-xq3w-v528-46rv

pbilstein commented 19 hours ago

+1 I have the same problem after upgrading from Spring Boot 3.3.2 to 3.3.6, downgrade to 3.3.5 helped

snicoll commented 18 hours ago

Please take the time to read the issue. Adding +1 on a closed issue like that is pointless.

pbilstein commented 18 hours ago

I read the issue and just wanted to give people a hint if they encounter similar issues. Never mind