Jens Geyer created THRIFT-6225:
----------------------------------
Summary: Java: TZlibTransport counts decompressed bytes against a
message budget that only flush() resets
Key: THRIFT-6225
URL: https://issues.apache.org/jira/browse/THRIFT-6225
Project: Thrift
Issue Type: Bug
Components: Java - Library
Reporter: Jens Geyer
{{TZlibTransport.read()}} calls {{checkReadBytesAvailable(len)}} and
{{countConsumedMessageBytes(bytesRead)}} on every read. The budget is never
bound to a message -- {{updateKnownMessageSize()}} is not called anywhere in
the class -- and the only reset is the one {{TIOStreamTransport.flush()}}
performs.
On a server the budget is therefore restored whenever a reply is flushed, and
not otherwise. A long-lived connection that carries only oneway calls never
flushes, so it counts every decompressed byte it reads against
{{maxMessageSize}} (100 MB by default) and eventually refuses an ordinary
request with "MaxMessageSize reached".
This comes from reading the code on master; it has not been reproduced.
THRIFT-5862 discusses which transport in a chain should track the budget in
general; this is one concrete case of that question.
Suggested fix: reset the budget at message boundaries, as the framed transports
do, or leave the accounting to the transport underneath.
_Drafted with AI assistance (Claude Opus 5); reviewed and filed by Jens Geyer._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)