[
https://issues.apache.org/jira/browse/CASSANDRA-21763?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Reza Taroosheh updated CASSANDRA-21763:
---------------------------------------
Test and Documentation Plan:
*Tests*
- {{CBUtilTest}}: round-trip of strings at 32768 and 65535 bytes and of a
multibyte string; rejection at 65536 bytes.
- New {{ClientWarnTest}}: short and max-length warnings are not truncated;
ASCII, multibyte, and surrogate-pair warnings are truncated to at most 65535
encoded bytes without splitting characters.
- Verified the new {{CBUtilTest}} tests fail without the fix with the reported
error.
- Pending: pre-commit CI (no access; requested on the ticket).
*Documentation*
None needed; the change makes the server conform to the existing native
protocol spec ({{[string]}} length is an unsigned short).
Status: Patch Available (was: Open)
> 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
> Components: Messaging/Client
> Reporter: Nadav Har'El
> Assignee: Reza Taroosheh
> Priority: Normal
> Fix For: 6.0.x, 7.x
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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]