[ 
https://issues.apache.org/jira/browse/CASSANDRA-17254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17630066#comment-17630066
 ] 

Brandon Williams edited comment on CASSANDRA-17254 at 11/7/22 10:26 PM:
------------------------------------------------------------------------

bq. I was thinking maybe an in-JVM dtest but the key has to be a certain format 
to trigger the issue. On the other hand, the usage of the ByteBuffer API here 
is definitely wrong. Thoughts?

You're right, that's a lot of effort to trigger it.  The usage is definitely 
wrong though, that person didn't know what they were doing (it was me.)

3.11 doesn't seem to have this problem and uses ByteBufferUtil.bytesToHex 
instead, any reason not to just backport that solution to 3.0?


was (Author: brandon.williams):
.bq I was thinking maybe an in-JVM dtest but the key has to be a certain format 
to trigger the issue. On the other hand, the usage of the ByteBuffer API here 
is definitely wrong. Thoughts?

You're right, that's a lot of effort to trigger it.  The usage is definitely 
wrong though, that person didn't know what they were doing (it was me.)

3.11 doesn't seem to have this problem and uses ByteBufferUtil.bytesToHex 
instead, any reason not to just backport that solution to 3.0?

> nodetool toppartitions can fail because ByteBuffer.array() returns more bytes 
> than would be considered valid by UTF8Serializer.validate
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-17254
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17254
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tool/nodetool
>            Reporter: Jordan West
>            Assignee: Jordan West
>            Priority: Normal
>             Fix For: 3.0.x, 3.11.x
>
>
> The error below is caused by the use of 
> [{{ByteBuffer.array()}}|https://github.com/apache/cassandra/blob/cassandra-3.0/src/java/org/apache/cassandra/db/ColumnFamilyStore.java#L1628].
>  Doing so not only makes the hex key potentially incorrect but causes invalid 
> data to be passed to {{AbstractType.getString}} and ultimately 
> {{UTF8Validator.validate}}. 
> {code}
> error: String didn't validate.
> -- StackTrace --
> org.apache.cassandra.serializers.MarshalException: String didn't validate.
>       at 
> org.apache.cassandra.serializers.UTF8Serializer.validate(UTF8Serializer.java:35)
>       at 
> org.apache.cassandra.db.marshal.AbstractType.getString(AbstractType.java:129)
>       at 
> org.apache.cassandra.db.ColumnFamilyStore.finishLocalSampling(ColumnFamilyStore.java:1633)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to