[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-11-09 Thread Brandon Williams (Jira)


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

Brandon Williams commented on CASSANDRA-17254:
--

+1

> 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
>
>
> 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



[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-11-09 Thread Jordan West (Jira)


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

Jordan West commented on CASSANDRA-17254:
-

Updated the branch linked above with the 3.11 code and kicked off tests  
[here|https://app.circleci.com/pipelines/github/jrwest/cassandra/112/workflows/4c88ab60-cd11-4579-b4ee-d8f3c241d6fc]

> 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



[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-11-07 Thread Brandon Williams (Jira)


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

Brandon Williams commented on CASSANDRA-17254:
--

That was from CASSANDRA-9241 and seems trustworthy to me.

> 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



[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-11-07 Thread Jordan West (Jira)


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

Jordan West commented on CASSANDRA-17254:
-

If I am reading the 3.11 code right (pasted below jic), it uses {{bytesToHex}} 
for the key but just uses the {{ByteBuffer}} directly unlike my patch which 
duplicates it. I am fine with the 3.11 approach as well assuming the comment is 
correct:


{code:java}
//Not duplicating the buffer for safety because AbstractSerializer and 
ByteBufferUtil.bytesToHex
//don't modify position or limit
ByteBuffer key = counter.getItem();
result.put(new CompositeDataSupport(COUNTER_COMPOSITE_TYPE, COUNTER_NAMES, new 
Object[] {
ByteBufferUtil.bytesToHex(key), // raw
counter.getCount(),  // count
counter.getError(),  // error
metadata.getKeyValidator().getString(key) })); // string {code}
 

> 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



[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-11-07 Thread Brandon Williams (Jira)


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

Brandon Williams commented on CASSANDRA-17254:
--

.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



[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-11-07 Thread Cheng Wang (Jira)


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

Cheng Wang commented on CASSANDRA-17254:


+1. Approached. 

> 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



[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-11-07 Thread Jordan West (Jira)


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

Jordan West commented on CASSANDRA-17254:
-

I'm generally +1 on adding tests but it looks like it will be somewhat 
cumbersome for this function. Any recommendations on approaches? 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? 

> 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



[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-11-07 Thread Brandon Williams (Jira)


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

Brandon Williams commented on CASSANDRA-17254:
--

Can we add a test for this?

> 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



[jira] [Commented] (CASSANDRA-17254) nodetool toppartitions can fail because ByteBuffer.array() returns more bytes than would be considered valid by UTF8Serializer.validate

2022-01-10 Thread Jordan West (Jira)


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

Jordan West commented on CASSANDRA-17254:
-

https://github.com/apache/cassandra/compare/cassandra-3.0...jrwest:jwest/17254-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.1#820001)

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