ferrirW commented on a change in pull request #2533:
URL: https://github.com/apache/thrift/pull/2533#discussion_r815548094



##########
File path: lib/java/src/org/apache/thrift/server/AbstractNonblockingServer.java
##########
@@ -51,6 +51,7 @@
 
   public static abstract class AbstractNonblockingServerArgs<T extends 
AbstractNonblockingServerArgs<T>> extends AbstractServerArgs<T> {
     public long maxReadBufferBytes = 256 * 1024 * 1024;
+    public long maxReadFrameBytes = 256 * 1024 * 1024;

Review comment:
       And if you are asking why need this constant:
   
   I want to separate this two judgments, so method handleRead() could 
cleanupSelectionKey when the frame size is large but does not reach the 
MAX_READ_BUFFER_BYTES limit. Then the select method will not cycle through the 
CPU indefinitely as shown above.
   
   ```
             if (frameSize > MAX_READ_FRAME_BYTES) {
               LOGGER.error("Read a frame size of " + frameSize
                   + ", which is bigger than the maximum allowable frame size "
                   + MAX_READ_FRAME_BYTES + " for ALL connections.");
               return false;
             }
   
             // if this frame will push us over the memory limit, then return.
             // with luck, more memory will free up the next time around.
             if (readBufferBytesAllocated.get() + frameSize > 
MAX_READ_BUFFER_BYTES) {
               return true;
             }
   ```
   




-- 
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]


Reply via email to