[ 
https://issues.apache.org/jira/browse/HDFS-17630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17890432#comment-17890432
 ] 

ASF GitHub Bot commented on HDFS-17630:
---------------------------------------

steveloughran commented on code in PR #7063:
URL: https://github.com/apache/hadoop/pull/7063#discussion_r1804681945


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/datatransfer/TestPacketReceiver.java:
##########
@@ -61,7 +61,7 @@ private static byte[] remainingAsArray(ByteBuffer buf) {
   @Test
   public void testPacketSize() {
     assertEquals(PacketReceiver.MAX_PACKET_SIZE,
-            HdfsClientConfigKeys.DFS_DATA_TRANSFER_MAX_PACKET_SIZE_DEFAULT);
+        HdfsClientConfigKeys.DFS_DATA_TRANSFER_MAX_PACKET_SIZE_DEFAULT);

Review Comment:
   needless reformat, but I'm not sure about the ordering of the assertions 
here. 



##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PacketReceiver.java:
##########
@@ -163,7 +163,8 @@ private void doRead(ReadableByteChannel ch, InputStream in)
     // Sanity check the buffer size so we don't allocate too much memory
     // and OOME.
     int totalLen = payloadLen + headerLen;
-    if (totalLen < 0 || totalLen > MAX_PACKET_SIZE) {
+    if (totalLen < 0 || totalLen > (MAX_PACKET_SIZE == 0 ?

Review Comment:
   the ?: stuff should be pulled out of the if clause; too complex





> Avoid PacketReceiver#MAX_PACKET_SIZE Initialized to 0
> -----------------------------------------------------
>
>                 Key: HDFS-17630
>                 URL: https://issues.apache.org/jira/browse/HDFS-17630
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 3.4.0
>            Reporter: dzcxzl
>            Priority: Major
>              Labels: pull-request-available
>
> There are nested calls, causing the MAX_PACKET_SIZE of PacketReceiver to be 0.
>  
> {code:java}
> java.io.IOException: Incorrect value for packet payload size: 1014776
>     at 
> org.apache.hadoop.hdfs.protocol.datatransfer.PacketReceiver.doRead(PacketReceiver.java:167)
>     at 
> org.apache.hadoop.hdfs.protocol.datatransfer.PacketReceiver.receiveNextPacket(PacketReceiver.java:112)
>     at 
> org.apache.hadoop.hdfs.client.impl.BlockReaderRemote.readNextPacket(BlockReaderRemote.java:187)
>     at 
> org.apache.hadoop.hdfs.client.impl.BlockReaderRemote.read(BlockReaderRemote.java:146)
>     at 
> org.apache.hadoop.hdfs.ByteArrayStrategy.readFromBlock(ReaderStrategy.java:118)
>     at 
> org.apache.hadoop.hdfs.DFSInputStream.readBuffer(DFSInputStream.java:789)
>     at 
> org.apache.hadoop.hdfs.DFSInputStream.readWithStrategy(DFSInputStream.java:855)
>     at org.apache.hadoop.hdfs.DFSInputStream.read(DFSInputStream.java:919)
>     at java.base/java.io.DataInputStream.read(DataInputStream.java:158)
>     at java.base/java.io.InputStream.transferTo(InputStream.java:796)
>     at java.base/java.nio.file.Files.copy(Files.java:3151)
>     at 
> java.base/sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:216)
>     at 
> java.base/sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:212)
>     at 
> java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
>     at 
> org.apache.hadoop.conf.Configuration.getTrimmed(Configuration.java:1319)
>     at org.apache.hadoop.conf.Configuration.getInt(Configuration.java:1545)
>     at 
> org.apache.hadoop.hdfs.protocol.datatransfer.PacketReceiver.<clinit>(PacketReceiver.java:82)
>     at 
> org.apache.hadoop.hdfs.client.impl.BlockReaderRemote.<init>(BlockReaderRemote.java:101)
>  {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to