[
https://issues.apache.org/jira/browse/THRIFT-1324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18112782#comment-18112782
]
Sylwester Lachiewicz edited comment on THRIFT-1324 at 9/8/26 1:44 PM:
----------------------------------------------------------------------
The read side enforces the limit: {{readFrame()}} rejects a frame over
{{getMaxFrameSize()}}. The write side does not —
[TFramedTransport.java:185|https://github.com/apache/thrift/blob/master/lib/java/src/main/java/org/apache/thrift/transport/layered/TFramedTransport.java#L185]
encodes the frame size and hands the buffer to the inner transport with no
check, and the fast-framed variant does the same at
[TFastFramedTransport.java:195|https://github.com/apache/thrift/blob/master/lib/java/src/main/java/org/apache/thrift/transport/layered/TFastFramedTransport.java#L195].
The distinguishable exception type asked for here is also unimplemented.
Reopening; the 0.13.0 fix version does not apply.
was (Author: slachiewicz):
Frame size limits are enforced through TConfiguration:
[lib/java/src/main/java/org/apache/thrift/transport/layered/TFramedTransport.java|https://github.com/apache/thrift/blob/master/lib/java/src/main/java/org/apache/thrift/transport/layered/TFramedTransport.java]
line 154 and
[lib/java/src/main/java/org/apache/thrift/transport/layered/TFastFramedTransport.java|https://github.com/apache/thrift/blob/master/lib/java/src/main/java/org/apache/thrift/transport/layered/TFastFramedTransport.java]
line 165 reject frames over {{getMaxFrameSize()}}; {{setMaxFrameSize()}} is
honored at construction. Resolving as Fixed.
> TFramedTransport should enforce frame size limits on writes
> -----------------------------------------------------------
>
> Key: THRIFT-1324
> URL: https://issues.apache.org/jira/browse/THRIFT-1324
> Project: Thrift
> Issue Type: Bug
> Components: Java - Library
> Reporter: James P. Ancona
> Priority: Major
> Labels: easyfix
> Fix For: 0.13.0
>
>
> Currently TFramedTransport only enforces the maximum frame size when it
> receives a frame larger than its configured maxLength_ value. so there is no
> way to enforce a maximum frame size on the client. Because servers typically
> deal with oversized frames by silently dropping them (see THRIFT-1323),
> problems caused by oversized frames can be very hard to diagnose. Enforcing
> the maximum frame size on writes would enable clients to detect the frame
> size mismatch, assuming the client and server are configured with the same
> value.
> Note that the exception thrown in this case should not be a generic
> TTransportException--it should be either a subclass or a new
> TTransportException.type_ value so that clients can distinguish the frame too
> large error. This is important because most other TTransportException causes
> reflect transient conditions where retry may be appropriate, but a too-large
> frame will never succeed if retried.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)