Skip to content

Commit aba0d15

Browse files
authored
Merge pull request #31016 from zakkak/2023-02-08-fix-netty-platformdependent
2 parents dc0444e + ca155ca commit aba0d15

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ NativeImageConfigBuildItem build(
9393
String maxOrder = calculateMaxOrder(config.allocatorMaxOrder, minMaxOrderBuildItems, false);
9494

9595
NativeImageConfigBuildItem.Builder builder = NativeImageConfigBuildItem.builder()
96-
//.addNativeImageSystemProperty("io.netty.noUnsafe", "true")
96+
// disable unsafe usage to allow io.netty.internal.PlarformDependent0 to be reinitialized without issues
97+
.addNativeImageSystemProperty("io.netty.noUnsafe", "true")
9798
// Use small chunks to avoid a lot of wasted space. Default is 16mb * arenas (derived from core count)
9899
// Since buffers are cached to threads, the malloc overhead is temporary anyway
99100
.addNativeImageSystemProperty("io.netty.allocator.maxOrder", maxOrder)
@@ -109,6 +110,9 @@ NativeImageConfigBuildItem build(
109110
.addRuntimeInitializedClass("io.netty.buffer.ByteBufUtil")
110111
// The default channel id uses the process id, it should not be cached in the native image.
111112
.addRuntimeInitializedClass("io.netty.channel.DefaultChannelId")
113+
// Make sure to re-initialize platform dependent classes/values at runtime
114+
.addRuntimeReinitializedClass("io.netty.util.internal.PlatformDependent")
115+
.addRuntimeReinitializedClass("io.netty.util.internal.PlatformDependent0")
112116
.addNativeImageSystemProperty("io.netty.leakDetection.level", "DISABLED");
113117

114118
if (QuarkusClassLoader.isClassPresentAtRuntime("io.netty.handler.codec.http.HttpObjectEncoder")) {

0 commit comments

Comments
 (0)