Tommy Stendahl created CASSJAVA-70:
--------------------------------------
Summary: Failure to decode messages with both custom payload and
warnings
Key: CASSJAVA-70
URL: https://issues.apache.org/jira/browse/CASSJAVA-70
Project: Apache Cassandra Java driver
Issue Type: Bug
Components: Core
Reporter: Tommy Stendahl
We found an issue in the java-driver 4.x with decoding messages received from
Cassandra. If a message contains both custom payload and a warning message they
are decoded in the wrong order and the result is an exception.
{quote}Caused by: java.lang.IndexOutOfBoundsException: index: 139744, length:
13361 (expected: range(0, 143602)) at
io.netty.buffer.AbstractByteBuf.checkRangeBounds(AbstractByteBuf.java:1390){quote}
The protocol spec says
"If either or both of the tracing and warning flags are set, the custom
payload will follow those indicated elements in the body."
[https://github.com/apache/cassandra/blob/trunk/doc/native_protocol_v5.spec#L300]
And the implementation in Cassandra it encodes the tracing first and warning
after that and after the warning it encodes the custom payload.
[https://github.com/apache/cassandra/blob/8a16f2fce8f60c20d6ad743e9a3fc4f4766b3608/src/java/org/apache/cassandra/transport/Message.java#L373]
The parsing in native-protocol (used by java-driver-core) expects custom
payload to be before warnings.
[https://github.com/datastax/native-protocol/blob/1.x/src/main/java/com/datastax/oss/protocol/internal/FrameCodec.java#L325]So
trying to parse a frame that contains both warnings and custom payload it will
try to parse the warnings as if they were custom payload.
I have created an issue and a PR in datastax/native-protocol.
[https://github.com/datastax/native-protocol/issues/47]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]