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


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

Review Comment:
   https://github.com/apache/hadoop/pull/7063#issuecomment-2370670841
   
   PacketReceiver may make nested calls when reading conf, and the static block 
has not yet been initialized.
   
   ```java
        at 
org.apache.hadoop.hdfs.protocol.datatransfer.PacketReceiver.doRead(PacketReceiver.java:166)
        at 
org.apache.hadoop.hdfs.protocol.datatransfer.PacketReceiver.receiveNextPacket(PacketReceiver.java:112)
   
   ...
   
        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)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to