From 6423ff4fc0fab16a34a0a83326f11a508d165bda Mon Sep 17 00:00:00 2001 From: panbingkun Date: Mon, 18 Dec 2023 10:37:36 +0800 Subject: [PATCH 1/3] Make it run well with the netty newest version 4.1.104 --- .../main/java/io/netty/buffer/PooledByteBufAllocatorL.java | 4 ++-- java/pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java b/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java index 06c6669cfd1..5d763416ed9 100644 --- a/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java +++ b/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java @@ -150,7 +150,7 @@ public InnerAllocator() { throw new RuntimeException("Failure while initializing allocator. Unable to retrieve direct arenas field.", e); } - this.chunkSize = directArenas[0].chunkSize; + this.chunkSize = directArenas[0].sizeClass.chunkSize; if (memoryLogger.isTraceEnabled()) { statusThread = new MemoryStatusThread(this); @@ -166,7 +166,7 @@ private UnsafeDirectLittleEndian newDirectBufferL(int initialCapacity, int maxCa if (directArena != null) { - if (initialCapacity > directArena.chunkSize) { + if (initialCapacity > directArena.sizeClass.chunkSize) { // This is beyond chunk size so we'll allocate separately. ByteBuf buf = UnpooledByteBufAllocator.DEFAULT.directBuffer(initialCapacity, maxCapacity); diff --git a/java/pom.xml b/java/pom.xml index 86eb428ebd5..4a1e4058301 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -33,7 +33,7 @@ 5.10.1 2.0.9 32.1.3-jre - 4.1.100.Final + 4.1.104.Final 1.59.0 3.23.1 2.16.0 From 0bfe61cdc621bf237516d538642cd885ce712af0 Mon Sep 17 00:00:00 2001 From: panbingkun Date: Thu, 21 Dec 2023 10:56:40 +0800 Subject: [PATCH 2/3] Make it run well with the netty newest version 4.1.104 --- .../src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java b/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java index 5d763416ed9..08a1c6dc7a7 100644 --- a/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java +++ b/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java @@ -150,7 +150,7 @@ public InnerAllocator() { throw new RuntimeException("Failure while initializing allocator. Unable to retrieve direct arenas field.", e); } - this.chunkSize = directArenas[0].sizeClass.chunkSize; + this.chunkSize = metric().chunkSize(); if (memoryLogger.isTraceEnabled()) { statusThread = new MemoryStatusThread(this); From 587f91859614e86cd8f7172e8e7591f06ca094f6 Mon Sep 17 00:00:00 2001 From: panbingkun Date: Thu, 21 Dec 2023 11:34:56 +0800 Subject: [PATCH 3/3] Make it run well with the netty newest version 4.1.104 --- .../main/java/io/netty/buffer/PooledByteBufAllocatorL.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java b/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java index 08a1c6dc7a7..ba9aba353c3 100644 --- a/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java +++ b/java/memory/memory-netty/src/main/java/io/netty/buffer/PooledByteBufAllocatorL.java @@ -71,7 +71,7 @@ public UnsafeDirectLittleEndian allocate(long size) { } public int getChunkSize() { - return allocator.chunkSize; + return allocator.chunkSize(); } public long getHugeBufferSize() { @@ -137,7 +137,6 @@ private class InnerAllocator extends PooledByteBufAllocator { private final PoolArena[] directArenas; private final MemoryStatusThread statusThread; - private final int chunkSize; public InnerAllocator() { super(true); @@ -150,8 +149,6 @@ public InnerAllocator() { throw new RuntimeException("Failure while initializing allocator. Unable to retrieve direct arenas field.", e); } - this.chunkSize = metric().chunkSize(); - if (memoryLogger.isTraceEnabled()) { statusThread = new MemoryStatusThread(this); statusThread.start(); @@ -166,7 +163,7 @@ private UnsafeDirectLittleEndian newDirectBufferL(int initialCapacity, int maxCa if (directArena != null) { - if (initialCapacity > directArena.sizeClass.chunkSize) { + if (initialCapacity > chunkSize()) { // This is beyond chunk size so we'll allocate separately. ByteBuf buf = UnpooledByteBufAllocator.DEFAULT.directBuffer(initialCapacity, maxCapacity);