You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by "Valentin Kulichenko (JIRA)" <ji...@apache.org> on 2015/07/14 01:06:08 UTC

[jira] [Created] (IGNITE-1122) Cache put hangs if key hashCode is implemented incorrectly

Valentin Kulichenko created IGNITE-1122:
-------------------------------------------

             Summary: Cache put hangs if key hashCode is implemented incorrectly
                 Key: IGNITE-1122
                 URL: https://issues.apache.org/jira/browse/IGNITE-1122
             Project: Ignite
          Issue Type: Bug
          Components: cache
    Affects Versions: 1.1.4
            Reporter: Valentin Kulichenko
            Priority: Critical


If key {{hashCode()}} returns inconsistent result (e.g., user used {{Enum.hashCode()}} in his implementation), the exception below is thrown on a server node and put operation hangs.
{code}
SEVERE: Future execution resulted in error: GridEmbeddedFuture [embedded=GridFinishedFuture [resFlag=2, startTime=1436797251202]]
class org.apache.ignite.IgniteCheckedException: Creating partition which does not belong [part=118, topVer=AffinityTopologyVersion [topVer=5, minorTopVer=4], this.topVer=AffinityTopologyVersion [topVer=5, minorTopVer=4]]
                at org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:6753)
                at org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:124)
                at org.apache.ignite.internal.processors.cache.GridCacheUtils$22.apply(GridCacheUtils.java:851)
                at org.apache.ignite.internal.processors.cache.GridCacheUtils$22.apply(GridCacheUtils.java:848)
                at org.apache.ignite.internal.util.future.GridFutureAdapter.notifyListener(GridFutureAdapter.java:241)
                at org.apache.ignite.internal.util.future.GridFutureAdapter.listen(GridFutureAdapter.java:204)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.processNearLockRequest(GridDhtTransactionalCacheAdapter.java:525)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.access$000(GridDhtTransactionalCacheAdapter.java:52)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$2.apply(GridDhtTransactionalCacheAdapter.java:96)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$2.apply(GridDhtTransactionalCacheAdapter.java:94)
                at org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:532)
                at org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:240)
                at org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:158)
                at org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$000(GridCacheIoManager.java:48)
                at org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:127)
                at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:690)
                at org.apache.ignite.internal.managers.communication.GridIoManager.access$1500(GridIoManager.java:58)
                at org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:653)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
                at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException [part=118, msg=Creating partition which does not belong [part=118, topVer=AffinityTopologyVersion [topVer=5, minorTopVer=4], this.topVer=AffinityTopologyVersion [topVer=5, minorTopVer=4]]]
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl.localPartition(GridDhtPartitionTopologyImpl.java:527)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl.localPartition(GridDhtPartitionTopologyImpl.java:496)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl.onAdded(GridDhtPartitionTopologyImpl.java:580)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry.<init>(GridDhtCacheEntry.java:79)
                at org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCacheEntry.<init>(GridDhtColocatedCacheEntry.java:46)
                at org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedOffHeapCacheEntry.<init>(GridDhtColocatedOffHeapCacheEntry.java:46)
                at org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache$1.create(GridDhtColocatedCache.java:90)
                at org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Segment.put0(GridCacheConcurrentMap.java:964)
                at org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Segment.putIfObsolete(GridCacheConcurrentMap.java:1028)
                at org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap.putEntryIfObsoleteOrAbsent(GridCacheConcurrentMap.java:496)
                at org.apache.ignite.internal.processors.cache.GridCacheAdapter.entry0(GridCacheAdapter.java:854)
                at org.apache.ignite.internal.processors.cache.GridCacheAdapter.entryEx(GridCacheAdapter.java:838)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.entryEx(GridDhtCacheAdapter.java:312)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.entryExx(GridDhtCacheAdapter.java:331)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$9.apply(GridDhtTransactionalCacheAdapter.java:782)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$9.apply(GridDhtTransactionalCacheAdapter.java:694)
                at org.apache.ignite.internal.util.future.GridEmbeddedFuture$2.applyx(GridEmbeddedFuture.java:86)
                at org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener1.apply(GridEmbeddedFuture.java:240)
                at org.apache.ignite.internal.util.future.GridEmbeddedFuture$AsyncListener1.apply(GridEmbeddedFuture.java:233)
                at org.apache.ignite.internal.util.future.GridFinishedFuture.listen(GridFinishedFuture.java:132)
                at org.apache.ignite.internal.util.future.GridEmbeddedFuture.<init>(GridEmbeddedFuture.java:83)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.lockAllAsync(GridDhtTransactionalCacheAdapter.java:693)
                at org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.processNearLockRequest(GridDhtTransactionalCacheAdapter.java:521)
                ... 14 more
{code}

Need to do the following:
# Fix error message to be more explanatory. It should suggest possible reasons (incorrect affinity configuration, wrong {{hashCode()}}, ...) and possible solutions.
# Cache operation should not hang. Instead we should rollback the transaction and return a response with exception to client.
# If enum itself is used as a key, we should automatically use {{ordinal()}} instead of {{hashCode()}}.
# Add unit tests that will emulate wrong inconsistent hash code calculation and check different cases.
# Add documentation page with good practices and pitfalls of implementing {{hashCode()}} and {{equals()}} methods.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)