dengzhhu653 commented on PR #3127: URL: https://github.com/apache/thrift/pull/3127#issuecomment-2849833280
While I was trying to debug a problem, I found every transport had `knownMessageSize` and `remainingMessageSize`, in this example, TSaslServerTransport, TSocket and TMemoryInputTransport: <img width="761" alt="Screenshot 2025-05-05 at 11 16 03" src="https://github.com/user-attachments/assets/a75ac121-ec35-4c62-9b70-dfd11f2d9e11" /> When "MaxMessageSize reached", only `remainingMessageSize` in TMemoryInputTransport was reaching the limit, the stack: > org.apache.thrift.transport.TTransportException: MaxMessageSize reached at org.apache.thrift.transport.TEndpointTransport.countConsumedMessageBytes(TEndpointTransport.java:96) at org.apache.thrift.transport.TMemoryInputTransport.read(TMemoryInputTransport.java:97) at org.apache.thrift.transport.TSaslTransport.read(TSaslTransport.java:390) at org.apache.thrift.transport.TSaslServerTransport.read(TSaslServerTransport.java:44) at org.apache.thrift.transport.TTransport.readAll(TTransport.java:109) at org.apache.thrift.protocol.TBinaryProtocol.readStringBody(TBinaryProtocol.java:417) at org.apache.thrift.protocol.TBinaryProtocol.readString(TBinaryProtocol.java:411) at org.apache.hadoop.hive.metastore.api.StorageDescriptor$StorageDescriptorStandardScheme.read(StorageDescriptor.java:1289) Looks it's of no use to maintain the `knownMessageSize` and `remainingMessageSize` in the TSaslServerTransport, TSocket, so I'm thinking of how to improve and trim the validation from the chain. Instead of putting the limit check on the top of the chain(in reality we don't know who will at the top), I try to put it at the bottom(the TSocket) as this PR suggests. > the test is intended to happen before we even try to read. yeah, this happens on the read on a string or a container as far as I know, which we have some checks on them on the protocol lawyer. -- 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: notifications-unsubscr...@thrift.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org