Hazelcast cache issue

411 views
Skip to first unread message

Alexey Musienko

unread,
Jun 30, 2017, 4:51:19 AM6/30/17
to Hazelcast

Hi Neil,

 

We are using Hazelcast 3.8 for cache over the Spring Cache and time to time having problems.

 

We have the following landscape:

1) Hazelcast server. Look at cluster.xml in attachment.

 

2) Hazelcase client 1, which is running in the same JVM as Hazelcast server. Hazelcast client 1 works in Spring+Vert.x application. 

Look at hazelcast-client_1.xml

 

3) Hazelcast client 2, which is running in another JVM to Hazelcast server. Hazelcast client 2 works in Spring Boot application.

Look at hazelcast-client_2.xml

 

4) Cache config for client 2 in spring boot:

 

import com.hazelcast.client.HazelcastClient;

import com.hazelcast.core.HazelcastInstance;

import com.hazelcast.spring.cache.HazelcastCacheManager;

 

import org.springframework.cache.CacheManager;

import org.springframework.cache.annotation.EnableCaching;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;

import org.springframework.context.annotation.Profile;

@Configuration

@Profile("default")

@EnableCaching

public class CacheConfig {

 

  @Bean(destroyMethod = "shutdown")

  public HazelcastInstance hazelcastInstance() {

    return HazelcastClient.newHazelcastClient();

  }

 

  @Bean

  public CacheManager cacheManager(HazelcastInstance hazelcastInstance) {

     return new HazelcastCacheManager(hazelcastInstance);

  }

}

 

6) Hazelcast config for client 1:

 

<beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xmlns:cache="http://www.springframework.org/schema/cache"

       xsi:schemaLocation="

        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">

 

 

    <cache:annotation-driven cache-manager="cacheManager" />

 

    <bean id="hazelcastClientInstance" class="com.hazelcast.client.HazelcastClient" factory-method="newHazelcastClient" destroy-method="shutdown">

    </bean>

 

    <bean id="cacheManager" class="com.hazelcast.spring.cache.HazelcastCacheManager">

        <constructor-arg ref="hazelcastClientInstance"/>

    </bean>

 

 

</beans>

 

7) We are using spring @CacheEvict,  @Cacheable for cache management.

 

For example:

@CacheEvict(value = "merchantAccounts", allEntries = true) @Cacheable(value = "merchantAccounts")

 

@CacheEvict & @Cacheable are executed in different JVMs. The idea is the following: client 1 & client 2 see the distributed cache.

 

8) After using the platform few hours, we are getting the following an error:

 

11:36:31.650 [vert.x-worker-thread-61] [c990977b-4a01-4c68-a4a4-384d25323982] ERROR c.i.p.t.TransactionProcessorImpl - Error:

 

com.hazelcast.client.HazelcastClientNotActiveException: Partition does not have owner. partitionId : 155

 

               at com.hazelcast.client.spi.impl.ClientInvocation.notifyException(ClientInvocation.java:159) ~[transaction-service-4.42.0-fat.jar:na]

 

               at com.hazelcast.client.spi.impl.ClientInvocation.invoke(ClientInvocation.java:119) ~[transaction-service-4.42.0-fat.jar:na]

 

               at com.hazelcast.client.spi.ClientProxy.invokeOnPartition(ClientProxy.java:153) ~[transaction-service-4.42.0-fat.jar:na]

 

               at com.hazelcast.client.spi.ClientProxy.invoke(ClientProxy.java:148) ~[transaction-service-4.42.0-fat.jar:na]

 

               at com.hazelcast.client.proxy.ClientMapProxy.getInternal(ClientMapProxy.java:291) ~[transaction-service-4.42.0-fat.jar:na]

 

 

According to our log, we don't have any disconnections and an exception happens randomly.

 

hazelcast-client_2.xml
cluster.xml
hazelcast-client_1.xml

Rahul

unread,
Jun 30, 2017, 12:31:31 PM6/30/17
to Hazelcast
How many server nodes do you have in your cluster? The exception does not look expected if there were no disconnections between clients and servers. It would help if you could provide some more specifics i.e. if this exception happens at a specific time or on a specific application event or is this completely random? 

Sertuğ Kaya

unread,
Jul 1, 2017, 5:38:00 AM7/1/17
to Hazelcast
Since it's happening after a couple of hours I don't expect a config issue but a possible connection issue as Rahul pointed out. Sharing more logs of client and members would give a better idea.

acher...@gmail.com

unread,
Jul 3, 2017, 6:43:23 AM7/3/17
to Hazelcast
Hi all,

It happens randomly, without any pattern.

Regarding server nodes and logs:
We have 3 servers and 3 clients.
We don't have anything on server-side log or the same message like in client one.


Thanks,
Anatoly

Sertuğ Kaya

unread,
Jul 4, 2017, 8:52:37 AM7/4/17
to Hazelcast, acher...@gmail.com
It's highly likely there is a connection problem somewhere between members and/or clients since this exception means client does not know the owner of a partition. 
Under normal circumstances clients are regularly updated with partition owner info. That's why we need to look at the bigger picture to detect any anomalies in member/client connection.
Reply all
Reply to author
Forward
0 new messages