From 627108dff874d79f76ccfd2914e6560fdab12e25 Mon Sep 17 00:00:00 2001 From: kravii Date: Thu, 21 Mar 2024 22:37:33 +0100 Subject: [PATCH] ODP-1103|netty4 upgrade to 4.1.94 --- .../org/apache/hadoop/oncrpc/RpcProgram.java | 12 +++- .../org/apache/hadoop/oncrpc/RpcUtil.java | 9 +-- .../hadoop-hdfs-client/pom.xml | 8 +++ hadoop-project/pom.xml | 62 ++++++++++++++++++- 4 files changed, 85 insertions(+), 6 deletions(-) diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java index 3c310af5d4b40c..4d5323c57643fd 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java @@ -27,6 +27,7 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting; +import io.netty.util.ReferenceCountUtil; import org.apache.hadoop.oncrpc.RpcAcceptedReply.AcceptState; import org.apache.hadoop.oncrpc.security.Verifier; import org.apache.hadoop.oncrpc.security.VerifierNone; @@ -164,6 +165,15 @@ public void stopDaemons() {} public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { RpcInfo info = (RpcInfo) msg; + try { + channelRead(ctx, info); + } finally { + ReferenceCountUtil.release(info.data()); + } + } + + private void channelRead(ChannelHandlerContext ctx, RpcInfo info) + throws Exception { RpcCall call = (RpcCall) info.header(); SocketAddress remoteAddress = info.remoteAddress(); @@ -257,4 +267,4 @@ public int getPort() { public int getPortmapUdpTimeoutMillis() { return portmapUdpTimeoutMillis; } -} \ No newline at end of file +} diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcUtil.java b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcUtil.java index e8bc27d687fea9..6fda4b1bd5e8da 100644 --- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcUtil.java +++ b/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcUtil.java @@ -129,15 +129,16 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) RpcInfo info = null; try { RpcCall callHeader = RpcCall.read(in); - ByteBuf dataBuffer = Unpooled.wrappedBuffer(in.buffer() - .slice()); - + ByteBuf dataBuffer = buf.slice(b.position(), b.remaining()); info = new RpcInfo(callHeader, dataBuffer, ctx, ctx.channel(), remoteAddress); } catch (Exception exc) { LOG.info("Malformed RPC request from " + remoteAddress); } finally { - buf.release(); + // only release buffer if it is not passed to downstream handler + if (info == null) { + buf.release(); + } } if (info != null) { diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml b/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml index ab543427c5a1dd..104f7ce7a75b6c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml +++ b/hadoop-hdfs-project/hadoop-hdfs-client/pom.xml @@ -89,10 +89,18 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> io.netty netty-common + + io.netty + netty-codec-socks + io.netty netty-handler + + io.netty + netty-handler-proxy + io.netty netty-transport diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 69c4b05ff3dab2..f6e514d7f4cd30 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -139,7 +139,7 @@ 3.1.0-incubating 4.1.0-incubating 3.2.4 - 4.1.68.Final + 4.1.94.Final 1.1.10.4 @@ -935,6 +935,66 @@ ${netty4.version} + + io.netty + netty-codec-socks + ${netty4.version} + + + + io.netty + netty-handler-proxy + ${netty4.version} + + + + io.netty + netty-resolver + ${netty4.version} + + + + io.netty + netty-handler + ${netty4.version} + + + + io.netty + netty-buffer + ${netty4.version} + + + + io.netty + netty-transport + ${netty4.version} + + + + io.netty + netty-common + ${netty4.version} + + + + io.netty + netty-transport-native-unix-common + ${netty4.version} + + + + io.netty + netty-transport-native-epoll + ${netty4.version} + + + + io.netty + netty-codec + ${netty4.version} + + commons-io commons-io