@@ -93,7 +93,8 @@ NativeImageConfigBuildItem build(
93
93
String maxOrder = calculateMaxOrder (config .allocatorMaxOrder , minMaxOrderBuildItems , false );
94
94
95
95
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" )
97
98
// Use small chunks to avoid a lot of wasted space. Default is 16mb * arenas (derived from core count)
98
99
// Since buffers are cached to threads, the malloc overhead is temporary anyway
99
100
.addNativeImageSystemProperty ("io.netty.allocator.maxOrder" , maxOrder )
@@ -109,6 +110,9 @@ NativeImageConfigBuildItem build(
109
110
.addRuntimeInitializedClass ("io.netty.buffer.ByteBufUtil" )
110
111
// The default channel id uses the process id, it should not be cached in the native image.
111
112
.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" )
112
116
.addNativeImageSystemProperty ("io.netty.leakDetection.level" , "DISABLED" );
113
117
114
118
if (QuarkusClassLoader .isClassPresentAtRuntime ("io.netty.handler.codec.http.HttpObjectEncoder" )) {
0 commit comments