Search code examples
ignite

IgniteException: Failed to find atomic long


I am running Ignite v2.1 with 1 server and 2 clients. The clients are running on Tomcat servers and use IgniteSpringBean.

Both clients use the same IgniteAtomicLong. When one client is removed from the grid, when the other client tries to use the AtomicLong it throws the following exception:

class org.apache.ignite.IgniteException: Failed to find atomic long: MY_ATOMIC_LONG
at org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl.getAndIncrement(GridCacheAtomicLongImpl.java:153)

(I do not see this behaviour with IgniteAtomicSequence)

Here is the Exception within the one listed above:

java.lang.IllegalStateException: Atomic long was removed from cache: MY_ATOMIC_LONG
at org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl.removedError(GridCacheAtomicLongImpl.java:328)
at org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl.checkRemoved(GridCacheAtomicLongImpl.java:304)
at org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongImpl.getAndIncrement(GridCacheAtomicLongImpl.java:143)

Here is the server config:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans.xsd">
    <!--
        Alter configuration below as needed.
    -->
    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="peerClassLoadingEnabled" value="true"/>

        <property name="atomicConfiguration">
          <bean class="org.apache.ignite.configuration.AtomicConfiguration">
            <property name="backups" value="1"/>
          </bean>
        </property>

    </bean>     

Here is the client config (abbreviated):

visor> config
Select node from:
+===================================================================================+
| # |     Node ID8(@), IP      | Node Type | Up Time  | CPUs | CPU Load | Free Heap |
+===================================================================================+
| 0 | D67C1CCE(@n0), 10.0.2.15 | Server    | 01:52:48 | 1    | 1.00 %   | 94.00 %   |
| 1 | E9CCF354(@n1), 10.0.2.15 | Client    | 00:27:59 | 1    | 0.67 %   | 71.00 %   |
+-----------------------------------------------------------------------------------+

Choose node number ('c' to cancel) [0]: 1
Common Parameters:
+---------------------------------------------------------------------------+
| Grid name                        | <default>                              |
| Ignite home                      | <n/a>                                  |
| Localhost                        | <n/a>                                  |
| Consistent ID                    | <n/a>                                  |
| Marshaller                       | o.a.i.i.binary.BinaryMarshaller        |
| Deployment mode                  | SHARED                                 |
| ClientMode                       | on                                     |
| Daemon                           | off                                    |
| Remote JMX enabled               | on                                     |
| Node restart enabled             | off                                    |
| Network timeout                  | 5000ms                                 |
| Grid logger                      | o.a.i.i.GridLoggerProxy                |
| Discovery startup delay          | 60000ms                                |
| MBean server                     | com.sun.jmx.mbeanserver.JmxMBeanServer |
| ASCII logo disabled              | off                                    |
| Discovery order not required     | off                                    |
| Shutdown hook disabled           | off                                    |
| Program name                     | <n/a>                                  |
| Quiet mode                       | on                                     |
| Success filename                 | <n/a>                                  |
| Update notification enabled      | on                                     |
| Include properties               | <n/a>                                  |
| Atomic Cache Mode                | PARTITIONED                            |
| Atomic Sequence Reservation Size | 1000                                   |
| Atomic Number Of Backup Nodes    | 0                                      |
| Transaction Concurrency          | OPTIMISTIC                             |
| Transaction Isolation            | SERIALIZABLE                           |
| Transaction Timeout              | 0ms                                    |
| Transaction Log Cleanup Delay    | 10000ms                                |
| Transaction Log Size             | 0                                      |
| Transaction Manager Factory      |                                        |
| Transaction Use JTA              | off                                    |
+---------------------------------------------------------------------------+

Peer-to-Peer:
+------------------------------------+
| Peer class loading enabled   | on  |
| Missed resources cache size  | 100 |
| Peer-to-Peer loaded packages | []  |
+------------------------------------+

+---------------+

Executor services:
+------------------------------------+
| Public thread pool size        | 8 |
| System thread pool size        | 8 |
| Management thread pool size    | 4 |
| IGFS thread pool size          | 1 |
| Peer-to-Peer thread pool size  | 2 |
| Rebalance Thread Pool size     | 1 |
| REST thread pool size          | 8 |
| SQL processor thread pool size | 8 |
+------------------------------------+

Segmentation:
+----------------------------------------+
| Segmentation policy            | STOP  |
| Segmentation resolvers         | <n/a> |
| Segmentation check frequency   | 10000 |
| Wait for segmentation on start | on    |
| All resolvers pass required    | on    |
+----------------------------------------+

