[ 
https://issues.apache.org/jira/browse/IGNITE-14893?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ilya Korol updated IGNITE-14893:
--------------------------------
    Description: 
There's a bug in GridCacheWriteBehindStore in the flusher method.

[https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java#L674]

The logic states there that if flush thread count is not a power of 2, then 
perform this math, which is not guaranteed to return a positive number.

{code:java}
idx = ((h = key.hashCode()) ^ (h >>> 16)) % flushThreadCnt
{code}

For example, if you pass this string as a key, it returns a negative number:
*accb2e8ea33e4a89b4189463cacc3c4e*

and then throws an array out of bounds exception when looking up the thread.



https://lists.apache.org/list.html?d...@ignite.apache.org

  was:
There's a bug in GridCacheWriteBehindStore in the flusher method.

[https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java#L674]

The logic states there that if flush thread count is not a power of 2, then 
perform this math, which is not guaranteed to return a positive number.

{code:java}
idx = ((h = key.hashCode()) ^ (h >>> 16)) % flushThreadCnt
{code}

For example, if you pass this string as a key, it returns a negative number:
*accb2e8ea33e4a89b4189463cacc3c4e*

and then throws an array out of bounds exception when looking up the thread.



http://apache-ignite-developers.2346864.n4.nabble.com/IndexOutOfBoundsException-in-GridCacheWriteBehindStore-Flusher-thread-lookup-IGNITE-14893-tt52827.html#none


> Bug in GridCacheWriteBehindStore Flusher thread lookup
> ------------------------------------------------------
>
>                 Key: IGNITE-14893
>                 URL: https://issues.apache.org/jira/browse/IGNITE-14893
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 2.8, 2.7.5, 2.7.6, 2.9, 2.8.1, 2.10, 2.9.1
>            Reporter: Mike W
>            Assignee: Ilya Korol
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> There's a bug in GridCacheWriteBehindStore in the flusher method.
> [https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStore.java#L674]
> The logic states there that if flush thread count is not a power of 2, then 
> perform this math, which is not guaranteed to return a positive number.
> {code:java}
> idx = ((h = key.hashCode()) ^ (h >>> 16)) % flushThreadCnt
> {code}
> For example, if you pass this string as a key, it returns a negative number:
> *accb2e8ea33e4a89b4189463cacc3c4e*
> and then throws an array out of bounds exception when looking up the thread.
> https://lists.apache.org/list.html?d...@ignite.apache.org



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to