Nadav Har'El created CASSANDRA-21763:
----------------------------------------
Summary: Responses with a string between 32768 and 65535 bytes
fail, e.g. a long client warning
Key: CASSANDRA-21763
URL: https://issues.apache.org/jira/browse/CASSANDRA-21763
Project: Apache Cassandra
Issue Type: Bug
Reporter: Nadav Har'El
Since CASSANDRA-20234, {{CBUtil.writeString()}} on the cassandra-6.0 branch and
trunk rejects any string longer than {{Short.MAX_VALUE}} (32767 bytes):
{code:java}
Preconditions.checkArgument(length <= Short.MAX_VALUE, ... "String too large;
expected %d <= %d" ...);
{code}
But the native protocol's [string] has an unsigned 2-byte length, so it may be
up to 65535 bytes, and {{ClientWarn}} still truncates warnings to
{{FBUtilities.MAX_UNSIGNED_SHORT}} (65535). So a warning between 32768 and
65535 bytes makes the response fail with:
{noformat}
java.lang.IllegalArgumentException: String too large; expected 65535 <= 32767
{noformat}
and the client never gets a response, and times out. For example, a batch over
the batch_size_warn_threshold that writes to a few hundred tables with long
names gets such a warning, because the warning lists every table.
Reproduced on Cassandra 6.0-alpha2. Cassandra 5.0.9 handles the same request
correctly (its {{writeString()}} has no such check), returning the warning
truncated, ending with " [truncated]".
Either {{writeString()}} should allow up to 65535 bytes, or {{ClientWarn}} (and
other callers) must truncate to 32767.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]