Cache 'ignite-sys-cache':
+========================================================================================================+
|                   Name                    |                           Value                            |
+========================================================================================================+
| Group                                     |                                                            |
| Dynamic Deployment ID                     | e8b0e511f51-d33f45a3-5f16-4ff9-98e7-66b9d5086cbc           |
| Mode                                      | REPLICATED                                                 |
| Atomicity Mode                            | TRANSACTIONAL                                              |
| Statistic Enabled                         | off                                                        |
| Management Enabled                        | off                                                        |
| Time To Live Eager Flag                   | true                                                       |
| Write Synchronization Mode                | FULL_SYNC                                                  |
| Invalidate                                | off                                                        |
| Affinity Function                         | o.a.i.cache.affinity.rendezvous.RendezvousAffinityFunction |
| Affinity Backups                          | 2147483647                                                 |
| Affinity Partitions                       | 100                                                        |
| Affinity Exclude Neighbors                | false                                                      |
| Affinity Mapper                           | o.a.i.i.processors.cache.GridCacheDefaultAffinityKeyMapper |
| Rebalance Mode                            | SYNC                                                       |
| Rebalance Batch Size                      | 524288                                                     |
| Rebalance Timeout                         | 10000                                                      |
| Rebalance Delay                           | 0                                                          |
| Time Between Rebalance Messages           | 0                                                          |
| Eviction Policy Enabled                   | off                                                        |
| Eviction Policy                           | <n/a>                                                      |
| Eviction Policy Max Size                  | <n/a>                                                      |
| Eviction Filter                           | <n/a>                                                      |
| Near Cache Enabled                        | off                                                        |
| Near Start Size                           | 0                                                          |
| Near Eviction Policy                      | <n/a>                                                      |
| Near Eviction Policy Max Size             | <n/a>                                                      |
| Default Lock Timeout                      | 0                                                          |
| Metadata type count                       | 0                                                          |
| Cache Interceptor                         | <n/a>                                                      |
| Store Enabled                             | off                                                        |
| Store Class                               | <n/a>                                                      |
| Store Factory Class                       |                                                            |
| Store Keep Binary                         | false                                                      |
| Store Read Through                        | off                                                        |
| Store Write Through                       | off                                                        |
| Write-Behind Enabled                      | off                                                        |
| Write-Behind Flush Size                   | 10240                                                      |
| Write-Behind Frequency                    | 5000                                                       |
| Write-Behind Flush Threads Count          | 1                                                          |
| Write-Behind Batch Size                   | 512                                                        |
| Concurrent Asynchronous Operations Number | 500                                                        |
| Loader Factory Class Name                 | <n/a>                                                      |
| Writer Factory Class Name                 | <n/a>                                                      |
| Expiry Policy Factory Class Name          | javax.cache.configuration.FactoryBuilder$SingletonFactory  |
| Query Execution Time Threshold            | 3000                                                       |
| Query Schema Name                         |                                                            |
| Query Escaped Names                       | off                                                        |
| Query SQL functions                       | <n/a>                                                      |
| Query Indexed Types                       | <n/a>                                                      |
+--------------------------------------------------------------------------------------------------------+


Cache 'ignite-sys-atomic-cache@default-ds-group':
+==========================================================================================================+
|                   Name                    |                            Value                             |
+==========================================================================================================+
| Group                                     | default-ds-group                                             |
| Dynamic Deployment ID                     | a2e3f511f51-3dcaee4b-3f06-437d-99ae-2bd541f06ec8             |
| Mode                                      | PARTITIONED                                                  |
| Atomicity Mode                            | TRANSACTIONAL                                                |
| Statistic Enabled                         | off                                                          |
| Management Enabled                        | off                                                          |
| Time To Live Eager Flag                   | true                                                         |
| Write Synchronization Mode                | FULL_SYNC                                                    |
| Invalidate                                | off                                                          |
| Affinity Function                         | o.a.i.cache.affinity.rendezvous.RendezvousAffinityFunction   |
| Affinity Backups                          | 0                                                            |
| Affinity Partitions                       | 1024                                                         |
| Affinity Exclude Neighbors                | false                                                        |
| Affinity Mapper                           | o.a.i.i.processors.cache.CacheDefaultBinaryAffinityKeyMapper |
| Rebalance Mode                            | SYNC                                                         |
| Rebalance Batch Size                      | 524288                                                       |
| Rebalance Timeout                         | 10000                                                        |
| Rebalance Delay                           | 0                                                            |
| Time Between Rebalance Messages           | 0                                                            |
| Eviction Policy Enabled                   | off                                                          |
| Eviction Policy                           | <n/a>                                                        |
| Eviction Policy Max Size                  | <n/a>                                                        |
| Eviction Filter                           | <n/a>                                                        |
| Near Cache Enabled                        | off                                                          |
| Near Start Size                           | 0                                                            |
| Near Eviction Policy                      | <n/a>                                                        |
| Near Eviction Policy Max Size             | <n/a>                                                        |
| Default Lock Timeout                      | 0                                                            |
| Metadata type count                       | 0                                                            |
| Cache Interceptor                         | <n/a>                                                        |
| Store Enabled                             | off                                                          |
| Store Class                               | <n/a>                                                        |
| Store Factory Class                       |                                                              |
| Store Keep Binary                         | false                                                        |
| Store Read Through                        | off                                                          |
| Store Write Through                       | off                                                          |
| Write-Behind Enabled                      | off                                                          |
| Write-Behind Flush Size                   | 10240                                                        |
| Write-Behind Frequency                    | 5000                                                         |
| Write-Behind Flush Threads Count          | 1                                                            |
| Write-Behind Batch Size                   | 512                                                          |
| Concurrent Asynchronous Operations Number | 500                                                          |
| Loader Factory Class Name                 | <n/a>                                                        |
| Writer Factory Class Name                 | <n/a>                                                        |
| Expiry Policy Factory Class Name          | javax.cache.configuration.FactoryBuilder$SingletonFactory    |
| Query Execution Time Threshold            | 3000                                                         |
| Query Schema Name                         |                                                              |
| Query Escaped Names                       | off                                                          |
| Query SQL functions                       | <n/a>                                                        |
| Query Indexed Types                       | <n/a>                                                        |
+----------------------------------------------------------------------------------------------------------+

visor> 

Solution

  • Most possible that was invoked IgniteAtomicLong#close method. It's not necessary that it was invoked directly by you, It could be invoked because it implements Closeable interface, for example:

    1. You used try-with-resource on this IgniteAtomicLong

    try(IgniteAtomicLong atomicLong = ignite.atomicLong(name, 1, true)) {}

    1. Added IgniteAtomicLong as a field of bean class and added it to the Spring context. After closing spring context this atomicLong was closed too.

    So, it's recommended not add IgniteAtomicLong to the Spring context