Christopher Tubbs created THRIFT-5732:
-----------------------------------------

             Summary: Java - TFramedTransport won't allow max frame size larger 
than default max message size
                 Key: THRIFT-5732
                 URL: https://issues.apache.org/jira/browse/THRIFT-5732
             Project: Thrift
          Issue Type: Bug
          Components: Java - Library
    Affects Versions: 0.14.0
            Reporter: Christopher Tubbs


The constructor for the TFramedTransport.Factory allows directly specifying the 
max frame size. However, if the max frame size provided is larger than the 
default max message size, then the internal checks for the max message size 
will trigger a failure, even if the message is smaller than the max frame size 
that was specified.

For reference, the default max frame size is 16MB, and the default max message 
size is 100MB. So, if you pass in a max frame size of 200MB to the factory, and 
then send a message of size 101MB, this will trigger the error.

A proposed solution would be to have the TFramedTransport.Factory set the 
maximum message size at the same time it sets the max frame size on the 
underlying TConfiguration. I was thinking the max message size could be set to 
the same as the provided max frame size. However, I'm not exactly sure how the 
frame header size comes into play here, so maybe the max message size should be 
slightly larger to account for the frame header size bytes? So maybe the max 
message size should be set to either the larger of: the current value in 
TConfiguration, the default max message size, and the max frame size +4 bytes 
for the frame header? (and being careful not to exceed {{Integer.MAX_VALUE}}).

This bug was introduced in 0.14.0 with THRIFT-5237's Java implementation.
See also the issue reported in Apache Accumulo at 
https://github.com/apache/accumulo/issues/3731 and proposed workarounds on 
https://github.com/apache/accumulo/issues/3737



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

Reply via email to