Dmitry Konstantinov created IGNITE-8978: -------------------------------------------
Summary: Affinity throws "IgniteException: Failed to find cache" after an Ignite client re-connect Key: IGNITE-8978 URL: https://issues.apache.org/jira/browse/IGNITE-8978 Project: Ignite Issue Type: Bug Affects Versions: 2.5 Environment: ver. 2.5.0#20180523-sha1:86e110c7 OS: Windows 7 6.1 amd64 Java(TM) SE Runtime Environment 1.8.0_101-b13 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.101-b13 Reporter: Dmitry Konstantinov Use case: # A single Ignite server node is deployed and running. # An ignite Java client connects to the server node and starts to do cache operations (put/get) + invoke Affinity.mapKeyToNode() method. # The Ignite server process is killed # Waiting for some time # Starting the Ignite server back. {code:java} public static void main(String ... args) throws InterruptedException { Ignition.setClientMode(true); String config = "ignite-config.xml"; try (Ignite ignite = Ignition.start(config)) { String cacheName = "testCache"; IgniteCache<String, String> cache = ignite.cache(cacheName); Affinity<String> affinity = ignite.affinity(cacheName); while (true) { try { String key = "testKey"; cache.put(key, "testValue"); String value = cache.get(key); ClusterNode primary = affinity.mapKeyToNode(key); System.out.println("read value: " + value + ", primary node: " + primary); } catch (Exception e) { System.out.println("Error: " + e.toString()); e.printStackTrace(); } finally { Thread.sleep(1000); } } } } {code} Expected result: affinity.mapKeyToNode(key) starts to work after a re-connection to the restarted server Actual result: affinity.mapKeyToNode(key) continues to throw the following exception: {code:java} class org.apache.ignite.IgniteException: Failed to find cache (cache was not started yet or cache was already stopped): testCache at org.apache.ignite.internal.processors.cache.GridCacheAffinityManager.affinityTopologyVersion(GridCacheAffinityManager.java:402) at org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityImpl.topologyVersion(GridCacheAffinityImpl.java:241) at org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityImpl.mapKeysToNodes(GridCacheAffinityImpl.java:189) at org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityImpl.mapKeyToNode(GridCacheAffinityImpl.java:182) at test.ignite.Main.main(Main.java:25) {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)