Jens Geyer created THRIFT-6241:
----------------------------------
Summary: Use the library-wide default frame size in
TNonblockingServer in the D library
Key: THRIFT-6241
URL: https://issues.apache.org/jira/browse/THRIFT-6241
Project: Thrift
Issue Type: Bug
Components: D - Library
Reporter: Jens Geyer
{{thrift.server.nonblocking.TNonblockingServer}} caps the frame it accepts from
a connection at {{maxFrameSize}}, which defaults to {{DEFAULT_MAX_FRAME_SIZE =
256 * 1024 * 1024}} (lib/d/src/thrift/server/nonblocking.d:351). The rest of
lib/d uses 16384000, the frame size limit shared across the Thrift libraries:
{{DEFAULT_FRAME_SIZE_LIMIT}} in {{thrift.transport.framed}}, and the container
and string size limits of the binary, compact and JSON protocols.
So the D servers disagree with each other. {{TSimpleServer}},
{{TThreadedServer}} and {{TTaskPoolServer}} with a {{TFramedTransportFactory}}
refuse a request frame over 16,384,000 bytes, while {{TNonblockingServer}}
accepts one of up to 268,435,456 bytes. A D client refuses a response frame
over 16,384,000 bytes as well.
The limit is also what bounds the read buffer: {{Connection.transition()}}
reallocates the buffer to the frame length the peer declared before any payload
byte has arrived.
THRIFT-6183 made the same change to the C++ {{TNonblockingServer}}.
The change sets {{DEFAULT_MAX_FRAME_SIZE}} to 16384000. A {{maxFrameSize}}
assigned by the caller still takes precedence.
Compatibility: this lowers a shipped default, and {{DEFAULT_MAX_FRAME_SIZE}} is
public. A deployment that exchanges frames between 16,384,001 and 268,435,456
bytes with {{TNonblockingServer}} and does not set {{maxFrameSize}} will start
having those connections closed; setting {{maxFrameSize}} to {{256 * 1024 *
1024}} restores the previous behaviour. Unlike {{frameSizeLimit}} on
{{TFramedTransport}}, a {{maxFrameSize}} of zero does not switch the check off.
Needs a release note (added to lib/d/README.md).
_Drafted with AI assistance (Claude Opus 5)._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)